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

Unified Diff: bench/GradientBench.cpp

Issue 25294003: Add 3 color variant to gradient bench, include scale in name, add more benchs (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add comment Created 7 years, 3 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 adab4d01f642f0875c8c6d688348b4180f0e42d1..870fecd45bb86eff4c4a24b6ccdbf7a0c9c6e057 100644
--- a/bench/GradientBench.cpp
+++ b/bench/GradientBench.cpp
@@ -35,9 +35,12 @@ static const SkColor gColors[] = {
SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK, // 10 lines, 50 colors
};
+// We have several special-cases depending on the number (and spacing) of colors, so
+// try to exercise those here.
static const GradData gGradData[] = {
{ 2, gColors, NULL, "" },
{ 50, gColors, NULL, "_hicolor" }, // many color gradient
+ { 3, gColors, NULL, "_3color" },
};
/// Ignores scale
@@ -169,9 +172,7 @@ public:
GradData data = gGradData[0],
SkShader::TileMode tm = SkShader::kClamp_TileMode,
GeomType geomType = kRect_GeomType,
- float scale = 1.0f
- )
- {
+ float scale = 1.0f) {
fName.printf("gradient_%s_%s", gGrads[gradType].fName,
tilemodename(tm));
if (geomType != kRect_GeomType) {
@@ -179,6 +180,10 @@ public:
fName.append(geomtypename(geomType));
}
+ if (scale != 1.f) {
+ fName.appendf("_scale_%g", scale);
+ }
+
fName.append(data.fName);
const SkPoint pts[2] = {
@@ -226,8 +231,13 @@ private:
DEF_BENCH( return new GradientBench(kLinear_GradType); )
DEF_BENCH( return new GradientBench(kLinear_GradType, gGradData[1]); )
+DEF_BENCH( return new GradientBench(kLinear_GradType, gGradData[2]); )
DEF_BENCH( return new GradientBench(kLinear_GradType, gGradData[0], SkShader::kMirror_TileMode); )
+
+DEF_BENCH( return new GradientBench(kRadial_GradType, gGradData[0]); )
+DEF_BENCH( return new GradientBench(kRadial_GradType, gGradData[1]); )
+DEF_BENCH( return new GradientBench(kRadial_GradType, gGradData[2]); )
// 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(kRadial_GradType, gGradData[0], SkShader::kClamp_TileMode, kRect_GeomType, 0.5f); )
@@ -239,11 +249,13 @@ DEF_BENCH( return new GradientBench(kRadial_GradType, gGradData[0], SkShader::kC
DEF_BENCH( return new GradientBench(kRadial_GradType, gGradData[0], SkShader::kMirror_TileMode); )
DEF_BENCH( return new GradientBench(kSweep_GradType); )
DEF_BENCH( return new GradientBench(kSweep_GradType, gGradData[1]); )
+DEF_BENCH( return new GradientBench(kSweep_GradType, gGradData[2]); )
DEF_BENCH( return new GradientBench(kRadial2_GradType); )
DEF_BENCH( return new GradientBench(kRadial2_GradType, gGradData[1]); )
DEF_BENCH( return new GradientBench(kRadial2_GradType, gGradData[0], SkShader::kMirror_TileMode); )
DEF_BENCH( return new GradientBench(kConical_GradType); )
DEF_BENCH( return new GradientBench(kConical_GradType, gGradData[1]); )
+DEF_BENCH( return new GradientBench(kConical_GradType, gGradData[2]); )
///////////////////////////////////////////////////////////////////////////////
« 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