| OLD | NEW |
| 1 #include "SkBenchmark.h" | 1 #include "Benchmark.h" |
| 2 #include "SkColorPriv.h" | 2 #include "SkColorPriv.h" |
| 3 #include "SkMatrix.h" | 3 #include "SkMatrix.h" |
| 4 #include "SkPaint.h" |
| 4 #include "SkRandom.h" | 5 #include "SkRandom.h" |
| 5 #include "SkString.h" | 6 #include "SkString.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 Benchmark { |
| 11 enum { | 11 enum { |
| 12 kBuffer = 128, | 12 kBuffer = 128, |
| 13 kLoop = 20000 | 13 kLoop = 20000 |
| 14 }; | 14 }; |
| 15 SkString fName; | 15 SkString fName; |
| 16 int16_t fDst[kBuffer]; | 16 int16_t fDst[kBuffer]; |
| 17 float fFx, fDx; | 17 float fFx, fDx; |
| 18 public: | 18 public: |
| 19 InterpBench(const char name[]) { | 19 InterpBench(const char name[]) { |
| 20 fName.printf("interp_%s", name); | 20 fName.printf("interp_%s", name); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 36 } | 36 } |
| 37 | 37 |
| 38 virtual void onDraw(const int loops, SkCanvas*) { | 38 virtual void onDraw(const int loops, SkCanvas*) { |
| 39 int n = loops * 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 Benchmark INHERITED; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 class Fixed16D16Interp : public InterpBench { | 49 class Fixed16D16Interp : public InterpBench { |
| 50 public: | 50 public: |
| 51 Fixed16D16Interp() : INHERITED("16.16") {} | 51 Fixed16D16Interp() : INHERITED("16.16") {} |
| 52 | 52 |
| 53 protected: | 53 protected: |
| 54 virtual void performTest(int16_t dst[], float fx, float dx, int count) SK_OV
ERRIDE { | 54 virtual void performTest(int16_t dst[], float fx, float dx, int count) SK_OV
ERRIDE { |
| 55 SkFixed curr = SkFloatToFixed(fx); | 55 SkFixed curr = SkFloatToFixed(fx); |
| 56 SkFixed step = SkFloatToFixed(dx); | 56 SkFixed step = SkFloatToFixed(dx); |
| (...skipping 97 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 |