OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "SkBenchmark.h" | 8 #include "SkBenchmark.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 class RepeatTileBench : public SkBenchmark { | 86 class RepeatTileBench : public SkBenchmark { |
87 SkPaint fPaint; | 87 SkPaint fPaint; |
88 SkString fName; | 88 SkString fName; |
89 SkBitmap fBitmap; | 89 SkBitmap fBitmap; |
90 bool fIsOpaque; | 90 bool fIsOpaque; |
91 SkBitmap::Config fConfig; | 91 SkBitmap::Config fConfig; |
92 public: | 92 public: |
93 RepeatTileBench(void* param, SkBitmap::Config c, bool isOpaque = false) : IN
HERITED(param) { | 93 RepeatTileBench(SkBitmap::Config c, bool isOpaque = false) { |
94 const int w = 50; | 94 const int w = 50; |
95 const int h = 50; | 95 const int h = 50; |
96 fConfig = c; | 96 fConfig = c; |
97 fIsOpaque = isOpaque; | 97 fIsOpaque = isOpaque; |
98 | 98 |
99 if (SkBitmap::kIndex8_Config == fConfig) { | 99 if (SkBitmap::kIndex8_Config == fConfig) { |
100 fBitmap.setConfig(SkBitmap::kARGB_8888_Config, w, h); | 100 fBitmap.setConfig(SkBitmap::kARGB_8888_Config, w, h); |
101 } else { | 101 } else { |
102 fBitmap.setConfig(fConfig, w, h); | 102 fBitmap.setConfig(fConfig, w, h); |
103 } | 103 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 136 |
137 for (int i = 0; i < this->getLoops(); i++) { | 137 for (int i = 0; i < this->getLoops(); i++) { |
138 canvas->drawPaint(paint); | 138 canvas->drawPaint(paint); |
139 } | 139 } |
140 } | 140 } |
141 | 141 |
142 private: | 142 private: |
143 typedef SkBenchmark INHERITED; | 143 typedef SkBenchmark INHERITED; |
144 }; | 144 }; |
145 | 145 |
146 DEF_BENCH(return new RepeatTileBench(p, SkBitmap::kARGB_8888_Config, true)) | 146 DEF_BENCH(return new RepeatTileBench(SkBitmap::kARGB_8888_Config, true)) |
147 DEF_BENCH(return new RepeatTileBench(p, SkBitmap::kARGB_8888_Config, false)) | 147 DEF_BENCH(return new RepeatTileBench(SkBitmap::kARGB_8888_Config, false)) |
148 DEF_BENCH(return new RepeatTileBench(p, SkBitmap::kRGB_565_Config)) | 148 DEF_BENCH(return new RepeatTileBench(SkBitmap::kRGB_565_Config)) |
149 DEF_BENCH(return new RepeatTileBench(p, SkBitmap::kIndex8_Config)) | 149 DEF_BENCH(return new RepeatTileBench(SkBitmap::kIndex8_Config)) |
OLD | NEW |