OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 | 7 |
8 #include "Benchmark.h" | 8 #include "Benchmark.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 fShaders[count] = fPattern1.fIsBitmap ? fBmShader : nullptr; | 140 fShaders[count] = fPattern1.fIsBitmap ? fBmShader : nullptr; |
141 } else { | 141 } else { |
142 fColors[count] = fPattern2.fColor; | 142 fColors[count] = fPattern2.fColor; |
143 fShaders[count] = fPattern2.fIsBitmap ? fBmShader : nullptr; | 143 fShaders[count] = fPattern2.fIsBitmap ? fBmShader : nullptr; |
144 } | 144 } |
145 ++count; | 145 ++count; |
146 } | 146 } |
147 } | 147 } |
148 } | 148 } |
149 | 149 |
150 void onDraw(const int loops, SkCanvas* canvas) override { | 150 void onDraw(int loops, SkCanvas* canvas) override { |
151 SkPaint paint; | 151 SkPaint paint; |
152 paint.setAntiAlias(false); | 152 paint.setAntiAlias(false); |
153 paint.setFilterQuality(kLow_SkFilterQuality); | 153 paint.setFilterQuality(kLow_SkFilterQuality); |
154 | 154 |
155 for (int i = 0; i < loops; ++i) { | 155 for (int i = 0; i < loops; ++i) { |
156 for (int j = 0; j < NUM_DRAWS; ++j) { | 156 for (int j = 0; j < NUM_DRAWS; ++j) { |
157 paint.setColor(fColors[j]); | 157 paint.setColor(fColors[j]); |
158 paint.setShader(fShaders[j]); | 158 paint.setShader(fShaders[j]); |
159 if (kRect_DrawType == fDrawType) { | 159 if (kRect_DrawType == fDrawType) { |
160 canvas->drawRect(fRects[j], paint); | 160 canvas->drawRect(fRects[j], paint); |
(...skipping 30 matching lines...) Expand all Loading... |
191 | 191 |
192 DEF_BENCH(return new AlternatingColorPatternBench(kOpaqueBitmap_ColorPattern, | 192 DEF_BENCH(return new AlternatingColorPatternBench(kOpaqueBitmap_ColorPattern, |
193 kOpaqueBitmap_ColorPattern, | 193 kOpaqueBitmap_ColorPattern, |
194 kRect_DrawType);) | 194 kRect_DrawType);) |
195 DEF_BENCH(return new AlternatingColorPatternBench(kAlphaBitmap_ColorPattern, | 195 DEF_BENCH(return new AlternatingColorPatternBench(kAlphaBitmap_ColorPattern, |
196 kAlphaBitmap_ColorPattern, | 196 kAlphaBitmap_ColorPattern, |
197 kRect_DrawType);) | 197 kRect_DrawType);) |
198 DEF_BENCH(return new AlternatingColorPatternBench(kOpaqueBitmap_ColorPattern, | 198 DEF_BENCH(return new AlternatingColorPatternBench(kOpaqueBitmap_ColorPattern, |
199 kAlphaBitmap_ColorPattern, | 199 kAlphaBitmap_ColorPattern, |
200 kRect_DrawType);) | 200 kRect_DrawType);) |
OLD | NEW |