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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 void onDraw(const int loops, SkCanvas* canvas) override { | 90 void onDraw(const 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->drawBitmapRectToRect(fBitmap, &fSrcR, fDstR, &paint); | 99 canvas->drawBitmapRect(fBitmap, &fSrcR, fDstR, &paint, |
| 100 SkCanvas::kStrict_SrcRectConstraint); |
100 } | 101 } |
101 } | 102 } |
102 | 103 |
103 private: | 104 private: |
104 typedef Benchmark INHERITED; | 105 typedef Benchmark INHERITED; |
105 }; | 106 }; |
106 | 107 |
107 DEF_BENCH(return new BitmapRectBench(0xFF, kNone_SkFilterQuality, false)) | 108 DEF_BENCH(return new BitmapRectBench(0xFF, kNone_SkFilterQuality, false)) |
108 DEF_BENCH(return new BitmapRectBench(0x80, kNone_SkFilterQuality, false)) | 109 DEF_BENCH(return new BitmapRectBench(0x80, kNone_SkFilterQuality, false)) |
109 DEF_BENCH(return new BitmapRectBench(0xFF, kLow_SkFilterQuality, false)) | 110 DEF_BENCH(return new BitmapRectBench(0xFF, kLow_SkFilterQuality, false)) |
110 DEF_BENCH(return new BitmapRectBench(0x80, kLow_SkFilterQuality, false)) | 111 DEF_BENCH(return new BitmapRectBench(0x80, kLow_SkFilterQuality, false)) |
111 | 112 |
112 DEF_BENCH(return new BitmapRectBench(0xFF, kNone_SkFilterQuality, true)) | 113 DEF_BENCH(return new BitmapRectBench(0xFF, kNone_SkFilterQuality, true)) |
113 DEF_BENCH(return new BitmapRectBench(0xFF, kLow_SkFilterQuality, true)) | 114 DEF_BENCH(return new BitmapRectBench(0xFF, kLow_SkFilterQuality, true)) |
OLD | NEW |