| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #include "SkBenchmark.h" | 7 #include "SkBenchmark.h" |
| 8 #include "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkMagnifierImageFilter.h" | 10 #include "SkMagnifierImageFilter.h" |
| 11 #include "SkRandom.h" | 11 #include "SkRandom.h" |
| 12 | 12 |
| 13 #define FILTER_WIDTH_SMALL 32 | 13 #define FILTER_WIDTH_SMALL 32 |
| 14 #define FILTER_HEIGHT_SMALL 32 | 14 #define FILTER_HEIGHT_SMALL 32 |
| 15 #define FILTER_WIDTH_LARGE 256 | 15 #define FILTER_WIDTH_LARGE 256 |
| 16 #define FILTER_HEIGHT_LARGE 256 | 16 #define FILTER_HEIGHT_LARGE 256 |
| 17 | 17 |
| 18 class MagnifierBench : public SkBenchmark { | 18 class MagnifierBench : public SkBenchmark { |
| 19 public: | 19 public: |
| 20 MagnifierBench(void* param, bool small) : | 20 MagnifierBench(bool small) : |
| 21 INHERITED(param), fIsSmall(small), fInitialized(false) { | 21 fIsSmall(small), fInitialized(false) { |
| 22 } | 22 } |
| 23 | 23 |
| 24 protected: | 24 protected: |
| 25 virtual const char* onGetName() SK_OVERRIDE { | 25 virtual const char* onGetName() SK_OVERRIDE { |
| 26 return fIsSmall ? "magnifier_small" : "magnifier_large"; | 26 return fIsSmall ? "magnifier_small" : "magnifier_large"; |
| 27 } | 27 } |
| 28 | 28 |
| 29 virtual void onPreDraw() SK_OVERRIDE { | 29 virtual void onPreDraw() SK_OVERRIDE { |
| 30 if (!fInitialized) { | 30 if (!fInitialized) { |
| 31 make_checkerboard(); | 31 make_checkerboard(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 } | 76 } |
| 77 | 77 |
| 78 bool fIsSmall; | 78 bool fIsSmall; |
| 79 bool fInitialized; | 79 bool fInitialized; |
| 80 SkBitmap fCheckerboard; | 80 SkBitmap fCheckerboard; |
| 81 typedef SkBenchmark INHERITED; | 81 typedef SkBenchmark INHERITED; |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 /////////////////////////////////////////////////////////////////////////////// | 84 /////////////////////////////////////////////////////////////////////////////// |
| 85 | 85 |
| 86 DEF_BENCH( return new MagnifierBench(p, true); ) | 86 DEF_BENCH( return new MagnifierBench(true); ) |
| 87 DEF_BENCH( return new MagnifierBench(p, false); ) | 87 DEF_BENCH( return new MagnifierBench(false); ) |
| OLD | NEW |