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

Side by Side Diff: bench/SkLinearBitmapPipelineBench.cpp

Issue 1720933002: Add ContextRec param to SkShader::contextSize() (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: ContextRec plumbing only Created 4 years, 10 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 | experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.h » ('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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 189
190 } 190 }
191 191
192 void onDraw(int loops, SkCanvas*) override { 192 void onDraw(int loops, SkCanvas*) override {
193 int width = fSrcSize.fWidth; 193 int width = fSrcSize.fWidth;
194 int height = fSrcSize.fHeight; 194 int height = fSrcSize.fHeight;
195 195
196 SkAutoTMalloc<SkPMColor> buffer4b(width*height); 196 SkAutoTMalloc<SkPMColor> buffer4b(width*height);
197 197
198 uint32_t storage[200]; 198 uint32_t storage[200];
199 SkASSERT(fPaint.getShader()->contextSize() <= sizeof(storage)); 199 const SkShader::ContextRec rec(fPaint, fM, nullptr);
200 SkShader::Context* ctx = fPaint.getShader()->createContext( 200 SkASSERT(fPaint.getShader()->contextSize(rec) <= sizeof(storage));
201 {fPaint, fM, nullptr}, 201 SkShader::Context* ctx = fPaint.getShader()->createContext(rec, storage) ;
202 storage);
203 202
204 int count = 100; 203 int count = 100;
205 204
206 for (int n = 0; n < 1000*loops; n++) { 205 for (int n = 0; n < 1000*loops; n++) {
207 ctx->shadeSpan(3, 6, buffer4b, count); 206 ctx->shadeSpan(3, 6, buffer4b, count);
208 } 207 }
209 208
210 ctx->~Context(); 209 ctx->~Context();
211 } 210 }
212 SkPaint fPaint; 211 SkPaint fPaint;
(...skipping 75 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 | experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698