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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 fShaders[count] = fPattern2.fIsBitmap ? fBmShader : NULL; | 142 fShaders[count] = fPattern2.fIsBitmap ? fBmShader : NULL; |
143 } | 143 } |
144 ++count; | 144 ++count; |
145 } | 145 } |
146 } | 146 } |
147 } | 147 } |
148 | 148 |
149 void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { | 149 void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { |
150 SkPaint paint; | 150 SkPaint paint; |
151 paint.setAntiAlias(false); | 151 paint.setAntiAlias(false); |
152 paint.setFilterLevel(SkPaint::kLow_FilterLevel); | 152 paint.setFilterQuality(kLow_SkFilterQuality); |
153 | 153 |
154 for (int i = 0; i < loops; ++i) { | 154 for (int i = 0; i < loops; ++i) { |
155 for (int j = 0; j < NUM_DRAWS; ++j) { | 155 for (int j = 0; j < NUM_DRAWS; ++j) { |
156 paint.setColor(fColors[j]); | 156 paint.setColor(fColors[j]); |
157 paint.setShader(fShaders[j]); | 157 paint.setShader(fShaders[j]); |
158 if (kRect_DrawType == fDrawType) { | 158 if (kRect_DrawType == fDrawType) { |
159 canvas->drawRect(fRects[j], paint); | 159 canvas->drawRect(fRects[j], paint); |
160 } else { | 160 } else { |
161 canvas->drawPath(fPaths[j], paint); | 161 canvas->drawPath(fPaths[j], paint); |
162 } | 162 } |
(...skipping 28 matching lines...) Expand all Loading... |
191 DEF_BENCH( return SkNEW_ARGS(AlternatingColorPatternBench, | 191 DEF_BENCH( return SkNEW_ARGS(AlternatingColorPatternBench, |
192 (kOpaqueBitmap_ColorPattern, kOpaqueBitmap_ColorPat
tern, | 192 (kOpaqueBitmap_ColorPattern, kOpaqueBitmap_ColorPat
tern, |
193 kRect_DrawType)); ) | 193 kRect_DrawType)); ) |
194 DEF_BENCH( return SkNEW_ARGS(AlternatingColorPatternBench, | 194 DEF_BENCH( return SkNEW_ARGS(AlternatingColorPatternBench, |
195 (kAlphaBitmap_ColorPattern, kAlphaBitmap_ColorPatte
rn, | 195 (kAlphaBitmap_ColorPattern, kAlphaBitmap_ColorPatte
rn, |
196 kRect_DrawType)); ) | 196 kRect_DrawType)); ) |
197 DEF_BENCH( return SkNEW_ARGS(AlternatingColorPatternBench, | 197 DEF_BENCH( return SkNEW_ARGS(AlternatingColorPatternBench, |
198 (kOpaqueBitmap_ColorPattern, kAlphaBitmap_ColorPatt
ern, | 198 (kOpaqueBitmap_ColorPattern, kAlphaBitmap_ColorPatt
ern, |
199 kRect_DrawType)); ) | 199 kRect_DrawType)); ) |
200 | 200 |
OLD | NEW |