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 15 matching lines...) Expand all Loading... |
26 virtual void performTest(int16_t dst[], float x, float dx, int count) = 0; | 26 virtual void performTest(int16_t dst[], float x, float dx, int count) = 0; |
27 | 27 |
28 protected: | 28 protected: |
29 virtual int mulLoopCount() const { return 1; } | 29 virtual int mulLoopCount() const { return 1; } |
30 | 30 |
31 virtual const char* onGetName() { | 31 virtual const char* onGetName() { |
32 return fName.c_str(); | 32 return fName.c_str(); |
33 } | 33 } |
34 | 34 |
35 virtual void onDraw(SkCanvas*) { | 35 virtual void onDraw(SkCanvas*) { |
36 int n = SkBENCHLOOP(kLoop * this->mulLoopCount()); | 36 int n = this->getLoops() * this->mulLoopCount(); |
37 for (int i = 0; i < n; i++) { | 37 for (int i = 0; i < n; i++) { |
38 this->performTest(fDst, fFx, fDx, kBuffer); | 38 this->performTest(fDst, fFx, fDx, kBuffer); |
39 } | 39 } |
40 } | 40 } |
41 | 41 |
42 private: | 42 private: |
43 typedef SkBenchmark INHERITED; | 43 typedef SkBenchmark INHERITED; |
44 }; | 44 }; |
45 | 45 |
46 class Fixed16D16Interp : public InterpBench { | 46 class Fixed16D16Interp : public InterpBench { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 static SkBenchmark* M1(void* p) { return new Fixed32D32Interp(p); } | 157 static SkBenchmark* M1(void* p) { return new Fixed32D32Interp(p); } |
158 static SkBenchmark* M2(void* p) { return new Fixed16D48Interp(p); } | 158 static SkBenchmark* M2(void* p) { return new Fixed16D48Interp(p); } |
159 static SkBenchmark* M3(void* p) { return new FloatInterp(p); } | 159 static SkBenchmark* M3(void* p) { return new FloatInterp(p); } |
160 static SkBenchmark* M4(void* p) { return new DoubleInterp(p); } | 160 static SkBenchmark* M4(void* p) { return new DoubleInterp(p); } |
161 | 161 |
162 static BenchRegistry gReg0(M0); | 162 static BenchRegistry gReg0(M0); |
163 static BenchRegistry gReg1(M1); | 163 static BenchRegistry gReg1(M1); |
164 static BenchRegistry gReg2(M2); | 164 static BenchRegistry gReg2(M2); |
165 static BenchRegistry gReg3(M3); | 165 static BenchRegistry gReg3(M3); |
166 static BenchRegistry gReg4(M4); | 166 static BenchRegistry gReg4(M4); |
OLD | NEW |