| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 124 |
| 125 if (kIndex_8_SkColorType == fColorType) { | 125 if (kIndex_8_SkColorType == fColorType) { |
| 126 convertToIndex666(bm, &fBitmap, fAlphaType); | 126 convertToIndex666(bm, &fBitmap, fAlphaType); |
| 127 } else { | 127 } else { |
| 128 fBitmap = bm; | 128 fBitmap = bm; |
| 129 } | 129 } |
| 130 | 130 |
| 131 fBitmap.setIsVolatile(fIsVolatile); | 131 fBitmap.setIsVolatile(fIsVolatile); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void onDraw(const int loops, SkCanvas* canvas) override { | 134 void onDraw(int loops, SkCanvas* canvas) override { |
| 135 if (fDoScale) { | 135 if (fDoScale) { |
| 136 canvas->scale(.99f, .99f); | 136 canvas->scale(.99f, .99f); |
| 137 } | 137 } |
| 138 SkIPoint dim = this->getSize(); | 138 SkIPoint dim = this->getSize(); |
| 139 SkRandom rand; | 139 SkRandom rand; |
| 140 | 140 |
| 141 SkPaint paint(fPaint); | 141 SkPaint paint(fPaint); |
| 142 this->setupPaint(&paint); | 142 this->setupPaint(&paint); |
| 143 | 143 |
| 144 const SkBitmap& bitmap = fBitmap; | 144 const SkBitmap& bitmap = fBitmap; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 } | 218 } |
| 219 if (isBilerp(fFlags)) { | 219 if (isBilerp(fFlags)) { |
| 220 fFullName.append("_bilerp"); | 220 fFullName.append("_bilerp"); |
| 221 } else if (isBicubic(fFlags)) { | 221 } else if (isBicubic(fFlags)) { |
| 222 fFullName.append("_bicubic"); | 222 fFullName.append("_bicubic"); |
| 223 } | 223 } |
| 224 | 224 |
| 225 return fFullName.c_str(); | 225 return fFullName.c_str(); |
| 226 } | 226 } |
| 227 | 227 |
| 228 void onDraw(const int loops, SkCanvas* canvas) override { | 228 void onDraw(int loops, SkCanvas* canvas) override { |
| 229 SkISize dim = canvas->getDeviceSize(); | 229 SkISize dim = canvas->getDeviceSize(); |
| 230 if (fFlags & kScale_Flag) { | 230 if (fFlags & kScale_Flag) { |
| 231 const SkScalar x = SkIntToScalar(dim.fWidth) / 2; | 231 const SkScalar x = SkIntToScalar(dim.fWidth) / 2; |
| 232 const SkScalar y = SkIntToScalar(dim.fHeight) / 2; | 232 const SkScalar y = SkIntToScalar(dim.fHeight) / 2; |
| 233 | 233 |
| 234 canvas->translate(x, y); | 234 canvas->translate(x, y); |
| 235 // just enough so we can't take the sprite case | 235 // just enough so we can't take the sprite case |
| 236 canvas->scale(SK_Scalar1 * 99/100, SK_Scalar1 * 99/100); | 236 canvas->scale(SK_Scalar1 * 99/100, SK_Scalar1 * 99/100); |
| 237 canvas->translate(-x, -y); | 237 canvas->translate(-x, -y); |
| 238 } | 238 } |
| (...skipping 142 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 |