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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 fBitmap = tmp; | 120 fBitmap = tmp; |
121 } | 121 } |
122 | 122 |
123 SkShader* s = SkShader::CreateBitmapShader(fBitmap, | 123 SkShader* s = SkShader::CreateBitmapShader(fBitmap, |
124 SkShader::kRepeat_TileMode, | 124 SkShader::kRepeat_TileMode, |
125 SkShader::kRepeat_TileMode); | 125 SkShader::kRepeat_TileMode); |
126 fPaint.setShader(s)->unref(); | 126 fPaint.setShader(s)->unref(); |
127 } | 127 } |
128 | 128 |
129 | 129 |
130 void onDraw(const int loops, SkCanvas* canvas) override { | 130 void onDraw(int loops, SkCanvas* canvas) override { |
131 SkPaint paint(fPaint); | 131 SkPaint paint(fPaint); |
132 this->setupPaint(&paint); | 132 this->setupPaint(&paint); |
133 | 133 |
134 for (int i = 0; i < loops; i++) { | 134 for (int i = 0; i < loops; i++) { |
135 canvas->drawPaint(paint); | 135 canvas->drawPaint(paint); |
136 } | 136 } |
137 } | 137 } |
138 | 138 |
139 private: | 139 private: |
140 typedef Benchmark INHERITED; | 140 typedef Benchmark INHERITED; |
141 }; | 141 }; |
142 | 142 |
143 DEF_BENCH(return new RepeatTileBench(kN32_SkColorType, kOpaque_SkAlphaType)) | 143 DEF_BENCH(return new RepeatTileBench(kN32_SkColorType, kOpaque_SkAlphaType)) |
144 DEF_BENCH(return new RepeatTileBench(kN32_SkColorType, kPremul_SkAlphaType)) | 144 DEF_BENCH(return new RepeatTileBench(kN32_SkColorType, kPremul_SkAlphaType)) |
145 DEF_BENCH(return new RepeatTileBench(kRGB_565_SkColorType, kOpaque_SkAlphaType)) | 145 DEF_BENCH(return new RepeatTileBench(kRGB_565_SkColorType, kOpaque_SkAlphaType)) |
146 DEF_BENCH(return new RepeatTileBench(kIndex_8_SkColorType, kPremul_SkAlphaType)) | 146 DEF_BENCH(return new RepeatTileBench(kIndex_8_SkColorType, kPremul_SkAlphaType)) |
OLD | NEW |