| 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 "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // want fractional translate | 80 // want fractional translate |
| 81 fDstR.offset(SK_Scalar1 / 3, SK_Scalar1 * 5 / 7); | 81 fDstR.offset(SK_Scalar1 / 3, SK_Scalar1 * 5 / 7); |
| 82 // want enough to create a scale matrix, but not enough to scare | 82 // want enough to create a scale matrix, but not enough to scare |
| 83 // off our sniffer which tries to see if the matrix is "effectively" | 83 // off our sniffer which tries to see if the matrix is "effectively" |
| 84 // translate-only. | 84 // translate-only. |
| 85 fDstR.fRight += SK_Scalar1 / (kWidth * 60); | 85 fDstR.fRight += SK_Scalar1 / (kWidth * 60); |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 | 88 |
| 89 | 89 |
| 90 void onDraw(const int loops, SkCanvas* canvas) override { | 90 void onDraw(int loops, SkCanvas* canvas) override { |
| 91 SkRandom rand; | 91 SkRandom rand; |
| 92 | 92 |
| 93 SkPaint paint; | 93 SkPaint paint; |
| 94 this->setupPaint(&paint); | 94 this->setupPaint(&paint); |
| 95 paint.setFilterQuality(fFilterQuality); | 95 paint.setFilterQuality(fFilterQuality); |
| 96 paint.setAlpha(fAlpha); | 96 paint.setAlpha(fAlpha); |
| 97 | 97 |
| 98 for (int i = 0; i < loops; i++) { | 98 for (int i = 0; i < loops; i++) { |
| 99 canvas->drawBitmapRect(fBitmap, fSrcR, fDstR, &paint, | 99 canvas->drawBitmapRect(fBitmap, fSrcR, fDstR, &paint, |
| 100 SkCanvas::kStrict_SrcRectConstraint); | 100 SkCanvas::kStrict_SrcRectConstraint); |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 | 103 |
| 104 private: | 104 private: |
| 105 typedef Benchmark INHERITED; | 105 typedef Benchmark INHERITED; |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 DEF_BENCH(return new BitmapRectBench(0xFF, kNone_SkFilterQuality, false)) | 108 DEF_BENCH(return new BitmapRectBench(0xFF, kNone_SkFilterQuality, false)) |
| 109 DEF_BENCH(return new BitmapRectBench(0x80, kNone_SkFilterQuality, false)) | 109 DEF_BENCH(return new BitmapRectBench(0x80, kNone_SkFilterQuality, false)) |
| 110 DEF_BENCH(return new BitmapRectBench(0xFF, kLow_SkFilterQuality, false)) | 110 DEF_BENCH(return new BitmapRectBench(0xFF, kLow_SkFilterQuality, false)) |
| 111 DEF_BENCH(return new BitmapRectBench(0x80, kLow_SkFilterQuality, false)) | 111 DEF_BENCH(return new BitmapRectBench(0x80, kLow_SkFilterQuality, false)) |
| 112 | 112 |
| 113 DEF_BENCH(return new BitmapRectBench(0xFF, kNone_SkFilterQuality, true)) | 113 DEF_BENCH(return new BitmapRectBench(0xFF, kNone_SkFilterQuality, true)) |
| 114 DEF_BENCH(return new BitmapRectBench(0xFF, kLow_SkFilterQuality, true)) | 114 DEF_BENCH(return new BitmapRectBench(0xFF, kLow_SkFilterQuality, true)) |
| OLD | NEW |