Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Side by Side Diff: bench/SkLinearBitmapPipelineBench.cpp

Issue 1785473002: SkImage now has makeShader to return sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use build guard for impl of newShader Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | gm/SkLinearBitmapPipelineGM.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 SkImage* image = SkImage::NewRasterCopy(
177 fInfo, fBitmap.get(), sizeof(SkPMColor) * fSrcSize.fWidth); 177 fInfo, fBitmap.get(), sizeof(SkPMColor) * fSrcSize.fWidth);
178 fImage.reset(image); 178 fImage.reset(image);
179 SkShader* shader = fImage->newShader(fXTile, fYTile); 179 fPaint.setShader(fImage->makeShader(fXTile, fYTile));
180 if (fUseBilerp) { 180 if (fUseBilerp) {
181 fPaint.setFilterQuality(SkFilterQuality::kLow_SkFilterQuality); 181 fPaint.setFilterQuality(SkFilterQuality::kLow_SkFilterQuality);
182 } else { 182 } else {
183 fPaint.setFilterQuality(SkFilterQuality::kNone_SkFilterQuality); 183 fPaint.setFilterQuality(SkFilterQuality::kNone_SkFilterQuality);
184 } 184 }
185 fPaint.setShader(shader)->unref();
186 } 185 }
187 186
188 void onPostDraw(SkCanvas*) override { 187 void onPostDraw(SkCanvas*) override {
189 188
190 } 189 }
191 190
192 void onDraw(int loops, SkCanvas*) override { 191 void onDraw(int loops, SkCanvas*) override {
193 int width = fSrcSize.fWidth; 192 int width = fSrcSize.fWidth;
194 int height = fSrcSize.fHeight; 193 int height = fSrcSize.fHeight;
195 194
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) 287 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);)
289 288
290 DEF_BENCH(return new SkBitmapFPGeneral( 289 DEF_BENCH(return new SkBitmapFPGeneral(
291 srcSize, kLinear_SkColorProfileType, mR, true, 290 srcSize, kLinear_SkColorProfileType, mR, true,
292 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) 291 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);)
293 292
294 DEF_BENCH(return new SkBitmapFPOrigShader( 293 DEF_BENCH(return new SkBitmapFPOrigShader(
295 srcSize, kLinear_SkColorProfileType, mR, true, 294 srcSize, kLinear_SkColorProfileType, mR, true,
296 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) 295 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);)
297 296
OLDNEW
« no previous file with comments | « no previous file | gm/SkLinearBitmapPipelineGM.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698