| OLD | NEW |
| 1 /* |
| 2 * Copyright 2015 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 1 #include "Benchmark.h" | 8 #include "Benchmark.h" |
| 2 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
| 3 #include "SkMatrix.h" | 10 #include "SkMatrix.h" |
| 4 #include "SkPaint.h" | 11 #include "SkPaint.h" |
| 5 #include "SkRandom.h" | 12 #include "SkRandom.h" |
| 6 #include "SkString.h" | 13 #include "SkString.h" |
| 7 | 14 |
| 8 #define TILE(x, width) (((x) & 0xFFFF) * width >> 16) | 15 #define TILE(x, width) (((x) & 0xFFFF) * width >> 16) |
| 9 | 16 |
| 10 class InterpBench : public Benchmark { | 17 class InterpBench : public Benchmark { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 31 |
| 25 bool isSuitableFor(Backend backend) override { | 32 bool isSuitableFor(Backend backend) override { |
| 26 return backend == kNonRendering_Backend; | 33 return backend == kNonRendering_Backend; |
| 27 } | 34 } |
| 28 | 35 |
| 29 virtual void performTest(int16_t dst[], float x, float dx, int count) = 0; | 36 virtual void performTest(int16_t dst[], float x, float dx, int count) = 0; |
| 30 | 37 |
| 31 protected: | 38 protected: |
| 32 virtual int mulLoopCount() const { return 1; } | 39 virtual int mulLoopCount() const { return 1; } |
| 33 | 40 |
| 34 virtual const char* onGetName() { | 41 const char* onGetName() override { |
| 35 return fName.c_str(); | 42 return fName.c_str(); |
| 36 } | 43 } |
| 37 | 44 |
| 38 virtual void onDraw(const int loops, SkCanvas*) { | 45 void onDraw(const int loops, SkCanvas*) override { |
| 39 int n = loops * this->mulLoopCount(); | 46 int n = loops * this->mulLoopCount(); |
| 40 for (int i = 0; i < n; i++) { | 47 for (int i = 0; i < n; i++) { |
| 41 this->performTest(fDst, fFx, fDx, kBuffer); | 48 this->performTest(fDst, fFx, fDx, kBuffer); |
| 42 } | 49 } |
| 43 } | 50 } |
| 44 | 51 |
| 45 private: | 52 private: |
| 46 typedef Benchmark INHERITED; | 53 typedef Benchmark INHERITED; |
| 47 }; | 54 }; |
| 48 | 55 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 typedef InterpBench INHERITED; | 161 typedef InterpBench INHERITED; |
| 155 }; | 162 }; |
| 156 | 163 |
| 157 /////////////////////////////////////////////////////////////////////////////// | 164 /////////////////////////////////////////////////////////////////////////////// |
| 158 | 165 |
| 159 DEF_BENCH( return new Fixed16D16Interp(); ) | 166 DEF_BENCH( return new Fixed16D16Interp(); ) |
| 160 DEF_BENCH( return new Fixed32D32Interp(); ) | 167 DEF_BENCH( return new Fixed32D32Interp(); ) |
| 161 DEF_BENCH( return new Fixed16D48Interp(); ) | 168 DEF_BENCH( return new Fixed16D48Interp(); ) |
| 162 DEF_BENCH( return new FloatInterp(); ) | 169 DEF_BENCH( return new FloatInterp(); ) |
| 163 DEF_BENCH( return new DoubleInterp(); ) | 170 DEF_BENCH( return new DoubleInterp(); ) |
| OLD | NEW |