OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 const SkScalar x = SkIntToScalar(dim.fWidth) / 2; | 240 const SkScalar x = SkIntToScalar(dim.fWidth) / 2; |
241 const SkScalar y = SkIntToScalar(dim.fHeight) / 2; | 241 const SkScalar y = SkIntToScalar(dim.fHeight) / 2; |
242 | 242 |
243 canvas->translate(x, y); | 243 canvas->translate(x, y); |
244 canvas->rotate(SkIntToScalar(35)); | 244 canvas->rotate(SkIntToScalar(35)); |
245 canvas->translate(-x, -y); | 245 canvas->translate(-x, -y); |
246 } | 246 } |
247 INHERITED::onDraw(loops, canvas); | 247 INHERITED::onDraw(loops, canvas); |
248 } | 248 } |
249 | 249 |
250 virtual void setupPaint(SkPaint* paint) SK_OVERRIDE { | 250 void setupPaint(SkPaint* paint) SK_OVERRIDE { |
251 this->INHERITED::setupPaint(paint); | 251 this->INHERITED::setupPaint(paint); |
252 | 252 |
253 int index = 0; | 253 int index = 0; |
254 if (fFlags & kBilerp_Flag) { | 254 if (fFlags & kBilerp_Flag) { |
255 index |= 1; | 255 index |= 1; |
256 } | 256 } |
257 if (fFlags & kBicubic_Flag) { | 257 if (fFlags & kBicubic_Flag) { |
258 index |= 2; | 258 index |= 2; |
259 } | 259 } |
260 static const SkPaint::FilterLevel gLevels[] = { | 260 static const SkPaint::FilterLevel gLevels[] = { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 fFullName.append("_source_transparent"); | 296 fFullName.append("_source_transparent"); |
297 } else if (fSourceAlpha == kTwoStripes_SourceAlpha) { | 297 } else if (fSourceAlpha == kTwoStripes_SourceAlpha) { |
298 fFullName.append("_source_stripes_two"); | 298 fFullName.append("_source_stripes_two"); |
299 } else if (fSourceAlpha == kThreeStripes_SourceAlpha) { | 299 } else if (fSourceAlpha == kThreeStripes_SourceAlpha) { |
300 fFullName.append("_source_stripes_three"); | 300 fFullName.append("_source_stripes_three"); |
301 } | 301 } |
302 | 302 |
303 return fFullName.c_str(); | 303 return fFullName.c_str(); |
304 } | 304 } |
305 | 305 |
306 virtual void onDrawIntoBitmap(const SkBitmap& bm) SK_OVERRIDE { | 306 void onDrawIntoBitmap(const SkBitmap& bm) SK_OVERRIDE { |
307 const int w = bm.width(); | 307 const int w = bm.width(); |
308 const int h = bm.height(); | 308 const int h = bm.height(); |
309 | 309 |
310 if (kOpaque_SourceAlpha == fSourceAlpha) { | 310 if (kOpaque_SourceAlpha == fSourceAlpha) { |
311 bm.eraseColor(SK_ColorBLACK); | 311 bm.eraseColor(SK_ColorBLACK); |
312 } else if (kTransparent_SourceAlpha == fSourceAlpha) { | 312 } else if (kTransparent_SourceAlpha == fSourceAlpha) { |
313 bm.eraseColor(0); | 313 bm.eraseColor(0); |
314 } else if (kTwoStripes_SourceAlpha == fSourceAlpha) { | 314 } else if (kTwoStripes_SourceAlpha == fSourceAlpha) { |
315 bm.eraseColor(0); | 315 bm.eraseColor(0); |
316 | 316 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 DEF_BENCH( return new FilterBitmapBench(kN32_SkColorType, kOpaque_SkAlphaType, t
rue, false, kScale_Flag | kRotate_Flag | kBilerp_Flag); ) | 381 DEF_BENCH( return new FilterBitmapBench(kN32_SkColorType, kOpaque_SkAlphaType, t
rue, false, kScale_Flag | kRotate_Flag | kBilerp_Flag); ) |
382 | 382 |
383 DEF_BENCH( return new FilterBitmapBench(kN32_SkColorType, kPremul_SkAlphaType, f
alse, false, kScale_Flag | kBilerp_Flag | kBicubic_Flag); ) | 383 DEF_BENCH( return new FilterBitmapBench(kN32_SkColorType, kPremul_SkAlphaType, f
alse, false, kScale_Flag | kBilerp_Flag | kBicubic_Flag); ) |
384 DEF_BENCH( return new FilterBitmapBench(kN32_SkColorType, kPremul_SkAlphaType, f
alse, false, kScale_Flag | kRotate_Flag | kBilerp_Flag | kBicubic_Flag); ) | 384 DEF_BENCH( return new FilterBitmapBench(kN32_SkColorType, kPremul_SkAlphaType, f
alse, false, kScale_Flag | kRotate_Flag | kBilerp_Flag | kBicubic_Flag); ) |
385 | 385 |
386 // source alpha tests -> S32A_Opaque_BlitRow32_{arm,neon} | 386 // source alpha tests -> S32A_Opaque_BlitRow32_{arm,neon} |
387 DEF_BENCH( return new SourceAlphaBitmapBench(SourceAlphaBitmapBench::kOpaque_Sou
rceAlpha, kN32_SkColorType); ) | 387 DEF_BENCH( return new SourceAlphaBitmapBench(SourceAlphaBitmapBench::kOpaque_Sou
rceAlpha, kN32_SkColorType); ) |
388 DEF_BENCH( return new SourceAlphaBitmapBench(SourceAlphaBitmapBench::kTransparen
t_SourceAlpha, kN32_SkColorType); ) | 388 DEF_BENCH( return new SourceAlphaBitmapBench(SourceAlphaBitmapBench::kTransparen
t_SourceAlpha, kN32_SkColorType); ) |
389 DEF_BENCH( return new SourceAlphaBitmapBench(SourceAlphaBitmapBench::kTwoStripes
_SourceAlpha, kN32_SkColorType); ) | 389 DEF_BENCH( return new SourceAlphaBitmapBench(SourceAlphaBitmapBench::kTwoStripes
_SourceAlpha, kN32_SkColorType); ) |
390 DEF_BENCH( return new SourceAlphaBitmapBench(SourceAlphaBitmapBench::kThreeStrip
es_SourceAlpha, kN32_SkColorType); ) | 390 DEF_BENCH( return new SourceAlphaBitmapBench(SourceAlphaBitmapBench::kThreeStrip
es_SourceAlpha, kN32_SkColorType); ) |
OLD | NEW |