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

Unified Diff: bench/GradientBench.cpp

Issue 18655012: Added a high-color (50 colors) gradient for each gradient type. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Removed enum type, added name field to GradData struct instead. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/GradientBench.cpp
diff --git a/bench/GradientBench.cpp b/bench/GradientBench.cpp
index 02df14825be6ff81977d41d05b45c9faeb8f143a..b20fc9a65d036f0a4920aabe24f749e84303e845 100644
--- a/bench/GradientBench.cpp
+++ b/bench/GradientBench.cpp
@@ -19,14 +19,25 @@ struct GradData {
int fCount;
const SkColor* fColors;
const SkScalar* fPos;
+ const char* fName;
};
static const SkColor gColors[] = {
SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK,
+ SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK,
+ SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK,
+ SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK,
+ SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK,
+ SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK,
+ SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK,
+ SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK,
+ SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK,
+ SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK, // 10 lines, 50 colors
};
static const GradData gGradData[] = {
- { 2, gColors, NULL },
+ { 2, gColors, NULL, "" },
+ { 50, gColors, NULL, "_hicolor" }, // many color gradient
};
/// Ignores scale
@@ -156,9 +167,11 @@ class GradientBench : public SkBenchmark {
};
public:
GradientBench(void* param, GradType gradType,
+ GradData data = gGradData[0],
SkShader::TileMode tm = SkShader::kClamp_TileMode,
GeomType geomType = kRect_GeomType,
- float scale = 1.0f)
+ float scale = 1.0f
+ )
: INHERITED(param) {
fName.printf("gradient_%s_%s", gGrads[gradType].fName,
tilemodename(tm));
@@ -167,13 +180,15 @@ public:
fName.append(geomtypename(geomType));
}
+ fName.append(data.fName);
+
const SkPoint pts[2] = {
{ 0, 0 },
{ SkIntToScalar(W), SkIntToScalar(H) }
};
fCount = SkBENCHLOOP(N * gGrads[gradType].fRepeat);
- fShader = gGrads[gradType].fMaker(pts, gGradData[0], tm, NULL, scale);
+ fShader = gGrads[gradType].fMaker(pts, data, tm, NULL, scale);
fGeomType = geomType;
}
@@ -256,21 +271,25 @@ private:
};
DEF_BENCH( return new GradientBench(p, kLinear_GradType); )
-DEF_BENCH( return new GradientBench(p, kLinear_GradType, SkShader::kMirror_TileMode); )
+DEF_BENCH( return new GradientBench(p, kLinear_GradType, gGradData[1]); )
+DEF_BENCH( return new GradientBench(p, kLinear_GradType, gGradData[0], SkShader::kMirror_TileMode); )
// Draw a radial gradient of radius 1/2 on a rectangle; half the lines should
// be completely pinned, the other half should pe partially pinned
-DEF_BENCH( return new GradientBench(p, kRadial_GradType, SkShader::kClamp_TileMode, kRect_GeomType, 0.5f); )
+DEF_BENCH( return new GradientBench(p, kRadial_GradType, gGradData[0], SkShader::kClamp_TileMode, kRect_GeomType, 0.5f); )
// Draw a radial gradient on a circle of equal size; all the lines should
// hit the unpinned fast path (so long as GradientBench.W == H)
-DEF_BENCH( return new GradientBench(p, kRadial_GradType, SkShader::kClamp_TileMode, kOval_GeomType); )
+DEF_BENCH( return new GradientBench(p, kRadial_GradType, gGradData[0], SkShader::kClamp_TileMode, kOval_GeomType); )
-DEF_BENCH( return new GradientBench(p, kRadial_GradType, SkShader::kMirror_TileMode); )
+DEF_BENCH( return new GradientBench(p, kRadial_GradType, gGradData[0], SkShader::kMirror_TileMode); )
DEF_BENCH( return new GradientBench(p, kSweep_GradType); )
+DEF_BENCH( return new GradientBench(p, kSweep_GradType, gGradData[1]); )
DEF_BENCH( return new GradientBench(p, kRadial2_GradType); )
-DEF_BENCH( return new GradientBench(p, kRadial2_GradType, SkShader::kMirror_TileMode); )
+DEF_BENCH( return new GradientBench(p, kRadial2_GradType, gGradData[1]); )
+DEF_BENCH( return new GradientBench(p, kRadial2_GradType, gGradData[0], SkShader::kMirror_TileMode); )
DEF_BENCH( return new GradientBench(p, kConical_GradType); )
+DEF_BENCH( return new GradientBench(p, kConical_GradType, gGradData[1]); )
DEF_BENCH( return new Gradient2Bench(p, false); )
DEF_BENCH( return new Gradient2Bench(p, true); )
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698