epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2011 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 8 | #include "SkBenchmark.h" |
| 9 | #include "SkBitmap.h" |
| 10 | #include "SkCanvas.h" |
| 11 | #include "SkColorPriv.h" |
| 12 | #include "SkGradientShader.h" |
| 13 | #include "SkPaint.h" |
| 14 | #include "SkShader.h" |
| 15 | #include "SkString.h" |
| 16 | #include "SkUnitMapper.h" |
| 17 | |
| 18 | struct GradData { |
| 19 | int fCount; |
| 20 | const SkColor* fColors; |
| 21 | const SkScalar* fPos; |
commit-bot@chromium.org | 5396a04 | 2013-07-10 16:13:14 +0000 | [diff] [blame] | 22 | const char* fName; |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 23 | }; |
| 24 | |
| 25 | static const SkColor gColors[] = { |
commit-bot@chromium.org | b686539 | 2013-07-09 19:43:29 +0000 | [diff] [blame] | 26 | SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK, |
commit-bot@chromium.org | 5396a04 | 2013-07-10 16:13:14 +0000 | [diff] [blame] | 27 | SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK, |
| 28 | SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK, |
| 29 | SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK, |
| 30 | SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK, |
| 31 | SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK, |
| 32 | SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK, |
| 33 | SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK, |
| 34 | SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK, |
| 35 | SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK, // 10 lines, 50 colors |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 36 | }; |
| 37 | |
commit-bot@chromium.org | 3400f4b | 2013-09-30 19:41:09 +0000 | [diff] [blame] | 38 | // We have several special-cases depending on the number (and spacing) of colors, so |
| 39 | // try to exercise those here. |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 40 | static const GradData gGradData[] = { |
commit-bot@chromium.org | 5396a04 | 2013-07-10 16:13:14 +0000 | [diff] [blame] | 41 | { 2, gColors, NULL, "" }, |
| 42 | { 50, gColors, NULL, "_hicolor" }, // many color gradient |
commit-bot@chromium.org | 3400f4b | 2013-09-30 19:41:09 +0000 | [diff] [blame] | 43 | { 3, gColors, NULL, "_3color" }, |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 44 | }; |
| 45 | |
tomhudson@google.com | 5ea050f | 2011-09-26 15:03:55 +0000 | [diff] [blame] | 46 | /// Ignores scale |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 47 | static SkShader* MakeLinear(const SkPoint pts[2], const GradData& data, |
tomhudson@google.com | 5ea050f | 2011-09-26 15:03:55 +0000 | [diff] [blame] | 48 | SkShader::TileMode tm, SkUnitMapper* mapper, |
| 49 | float scale) { |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 50 | return SkGradientShader::CreateLinear(pts, data.fColors, data.fPos, |
| 51 | data.fCount, tm, mapper); |
| 52 | } |
| 53 | |
| 54 | static SkShader* MakeRadial(const SkPoint pts[2], const GradData& data, |
tomhudson@google.com | 5ea050f | 2011-09-26 15:03:55 +0000 | [diff] [blame] | 55 | SkShader::TileMode tm, SkUnitMapper* mapper, |
| 56 | float scale) { |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 57 | SkPoint center; |
| 58 | center.set(SkScalarAve(pts[0].fX, pts[1].fX), |
| 59 | SkScalarAve(pts[0].fY, pts[1].fY)); |
tomhudson@google.com | 5ea050f | 2011-09-26 15:03:55 +0000 | [diff] [blame] | 60 | return SkGradientShader::CreateRadial(center, center.fX * scale, |
| 61 | data.fColors, |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 62 | data.fPos, data.fCount, tm, mapper); |
| 63 | } |
| 64 | |
tomhudson@google.com | 5ea050f | 2011-09-26 15:03:55 +0000 | [diff] [blame] | 65 | /// Ignores scale |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 66 | static SkShader* MakeSweep(const SkPoint pts[2], const GradData& data, |
tomhudson@google.com | 5ea050f | 2011-09-26 15:03:55 +0000 | [diff] [blame] | 67 | SkShader::TileMode tm, SkUnitMapper* mapper, |
| 68 | float scale) { |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 69 | SkPoint center; |
| 70 | center.set(SkScalarAve(pts[0].fX, pts[1].fX), |
| 71 | SkScalarAve(pts[0].fY, pts[1].fY)); |
| 72 | return SkGradientShader::CreateSweep(center.fX, center.fY, data.fColors, |
| 73 | data.fPos, data.fCount, mapper); |
| 74 | } |
| 75 | |
tomhudson@google.com | 5ea050f | 2011-09-26 15:03:55 +0000 | [diff] [blame] | 76 | /// Ignores scale |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 77 | static SkShader* Make2Radial(const SkPoint pts[2], const GradData& data, |
tomhudson@google.com | 5ea050f | 2011-09-26 15:03:55 +0000 | [diff] [blame] | 78 | SkShader::TileMode tm, SkUnitMapper* mapper, |
| 79 | float scale) { |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 80 | SkPoint center0, center1; |
| 81 | center0.set(SkScalarAve(pts[0].fX, pts[1].fX), |
| 82 | SkScalarAve(pts[0].fY, pts[1].fY)); |
| 83 | center1.set(SkScalarInterp(pts[0].fX, pts[1].fX, SkIntToScalar(3)/5), |
| 84 | SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4)); |
| 85 | return SkGradientShader::CreateTwoPointRadial( |
reed@google.com | 258e0bf | 2012-06-07 14:18:34 +0000 | [diff] [blame] | 86 | center1, (pts[1].fX - pts[0].fX) / 7, |
| 87 | center0, (pts[1].fX - pts[0].fX) / 2, |
| 88 | data.fColors, data.fPos, data.fCount, tm, mapper); |
| 89 | } |
| 90 | |
| 91 | /// Ignores scale |
| 92 | static SkShader* MakeConical(const SkPoint pts[2], const GradData& data, |
| 93 | SkShader::TileMode tm, SkUnitMapper* mapper, |
| 94 | float scale) { |
| 95 | SkPoint center0, center1; |
| 96 | center0.set(SkScalarAve(pts[0].fX, pts[1].fX), |
| 97 | SkScalarAve(pts[0].fY, pts[1].fY)); |
| 98 | center1.set(SkScalarInterp(pts[0].fX, pts[1].fX, SkIntToScalar(3)/5), |
| 99 | SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4)); |
| 100 | return SkGradientShader::CreateTwoPointConical(center1, (pts[1].fX - pts[0].fX) / 7, |
| 101 | center0, (pts[1].fX - pts[0].fX) / 2, |
| 102 | data.fColors, data.fPos, data.fCount, tm, mapper); |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 103 | } |
| 104 | |
| 105 | typedef SkShader* (*GradMaker)(const SkPoint pts[2], const GradData& data, |
tomhudson@google.com | 5ea050f | 2011-09-26 15:03:55 +0000 | [diff] [blame] | 106 | SkShader::TileMode tm, SkUnitMapper* mapper, |
| 107 | float scale); |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 108 | |
| 109 | static const struct { |
| 110 | GradMaker fMaker; |
| 111 | const char* fName; |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 112 | } gGrads[] = { |
commit-bot@chromium.org | b120bd9 | 2013-10-07 17:18:21 +0000 | [diff] [blame] | 113 | { MakeLinear, "linear" }, |
| 114 | { MakeRadial, "radial1" }, |
| 115 | { MakeSweep, "sweep" }, |
| 116 | { Make2Radial, "radial2" }, |
| 117 | { MakeConical, "conical" }, |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 118 | }; |
| 119 | |
| 120 | enum GradType { // these must match the order in gGrads |
| 121 | kLinear_GradType, |
| 122 | kRadial_GradType, |
| 123 | kSweep_GradType, |
reed@google.com | 258e0bf | 2012-06-07 14:18:34 +0000 | [diff] [blame] | 124 | kRadial2_GradType, |
| 125 | kConical_GradType |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 126 | }; |
| 127 | |
tomhudson@google.com | 5ea050f | 2011-09-26 15:03:55 +0000 | [diff] [blame] | 128 | enum GeomType { |
| 129 | kRect_GeomType, |
| 130 | kOval_GeomType |
| 131 | }; |
| 132 | |
reed@google.com | 7241516 | 2011-06-15 21:17:37 +0000 | [diff] [blame] | 133 | static const char* tilemodename(SkShader::TileMode tm) { |
| 134 | switch (tm) { |
| 135 | case SkShader::kClamp_TileMode: |
| 136 | return "clamp"; |
| 137 | case SkShader::kRepeat_TileMode: |
| 138 | return "repeat"; |
| 139 | case SkShader::kMirror_TileMode: |
| 140 | return "mirror"; |
| 141 | default: |
mtklein@google.com | 330313a | 2013-08-22 15:37:26 +0000 | [diff] [blame] | 142 | SkDEBUGFAIL("unknown tilemode"); |
reed@google.com | 7241516 | 2011-06-15 21:17:37 +0000 | [diff] [blame] | 143 | return "error"; |
| 144 | } |
| 145 | } |
| 146 | |
tomhudson@google.com | 5ea050f | 2011-09-26 15:03:55 +0000 | [diff] [blame] | 147 | static const char* geomtypename(GeomType gt) { |
| 148 | switch (gt) { |
| 149 | case kRect_GeomType: |
| 150 | return "rectangle"; |
| 151 | case kOval_GeomType: |
| 152 | return "oval"; |
| 153 | default: |
mtklein@google.com | 330313a | 2013-08-22 15:37:26 +0000 | [diff] [blame] | 154 | SkDEBUGFAIL("unknown geometry type"); |
tomhudson@google.com | 5ea050f | 2011-09-26 15:03:55 +0000 | [diff] [blame] | 155 | return "error"; |
| 156 | } |
| 157 | } |
| 158 | |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 159 | /////////////////////////////////////////////////////////////////////////////// |
| 160 | |
| 161 | class GradientBench : public SkBenchmark { |
| 162 | SkString fName; |
| 163 | SkShader* fShader; |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 164 | enum { |
| 165 | W = 400, |
| 166 | H = 400, |
commit-bot@chromium.org | b120bd9 | 2013-10-07 17:18:21 +0000 | [diff] [blame] | 167 | kRepeat = 15, |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 168 | }; |
| 169 | public: |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 170 | GradientBench(GradType gradType, |
commit-bot@chromium.org | 5396a04 | 2013-07-10 16:13:14 +0000 | [diff] [blame] | 171 | GradData data = gGradData[0], |
tomhudson@google.com | 5ea050f | 2011-09-26 15:03:55 +0000 | [diff] [blame] | 172 | SkShader::TileMode tm = SkShader::kClamp_TileMode, |
| 173 | GeomType geomType = kRect_GeomType, |
commit-bot@chromium.org | 3400f4b | 2013-09-30 19:41:09 +0000 | [diff] [blame] | 174 | float scale = 1.0f) { |
tomhudson@google.com | 5ea050f | 2011-09-26 15:03:55 +0000 | [diff] [blame] | 175 | fName.printf("gradient_%s_%s", gGrads[gradType].fName, |
| 176 | tilemodename(tm)); |
| 177 | if (geomType != kRect_GeomType) { |
| 178 | fName.append("_"); |
| 179 | fName.append(geomtypename(geomType)); |
| 180 | } |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 181 | |
commit-bot@chromium.org | 3400f4b | 2013-09-30 19:41:09 +0000 | [diff] [blame] | 182 | if (scale != 1.f) { |
| 183 | fName.appendf("_scale_%g", scale); |
| 184 | } |
| 185 | |
commit-bot@chromium.org | 5396a04 | 2013-07-10 16:13:14 +0000 | [diff] [blame] | 186 | fName.append(data.fName); |
| 187 | |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 188 | const SkPoint pts[2] = { |
| 189 | { 0, 0 }, |
| 190 | { SkIntToScalar(W), SkIntToScalar(H) } |
| 191 | }; |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 192 | |
commit-bot@chromium.org | 5396a04 | 2013-07-10 16:13:14 +0000 | [diff] [blame] | 193 | fShader = gGrads[gradType].fMaker(pts, data, tm, NULL, scale); |
tomhudson@google.com | 5ea050f | 2011-09-26 15:03:55 +0000 | [diff] [blame] | 194 | fGeomType = geomType; |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 195 | } |
| 196 | |
| 197 | virtual ~GradientBench() { |
| 198 | fShader->unref(); |
| 199 | } |
| 200 | |
| 201 | protected: |
| 202 | virtual const char* onGetName() { |
| 203 | return fName.c_str(); |
| 204 | } |
| 205 | |
| 206 | virtual void onDraw(SkCanvas* canvas) { |
| 207 | SkPaint paint; |
| 208 | this->setupPaint(&paint); |
| 209 | |
| 210 | paint.setShader(fShader); |
| 211 | |
| 212 | SkRect r = { 0, 0, SkIntToScalar(W), SkIntToScalar(H) }; |
commit-bot@chromium.org | b120bd9 | 2013-10-07 17:18:21 +0000 | [diff] [blame] | 213 | for (int i = 0; i < this->getLoops() * kRepeat; i++) { |
tomhudson@google.com | 5ea050f | 2011-09-26 15:03:55 +0000 | [diff] [blame] | 214 | switch (fGeomType) { |
| 215 | case kRect_GeomType: |
| 216 | canvas->drawRect(r, paint); |
| 217 | break; |
| 218 | case kOval_GeomType: |
| 219 | canvas->drawOval(r, paint); |
| 220 | break; |
| 221 | } |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 222 | } |
| 223 | } |
| 224 | |
| 225 | private: |
| 226 | typedef SkBenchmark INHERITED; |
tomhudson@google.com | 5ea050f | 2011-09-26 15:03:55 +0000 | [diff] [blame] | 227 | |
| 228 | GeomType fGeomType; |
reed@google.com | 84e9c08 | 2011-04-13 17:44:24 +0000 | [diff] [blame] | 229 | }; |
| 230 | |
commit-bot@chromium.org | b120bd9 | 2013-10-07 17:18:21 +0000 | [diff] [blame] | 231 | DEF_BENCH( return new GradientBench(kLinear_GradType); ) |
| 232 | DEF_BENCH( return new GradientBench(kLinear_GradType, gGradData[1]); ) |
| 233 | DEF_BENCH( return new GradientBench(kLinear_GradType, gGradData[2]); ) |
| 234 | DEF_BENCH( return new GradientBench(kLinear_GradType, gGradData[0], SkShader::kMirror_TileMode); ) |
| 235 | |
| 236 | DEF_BENCH( return new GradientBench(kRadial_GradType, gGradData[0]); ) |
| 237 | DEF_BENCH( return new GradientBench(kRadial_GradType, gGradData[1]); ) |
| 238 | DEF_BENCH( return new GradientBench(kRadial_GradType, gGradData[2]); ) |
| 239 | // Draw a radial gradient of radius 1/2 on a rectangle; half the lines should |
| 240 | // be completely pinned, the other half should pe partially pinned |
| 241 | DEF_BENCH( return new GradientBench(kRadial_GradType, gGradData[0], SkShader::kClamp_TileMode, kRect_GeomType, 0.5f); ) |
| 242 | |
| 243 | // Draw a radial gradient on a circle of equal size; all the lines should |
| 244 | // hit the unpinned fast path (so long as GradientBench.W == H) |
| 245 | DEF_BENCH( return new GradientBench(kRadial_GradType, gGradData[0], SkShader::kClamp_TileMode, kOval_GeomType); ) |
| 246 | |
| 247 | DEF_BENCH( return new GradientBench(kRadial_GradType, gGradData[0], SkShader::kMirror_TileMode); ) |
| 248 | DEF_BENCH( return new GradientBench(kSweep_GradType); ) |
| 249 | DEF_BENCH( return new GradientBench(kSweep_GradType, gGradData[1]); ) |
| 250 | DEF_BENCH( return new GradientBench(kSweep_GradType, gGradData[2]); ) |
| 251 | DEF_BENCH( return new GradientBench(kRadial2_GradType); ) |
| 252 | DEF_BENCH( return new GradientBench(kRadial2_GradType, gGradData[1]); ) |
| 253 | DEF_BENCH( return new GradientBench(kRadial2_GradType, gGradData[0], SkShader::kMirror_TileMode); ) |
| 254 | DEF_BENCH( return new GradientBench(kConical_GradType); ) |
| 255 | DEF_BENCH( return new GradientBench(kConical_GradType, gGradData[1]); ) |
| 256 | DEF_BENCH( return new GradientBench(kConical_GradType, gGradData[2]); ) |
| 257 | |
| 258 | /////////////////////////////////////////////////////////////////////////////// |
| 259 | |
reed@google.com | 8ac7a0f | 2011-06-16 13:14:19 +0000 | [diff] [blame] | 260 | class Gradient2Bench : public SkBenchmark { |
reed@google.com | 73349aa | 2013-02-04 18:09:58 +0000 | [diff] [blame] | 261 | SkString fName; |
| 262 | bool fHasAlpha; |
| 263 | |
reed@google.com | 8ac7a0f | 2011-06-16 13:14:19 +0000 | [diff] [blame] | 264 | public: |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 265 | Gradient2Bench(bool hasAlpha) { |
reed@google.com | 73349aa | 2013-02-04 18:09:58 +0000 | [diff] [blame] | 266 | fName.printf("gradient_create_%s", hasAlpha ? "alpha" : "opaque"); |
| 267 | fHasAlpha = hasAlpha; |
| 268 | } |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 269 | |
reed@google.com | 8ac7a0f | 2011-06-16 13:14:19 +0000 | [diff] [blame] | 270 | protected: |
| 271 | virtual const char* onGetName() { |
reed@google.com | 73349aa | 2013-02-04 18:09:58 +0000 | [diff] [blame] | 272 | return fName.c_str(); |
reed@google.com | 8ac7a0f | 2011-06-16 13:14:19 +0000 | [diff] [blame] | 273 | } |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 274 | |
reed@google.com | 8ac7a0f | 2011-06-16 13:14:19 +0000 | [diff] [blame] | 275 | virtual void onDraw(SkCanvas* canvas) { |
| 276 | SkPaint paint; |
| 277 | this->setupPaint(&paint); |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 278 | |
reed@google.com | 8ac7a0f | 2011-06-16 13:14:19 +0000 | [diff] [blame] | 279 | const SkRect r = { 0, 0, SkIntToScalar(4), SkIntToScalar(4) }; |
reed@google.com | 1ca4f26 | 2011-06-24 19:17:37 +0000 | [diff] [blame] | 280 | const SkPoint pts[] = { |
| 281 | { 0, 0 }, |
| 282 | { SkIntToScalar(100), SkIntToScalar(100) }, |
| 283 | }; |
reed@google.com | 8ac7a0f | 2011-06-16 13:14:19 +0000 | [diff] [blame] | 284 | |
mtklein@google.com | c289743 | 2013-09-10 19:23:38 +0000 | [diff] [blame] | 285 | for (int i = 0; i < this->getLoops(); i++) { |
reed@google.com | 73349aa | 2013-02-04 18:09:58 +0000 | [diff] [blame] | 286 | const int gray = i % 256; |
| 287 | const int alpha = fHasAlpha ? gray : 0xFF; |
tomhudson@google.com | 5ea050f | 2011-09-26 15:03:55 +0000 | [diff] [blame] | 288 | SkColor colors[] = { |
| 289 | SK_ColorBLACK, |
reed@google.com | 73349aa | 2013-02-04 18:09:58 +0000 | [diff] [blame] | 290 | SkColorSetARGB(alpha, gray, gray, gray), |
tomhudson@google.com | 5ea050f | 2011-09-26 15:03:55 +0000 | [diff] [blame] | 291 | SK_ColorWHITE }; |
reed@google.com | 8ac7a0f | 2011-06-16 13:14:19 +0000 | [diff] [blame] | 292 | SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL, |
| 293 | SK_ARRAY_COUNT(colors), |
| 294 | SkShader::kClamp_TileMode); |
| 295 | paint.setShader(s)->unref(); |
| 296 | canvas->drawRect(r, paint); |
| 297 | } |
| 298 | } |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 299 | |
reed@google.com | 8ac7a0f | 2011-06-16 13:14:19 +0000 | [diff] [blame] | 300 | private: |
| 301 | typedef SkBenchmark INHERITED; |
| 302 | }; |
| 303 | |
mtklein@google.com | 410e6e8 | 2013-09-13 19:52:27 +0000 | [diff] [blame] | 304 | DEF_BENCH( return new Gradient2Bench(false); ) |
| 305 | DEF_BENCH( return new Gradient2Bench(true); ) |