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

Side by Side Diff: bench/SkLinearBitmapPipelineBench.cpp

Issue 1871173002: Add constant for blitter context size. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add constants. Created 4 years, 8 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"
11 #include "SkBitmapProcShader.h"
11 #include "SkPM4f.h" 12 #include "SkPM4f.h"
12 #include "Benchmark.h" 13 #include "Benchmark.h"
13 #include "SkShader.h" 14 #include "SkShader.h"
14 #include "SkImage.h" 15 #include "SkImage.h"
15 16
16 struct CommonBitmapFPBenchmark : public Benchmark { 17 struct CommonBitmapFPBenchmark : public Benchmark {
17 CommonBitmapFPBenchmark( 18 CommonBitmapFPBenchmark(
18 SkISize srcSize, 19 SkISize srcSize,
19 SkColorProfileType colorProfile, 20 SkColorProfileType colorProfile,
20 SkMatrix m, 21 SkMatrix m,
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 void onPostDraw(SkCanvas*) override { 187 void onPostDraw(SkCanvas*) override {
187 188
188 } 189 }
189 190
190 void onDraw(int loops, SkCanvas*) override { 191 void onDraw(int loops, SkCanvas*) override {
191 int width = fSrcSize.fWidth; 192 int width = fSrcSize.fWidth;
192 int height = fSrcSize.fHeight; 193 int height = fSrcSize.fHeight;
193 194
194 SkAutoTMalloc<SkPMColor> buffer4b(width*height); 195 SkAutoTMalloc<SkPMColor> buffer4b(width*height);
195 196
196 uint32_t storage[300]; 197 uint32_t storage[kSkBlitterContextSize];
197 const SkShader::ContextRec rec(fPaint, fM, nullptr, 198 const SkShader::ContextRec rec(fPaint, fM, nullptr,
198 SkShader::ContextRec::kPMColor_DstType); 199 SkShader::ContextRec::kPMColor_DstType);
199 SkASSERT(fPaint.getShader()->contextSize(rec) <= sizeof(storage)); 200 SkASSERT(fPaint.getShader()->contextSize(rec) <= sizeof(storage));
200 SkShader::Context* ctx = fPaint.getShader()->createContext(rec, storage) ; 201 SkShader::Context* ctx = fPaint.getShader()->createContext(rec, storage) ;
201 202
202 int count = 100; 203 int count = 100;
203 204
204 for (int n = 0; n < 1000*loops; n++) { 205 for (int n = 0; n < 1000*loops; n++) {
205 ctx->shadeSpan(3, 6, buffer4b, count); 206 ctx->shadeSpan(3, 6, buffer4b, count);
206 } 207 }
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 srcSize, kSRGB_SkColorProfileType, mR, true, 336 srcSize, kSRGB_SkColorProfileType, mR, true,
336 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) 337 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);)
337 338
338 DEF_BENCH(return new SkBitmapFPGeneral( 339 DEF_BENCH(return new SkBitmapFPGeneral(
339 srcSize, kLinear_SkColorProfileType, mR, true, 340 srcSize, kLinear_SkColorProfileType, mR, true,
340 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) 341 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);)
341 342
342 DEF_BENCH(return new SkBitmapFPOrigShader( 343 DEF_BENCH(return new SkBitmapFPOrigShader(
343 srcSize, kLinear_SkColorProfileType, mR, true, 344 srcSize, kLinear_SkColorProfileType, mR, true,
344 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) 345 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);)
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