OLD | NEW |
1 #include "SkBenchmark.h" | 1 #include "SkBenchmark.h" |
2 #include "SkColorPriv.h" | 2 #include "SkColorPriv.h" |
3 #include "SkMatrix.h" | 3 #include "SkMatrix.h" |
4 #include "SkRandom.h" | 4 #include "SkRandom.h" |
5 #include "SkString.h" | 5 #include "SkString.h" |
6 #include "SkPaint.h" | 6 #include "SkPaint.h" |
7 | 7 |
8 #define TILE(x, width) (((x) & 0xFFFF) * width >> 16) | 8 #define TILE(x, width) (((x) & 0xFFFF) * width >> 16) |
9 | 9 |
10 class InterpBench : public SkBenchmark { | 10 class InterpBench : public SkBenchmark { |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 virtual void performTest(int16_t dst[], float x, float dx, int count) = 0; | 29 virtual void performTest(int16_t dst[], float x, float dx, int count) = 0; |
30 | 30 |
31 protected: | 31 protected: |
32 virtual int mulLoopCount() const { return 1; } | 32 virtual int mulLoopCount() const { return 1; } |
33 | 33 |
34 virtual const char* onGetName() { | 34 virtual const char* onGetName() { |
35 return fName.c_str(); | 35 return fName.c_str(); |
36 } | 36 } |
37 | 37 |
38 virtual void onDraw(SkCanvas*) { | 38 virtual void onDraw(const int loops, SkCanvas*) { |
39 int n = this->getLoops() * this->mulLoopCount(); | 39 int n = loops * this->mulLoopCount(); |
40 for (int i = 0; i < n; i++) { | 40 for (int i = 0; i < n; i++) { |
41 this->performTest(fDst, fFx, fDx, kBuffer); | 41 this->performTest(fDst, fFx, fDx, kBuffer); |
42 } | 42 } |
43 } | 43 } |
44 | 44 |
45 private: | 45 private: |
46 typedef SkBenchmark INHERITED; | 46 typedef SkBenchmark INHERITED; |
47 }; | 47 }; |
48 | 48 |
49 class Fixed16D16Interp : public InterpBench { | 49 class Fixed16D16Interp : public InterpBench { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 typedef InterpBench INHERITED; | 154 typedef InterpBench INHERITED; |
155 }; | 155 }; |
156 | 156 |
157 /////////////////////////////////////////////////////////////////////////////// | 157 /////////////////////////////////////////////////////////////////////////////// |
158 | 158 |
159 DEF_BENCH( return new Fixed16D16Interp(); ) | 159 DEF_BENCH( return new Fixed16D16Interp(); ) |
160 DEF_BENCH( return new Fixed32D32Interp(); ) | 160 DEF_BENCH( return new Fixed32D32Interp(); ) |
161 DEF_BENCH( return new Fixed16D48Interp(); ) | 161 DEF_BENCH( return new Fixed16D48Interp(); ) |
162 DEF_BENCH( return new FloatInterp(); ) | 162 DEF_BENCH( return new FloatInterp(); ) |
163 DEF_BENCH( return new DoubleInterp(); ) | 163 DEF_BENCH( return new DoubleInterp(); ) |
OLD | NEW |