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 "Benchmark.h" | 8 #include "Benchmark.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkCommandLineFlags.h" | 10 #include "SkCommandLineFlags.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 SkRandom rand; | 231 SkRandom rand; |
232 SkColor color = 0xFF000000; | 232 SkColor color = 0xFF000000; |
233 U8CPU alpha = 0xFF; | 233 U8CPU alpha = 0xFF; |
234 SkPaint paint; | 234 SkPaint paint; |
235 paint.setStrokeCap(SkPaint::kRound_Cap); | 235 paint.setStrokeCap(SkPaint::kRound_Cap); |
236 if (_type == KMaskShader) { | 236 if (_type == KMaskShader) { |
237 SkBitmap srcBM; | 237 SkBitmap srcBM; |
238 srcBM.allocN32Pixels(10, 1); | 238 srcBM.allocN32Pixels(10, 1); |
239 srcBM.eraseColor(0xFF00FF00); | 239 srcBM.eraseColor(0xFF00FF00); |
240 | 240 |
241 paint.setShader(SkShader::MakeBitmapShader(srcBM, SkShader::kClamp_T
ileMode, | 241 SkShader* s; |
242 SkShader::kClamp_TileMode
)); | 242 s = SkShader::CreateBitmapShader(srcBM, SkShader::kClamp_TileMode, |
| 243 SkShader::kClamp_TileMode); |
| 244 paint.setShader(s)->unref(); |
243 } | 245 } |
244 for (int loop = 0; loop < loops; loop++) { | 246 for (int loop = 0; loop < loops; loop++) { |
245 for (size_t i = 0; i < sizes; i++) { | 247 for (size_t i = 0; i < sizes; i++) { |
246 switch (_type) { | 248 switch (_type) { |
247 case kMaskOpaque: | 249 case kMaskOpaque: |
248 color = fColors[i]; | 250 color = fColors[i]; |
249 alpha = 0xFF; | 251 alpha = 0xFF; |
250 break; | 252 break; |
251 case kMaskBlack: | 253 case kMaskBlack: |
252 alpha = 0xFF; | 254 alpha = 0xFF; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 "maskopaque");) | 302 "maskopaque");) |
301 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, | 303 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, |
302 BlitMaskBench::kMaskBlack, | 304 BlitMaskBench::kMaskBlack, |
303 "maskblack");) | 305 "maskblack");) |
304 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, | 306 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, |
305 BlitMaskBench::kMaskColor, | 307 BlitMaskBench::kMaskColor, |
306 "maskcolor");) | 308 "maskcolor");) |
307 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, | 309 DEF_BENCH(return new BlitMaskBench(SkCanvas::kPoints_PointMode, |
308 BlitMaskBench::KMaskShader, | 310 BlitMaskBench::KMaskShader, |
309 "maskshader");) | 311 "maskshader");) |
OLD | NEW |