OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 <memory> | 8 #include <memory> |
9 #include "SkColor.h" | 9 #include "SkColor.h" |
10 #include "SkLinearBitmapPipeline.h" | 10 #include "SkLinearBitmapPipeline.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 : CommonBitmapFPBenchmark(srcSize, colorProfile, m, useBilerp, xTile
, yTile) { } | 166 : CommonBitmapFPBenchmark(srcSize, colorProfile, m, useBilerp, xTile
, yTile) { } |
167 | 167 |
168 SkString BaseName() override { | 168 SkString BaseName() override { |
169 SkString name{"Orig"}; | 169 SkString name{"Orig"}; |
170 return name; | 170 return name; |
171 } | 171 } |
172 | 172 |
173 void onPreDraw(SkCanvas* c) override { | 173 void onPreDraw(SkCanvas* c) override { |
174 CommonBitmapFPBenchmark::onPreDraw(c); | 174 CommonBitmapFPBenchmark::onPreDraw(c); |
175 | 175 |
176 SkImage* image = SkImage::NewRasterCopy( | 176 fImage = SkImage::MakeRasterCopy( |
177 fInfo, fBitmap.get(), sizeof(SkPMColor) * fSrcSize.fWidth); | 177 SkPixmap(fInfo, fBitmap.get(), sizeof(SkPMColor) * fSrcSize.fWidth))
; |
178 fImage.reset(image); | |
179 fPaint.setShader(fImage->makeShader(fXTile, fYTile)); | 178 fPaint.setShader(fImage->makeShader(fXTile, fYTile)); |
180 if (fUseBilerp) { | 179 if (fUseBilerp) { |
181 fPaint.setFilterQuality(SkFilterQuality::kLow_SkFilterQuality); | 180 fPaint.setFilterQuality(SkFilterQuality::kLow_SkFilterQuality); |
182 } else { | 181 } else { |
183 fPaint.setFilterQuality(SkFilterQuality::kNone_SkFilterQuality); | 182 fPaint.setFilterQuality(SkFilterQuality::kNone_SkFilterQuality); |
184 } | 183 } |
185 } | 184 } |
186 | 185 |
187 void onPostDraw(SkCanvas*) override { | 186 void onPostDraw(SkCanvas*) override { |
188 | 187 |
(...skipping 13 matching lines...) Expand all Loading... |
202 | 201 |
203 int count = 100; | 202 int count = 100; |
204 | 203 |
205 for (int n = 0; n < 1000*loops; n++) { | 204 for (int n = 0; n < 1000*loops; n++) { |
206 ctx->shadeSpan(3, 6, buffer4b, count); | 205 ctx->shadeSpan(3, 6, buffer4b, count); |
207 } | 206 } |
208 | 207 |
209 ctx->~Context(); | 208 ctx->~Context(); |
210 } | 209 } |
211 SkPaint fPaint; | 210 SkPaint fPaint; |
212 SkAutoTUnref<SkImage> fImage; | 211 sk_sp<SkImage> fImage; |
213 }; | 212 }; |
214 | 213 |
215 static SkISize srcSize = SkISize::Make(120, 100); | 214 static SkISize srcSize = SkISize::Make(120, 100); |
216 static SkMatrix mI = SkMatrix::I(); | 215 static SkMatrix mI = SkMatrix::I(); |
217 DEF_BENCH(return new SkBitmapFPGeneral( | 216 DEF_BENCH(return new SkBitmapFPGeneral( |
218 srcSize, kSRGB_SkColorProfileType, mI, false, | 217 srcSize, kSRGB_SkColorProfileType, mI, false, |
219 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) | 218 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) |
220 | 219 |
221 DEF_BENCH(return new SkBitmapFPGeneral( | 220 DEF_BENCH(return new SkBitmapFPGeneral( |
222 srcSize, kLinear_SkColorProfileType, mI, false, | 221 srcSize, kLinear_SkColorProfileType, mI, false, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) | 286 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) |
288 | 287 |
289 DEF_BENCH(return new SkBitmapFPGeneral( | 288 DEF_BENCH(return new SkBitmapFPGeneral( |
290 srcSize, kLinear_SkColorProfileType, mR, true, | 289 srcSize, kLinear_SkColorProfileType, mR, true, |
291 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) | 290 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) |
292 | 291 |
293 DEF_BENCH(return new SkBitmapFPOrigShader( | 292 DEF_BENCH(return new SkBitmapFPOrigShader( |
294 srcSize, kLinear_SkColorProfileType, mR, true, | 293 srcSize, kLinear_SkColorProfileType, mR, true, |
295 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) | 294 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) |
296 | 295 |
OLD | NEW |