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

Side by Side Diff: bench/GradientBench.cpp

Issue 18259012: Gradient Fixes (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fixed name of GM:gradient_dirty_laundry Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | gm/gradientDirtyLaundry.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 /* 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 "SkBenchmark.h" 8 #include "SkBenchmark.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
11 #include "SkColorPriv.h" 11 #include "SkColorPriv.h"
12 #include "SkGradientShader.h" 12 #include "SkGradientShader.h"
13 #include "SkPaint.h" 13 #include "SkPaint.h"
14 #include "SkShader.h" 14 #include "SkShader.h"
15 #include "SkString.h" 15 #include "SkString.h"
16 #include "SkUnitMapper.h" 16 #include "SkUnitMapper.h"
17 17
18 struct GradData { 18 struct GradData {
19 int fCount; 19 int fCount;
20 const SkColor* fColors; 20 const SkColor* fColors;
21 const SkScalar* fPos; 21 const SkScalar* fPos;
22 }; 22 };
23 23
24 static const SkColor gColors[] = { 24 static const SkColor gColors[] = {
25 SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK 25 SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK,
26 };
27 static const SkScalar gPos0[] = { 0, SK_Scalar1 };
28 static const SkScalar gPos1[] = { SK_Scalar1/4, SK_Scalar1*3/4 };
29 static const SkScalar gPos2[] = {
30 0, SK_Scalar1/8, SK_Scalar1/2, SK_Scalar1*7/8, SK_Scalar1
31 }; 26 };
32 27
33 static const GradData gGradData[] = { 28 static const GradData gGradData[] = {
34 { 2, gColors, NULL }, 29 { 2, gColors, NULL },
35 { 2, gColors, gPos0 },
36 { 2, gColors, gPos1 },
37 { 5, gColors, NULL },
38 { 5, gColors, gPos2 }
39 }; 30 };
40 31
41 /// Ignores scale 32 /// Ignores scale
42 static SkShader* MakeLinear(const SkPoint pts[2], const GradData& data, 33 static SkShader* MakeLinear(const SkPoint pts[2], const GradData& data,
43 SkShader::TileMode tm, SkUnitMapper* mapper, 34 SkShader::TileMode tm, SkUnitMapper* mapper,
44 float scale) { 35 float scale) {
45 return SkGradientShader::CreateLinear(pts, data.fColors, data.fPos, 36 return SkGradientShader::CreateLinear(pts, data.fColors, data.fPos,
46 data.fCount, tm, mapper); 37 data.fCount, tm, mapper);
47 } 38 }
48 39
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 DEF_BENCH( return new GradientBench(p, kRadial_GradType, SkShader::kClamp_TileMo de, kOval_GeomType); ) 267 DEF_BENCH( return new GradientBench(p, kRadial_GradType, SkShader::kClamp_TileMo de, kOval_GeomType); )
277 268
278 DEF_BENCH( return new GradientBench(p, kRadial_GradType, SkShader::kMirror_TileM ode); ) 269 DEF_BENCH( return new GradientBench(p, kRadial_GradType, SkShader::kMirror_TileM ode); )
279 DEF_BENCH( return new GradientBench(p, kSweep_GradType); ) 270 DEF_BENCH( return new GradientBench(p, kSweep_GradType); )
280 DEF_BENCH( return new GradientBench(p, kRadial2_GradType); ) 271 DEF_BENCH( return new GradientBench(p, kRadial2_GradType); )
281 DEF_BENCH( return new GradientBench(p, kRadial2_GradType, SkShader::kMirror_Tile Mode); ) 272 DEF_BENCH( return new GradientBench(p, kRadial2_GradType, SkShader::kMirror_Tile Mode); )
282 DEF_BENCH( return new GradientBench(p, kConical_GradType); ) 273 DEF_BENCH( return new GradientBench(p, kConical_GradType); )
283 274
284 DEF_BENCH( return new Gradient2Bench(p, false); ) 275 DEF_BENCH( return new Gradient2Bench(p, false); )
285 DEF_BENCH( return new Gradient2Bench(p, true); ) 276 DEF_BENCH( return new Gradient2Bench(p, true); )
OLDNEW
« no previous file with comments | « no previous file | gm/gradientDirtyLaundry.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698