OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkBenchmark.h" | 8 #include "SkBenchmark.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 N = SkBENCHLOOP(10) | 25 N = SkBENCHLOOP(10) |
26 }; | 26 }; |
27 SkPoint fPts[PTS]; | 27 SkPoint fPts[PTS]; |
28 | 28 |
29 public: | 29 public: |
30 LineBench(void* param, SkScalar width, bool doAA) : INHERITED(param) { | 30 LineBench(void* param, SkScalar width, bool doAA) : INHERITED(param) { |
31 fStrokeWidth = width; | 31 fStrokeWidth = width; |
32 fDoAA = doAA; | 32 fDoAA = doAA; |
33 fName.printf("lines_%g_%s", width, doAA ? "AA" : "BW"); | 33 fName.printf("lines_%g_%s", width, doAA ? "AA" : "BW"); |
34 | 34 |
35 SkMWCRandom rand; | 35 SkRandom rand; |
36 for (int i = 0; i < PTS; ++i) { | 36 for (int i = 0; i < PTS; ++i) { |
37 fPts[i].set(rand.nextUScalar1() * 640, rand.nextUScalar1() * 480); | 37 fPts[i].set(rand.nextUScalar1() * 640, rand.nextUScalar1() * 480); |
38 } | 38 } |
39 } | 39 } |
40 | 40 |
41 protected: | 41 protected: |
42 virtual const char* onGetName() SK_OVERRIDE { | 42 virtual const char* onGetName() SK_OVERRIDE { |
43 return fName.c_str(); | 43 return fName.c_str(); |
44 } | 44 } |
45 | 45 |
(...skipping 12 matching lines...) Expand all Loading... |
58 | 58 |
59 private: | 59 private: |
60 typedef SkBenchmark INHERITED; | 60 typedef SkBenchmark INHERITED; |
61 }; | 61 }; |
62 | 62 |
63 DEF_BENCH(return new LineBench(p, 0, false);) | 63 DEF_BENCH(return new LineBench(p, 0, false);) |
64 DEF_BENCH(return new LineBench(p, SK_Scalar1, false);) | 64 DEF_BENCH(return new LineBench(p, SK_Scalar1, false);) |
65 DEF_BENCH(return new LineBench(p, 0, true);) | 65 DEF_BENCH(return new LineBench(p, 0, true);) |
66 DEF_BENCH(return new LineBench(p, SK_Scalar1/2, true);) | 66 DEF_BENCH(return new LineBench(p, SK_Scalar1/2, true);) |
67 DEF_BENCH(return new LineBench(p, SK_Scalar1, true);) | 67 DEF_BENCH(return new LineBench(p, SK_Scalar1, true);) |
OLD | NEW |