blob: 705099db1c2cc586f6937a48761e7bec308d11e5 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
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 */
tfarinaf168b862014-06-19 12:32:29 -07008#include "Benchmark.h"
reed@google.com84e9c082011-04-13 17:44:24 +00009#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"
reed@google.com84e9c082011-04-13 17:44:24 +000016
17struct GradData {
18 int fCount;
19 const SkColor* fColors;
20 const SkScalar* fPos;
commit-bot@chromium.org5396a042013-07-10 16:13:14 +000021 const char* fName;
reed@google.com84e9c082011-04-13 17:44:24 +000022};
23
24static const SkColor gColors[] = {
commit-bot@chromium.orgb6865392013-07-09 19:43:29 +000025 SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK,
commit-bot@chromium.org5396a042013-07-10 16:13:14 +000026 SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE, SK_ColorBLACK,
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, // 10 lines, 50 colors
reed@google.com84e9c082011-04-13 17:44:24 +000035};
36
krajcevskif461a8f2014-06-19 14:14:06 -070037static const SkColor gShallowColors[] = { 0xFF555555, 0xFF444444 };
38
commit-bot@chromium.org3400f4b2013-09-30 19:41:09 +000039// We have several special-cases depending on the number (and spacing) of colors, so
40// try to exercise those here.
reed@google.com84e9c082011-04-13 17:44:24 +000041static const GradData gGradData[] = {
halcanary96fcdcc2015-08-27 07:41:13 -070042 { 2, gColors, nullptr, "" },
43 { 50, gColors, nullptr, "_hicolor" }, // many color gradient
44 { 3, gColors, nullptr, "_3color" },
45 { 2, gShallowColors, nullptr, "_shallow" },
reed@google.com84e9c082011-04-13 17:44:24 +000046};
47
tomhudson@google.com5ea050f2011-09-26 15:03:55 +000048/// Ignores scale
reed@google.com84e9c082011-04-13 17:44:24 +000049static SkShader* MakeLinear(const SkPoint pts[2], const GradData& data,
commit-bot@chromium.org83f23d82014-05-22 12:27:41 +000050 SkShader::TileMode tm, float scale) {
51 return SkGradientShader::CreateLinear(pts, data.fColors, data.fPos, data.fCount, tm);
reed@google.com84e9c082011-04-13 17:44:24 +000052}
53
54static SkShader* MakeRadial(const SkPoint pts[2], const GradData& data,
commit-bot@chromium.org83f23d82014-05-22 12:27:41 +000055 SkShader::TileMode tm, float scale) {
reed@google.com84e9c082011-04-13 17:44:24 +000056 SkPoint center;
57 center.set(SkScalarAve(pts[0].fX, pts[1].fX),
58 SkScalarAve(pts[0].fY, pts[1].fY));
tomhudson@google.com5ea050f2011-09-26 15:03:55 +000059 return SkGradientShader::CreateRadial(center, center.fX * scale,
60 data.fColors,
commit-bot@chromium.org83f23d82014-05-22 12:27:41 +000061 data.fPos, data.fCount, tm);
reed@google.com84e9c082011-04-13 17:44:24 +000062}
63
tomhudson@google.com5ea050f2011-09-26 15:03:55 +000064/// Ignores scale
reed@google.com84e9c082011-04-13 17:44:24 +000065static SkShader* MakeSweep(const SkPoint pts[2], const GradData& data,
commit-bot@chromium.org83f23d82014-05-22 12:27:41 +000066 SkShader::TileMode tm, float scale) {
reed@google.com84e9c082011-04-13 17:44:24 +000067 SkPoint center;
68 center.set(SkScalarAve(pts[0].fX, pts[1].fX),
69 SkScalarAve(pts[0].fY, pts[1].fY));
70 return SkGradientShader::CreateSweep(center.fX, center.fY, data.fColors,
commit-bot@chromium.org83f23d82014-05-22 12:27:41 +000071 data.fPos, data.fCount);
reed@google.com84e9c082011-04-13 17:44:24 +000072}
73
tomhudson@google.com5ea050f2011-09-26 15:03:55 +000074/// Ignores scale
reed@google.com258e0bf2012-06-07 14:18:34 +000075static SkShader* MakeConical(const SkPoint pts[2], const GradData& data,
commit-bot@chromium.org83f23d82014-05-22 12:27:41 +000076 SkShader::TileMode tm, float scale) {
reed@google.com258e0bf2012-06-07 14:18:34 +000077 SkPoint center0, center1;
78 center0.set(SkScalarAve(pts[0].fX, pts[1].fX),
79 SkScalarAve(pts[0].fY, pts[1].fY));
80 center1.set(SkScalarInterp(pts[0].fX, pts[1].fX, SkIntToScalar(3)/5),
81 SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4));
82 return SkGradientShader::CreateTwoPointConical(center1, (pts[1].fX - pts[0].fX) / 7,
83 center0, (pts[1].fX - pts[0].fX) / 2,
commit-bot@chromium.org83f23d82014-05-22 12:27:41 +000084 data.fColors, data.fPos, data.fCount, tm);
reed@google.com84e9c082011-04-13 17:44:24 +000085}
86
commit-bot@chromium.org95f79262014-04-14 16:02:31 +000087/// Ignores scale
88static SkShader* MakeConicalZeroRad(const SkPoint pts[2], const GradData& data,
commit-bot@chromium.org83f23d82014-05-22 12:27:41 +000089 SkShader::TileMode tm, float scale) {
commit-bot@chromium.org95f79262014-04-14 16:02:31 +000090 SkPoint center0, center1;
91 center0.set(SkScalarAve(pts[0].fX, pts[1].fX),
92 SkScalarAve(pts[0].fY, pts[1].fY));
93 center1.set(SkScalarInterp(pts[0].fX, pts[1].fX, SkIntToScalar(3)/5),
94 SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4));
95 return SkGradientShader::CreateTwoPointConical(center1, 0.0,
96 center0, (pts[1].fX - pts[0].fX) / 2,
commit-bot@chromium.org83f23d82014-05-22 12:27:41 +000097 data.fColors, data.fPos, data.fCount, tm);
commit-bot@chromium.org95f79262014-04-14 16:02:31 +000098}
99
100/// Ignores scale
101static SkShader* MakeConicalOutside(const SkPoint pts[2], const GradData& data,
commit-bot@chromium.org83f23d82014-05-22 12:27:41 +0000102 SkShader::TileMode tm, float scale) {
commit-bot@chromium.org95f79262014-04-14 16:02:31 +0000103 SkPoint center0, center1;
reed80ea19c2015-05-12 10:37:34 -0700104 SkScalar radius0 = (pts[1].fX - pts[0].fX) / 10;
105 SkScalar radius1 = (pts[1].fX - pts[0].fX) / 3;
commit-bot@chromium.org95f79262014-04-14 16:02:31 +0000106 center0.set(pts[0].fX + radius0, pts[0].fY + radius0);
107 center1.set(pts[1].fX - radius1, pts[1].fY - radius1);
108 return SkGradientShader::CreateTwoPointConical(center0, radius0,
109 center1, radius1,
110 data.fColors, data.fPos,
commit-bot@chromium.org83f23d82014-05-22 12:27:41 +0000111 data.fCount, tm);
commit-bot@chromium.org95f79262014-04-14 16:02:31 +0000112}
113
114/// Ignores scale
115static SkShader* MakeConicalOutsideZeroRad(const SkPoint pts[2], const GradData& data,
commit-bot@chromium.org83f23d82014-05-22 12:27:41 +0000116 SkShader::TileMode tm, float scale) {
commit-bot@chromium.org95f79262014-04-14 16:02:31 +0000117 SkPoint center0, center1;
reed80ea19c2015-05-12 10:37:34 -0700118 SkScalar radius0 = (pts[1].fX - pts[0].fX) / 10;
119 SkScalar radius1 = (pts[1].fX - pts[0].fX) / 3;
commit-bot@chromium.org95f79262014-04-14 16:02:31 +0000120 center0.set(pts[0].fX + radius0, pts[0].fY + radius0);
121 center1.set(pts[1].fX - radius1, pts[1].fY - radius1);
122 return SkGradientShader::CreateTwoPointConical(center0, 0.0,
123 center1, radius1,
124 data.fColors, data.fPos,
commit-bot@chromium.org83f23d82014-05-22 12:27:41 +0000125 data.fCount, tm);
commit-bot@chromium.org95f79262014-04-14 16:02:31 +0000126}
127
reed@google.com84e9c082011-04-13 17:44:24 +0000128typedef SkShader* (*GradMaker)(const SkPoint pts[2], const GradData& data,
commit-bot@chromium.org83f23d82014-05-22 12:27:41 +0000129 SkShader::TileMode tm, float scale);
reed@google.com84e9c082011-04-13 17:44:24 +0000130
131static const struct {
132 GradMaker fMaker;
133 const char* fName;
reed@google.com84e9c082011-04-13 17:44:24 +0000134} gGrads[] = {
commit-bot@chromium.org95f79262014-04-14 16:02:31 +0000135 { MakeLinear, "linear" },
136 { MakeRadial, "radial1" },
137 { MakeSweep, "sweep" },
commit-bot@chromium.org95f79262014-04-14 16:02:31 +0000138 { MakeConical, "conical" },
139 { MakeConicalZeroRad, "conicalZero" },
140 { MakeConicalOutside, "conicalOut" },
141 { MakeConicalOutsideZeroRad, "conicalOutZero" },
reed@google.com84e9c082011-04-13 17:44:24 +0000142};
143
144enum GradType { // these must match the order in gGrads
145 kLinear_GradType,
146 kRadial_GradType,
147 kSweep_GradType,
commit-bot@chromium.org95f79262014-04-14 16:02:31 +0000148 kConical_GradType,
149 kConicalZero_GradType,
150 kConicalOut_GradType,
151 kConicalOutZero_GradType
reed@google.com84e9c082011-04-13 17:44:24 +0000152};
153
tomhudson@google.com5ea050f2011-09-26 15:03:55 +0000154enum GeomType {
155 kRect_GeomType,
156 kOval_GeomType
157};
158
reed@google.com72415162011-06-15 21:17:37 +0000159static const char* tilemodename(SkShader::TileMode tm) {
160 switch (tm) {
161 case SkShader::kClamp_TileMode:
162 return "clamp";
163 case SkShader::kRepeat_TileMode:
164 return "repeat";
165 case SkShader::kMirror_TileMode:
166 return "mirror";
167 default:
mtklein@google.com330313a2013-08-22 15:37:26 +0000168 SkDEBUGFAIL("unknown tilemode");
reed@google.com72415162011-06-15 21:17:37 +0000169 return "error";
170 }
171}
172
tomhudson@google.com5ea050f2011-09-26 15:03:55 +0000173static const char* geomtypename(GeomType gt) {
174 switch (gt) {
175 case kRect_GeomType:
176 return "rectangle";
177 case kOval_GeomType:
178 return "oval";
179 default:
mtklein@google.com330313a2013-08-22 15:37:26 +0000180 SkDEBUGFAIL("unknown geometry type");
tomhudson@google.com5ea050f2011-09-26 15:03:55 +0000181 return "error";
182 }
183}
184
reed@google.com84e9c082011-04-13 17:44:24 +0000185///////////////////////////////////////////////////////////////////////////////
186
tfarinaf168b862014-06-19 12:32:29 -0700187class GradientBench : public Benchmark {
reed@google.com84e9c082011-04-13 17:44:24 +0000188 SkString fName;
189 SkShader* fShader;
krajcevskif461a8f2014-06-19 14:14:06 -0700190 bool fDither;
reed@google.com84e9c082011-04-13 17:44:24 +0000191 enum {
192 W = 400,
193 H = 400,
reed@google.com84e9c082011-04-13 17:44:24 +0000194 };
195public:
krajcevskif461a8f2014-06-19 14:14:06 -0700196 SkShader* makeShader(GradType gradType, GradData data, SkShader::TileMode tm, float scale) {
197 const SkPoint pts[2] = {
198 { 0, 0 },
199 { SkIntToScalar(W), SkIntToScalar(H) }
200 };
201
202 return gGrads[gradType].fMaker(pts, data, tm, scale);
203 }
204
mtklein@google.com410e6e82013-09-13 19:52:27 +0000205 GradientBench(GradType gradType,
commit-bot@chromium.org5396a042013-07-10 16:13:14 +0000206 GradData data = gGradData[0],
tomhudson@google.com5ea050f2011-09-26 15:03:55 +0000207 SkShader::TileMode tm = SkShader::kClamp_TileMode,
208 GeomType geomType = kRect_GeomType,
commit-bot@chromium.org3400f4b2013-09-30 19:41:09 +0000209 float scale = 1.0f) {
tomhudson@google.com5ea050f2011-09-26 15:03:55 +0000210 fName.printf("gradient_%s_%s", gGrads[gradType].fName,
211 tilemodename(tm));
212 if (geomType != kRect_GeomType) {
213 fName.append("_");
214 fName.append(geomtypename(geomType));
215 }
reed@google.com84e9c082011-04-13 17:44:24 +0000216
commit-bot@chromium.org3400f4b2013-09-30 19:41:09 +0000217 if (scale != 1.f) {
218 fName.appendf("_scale_%g", scale);
219 }
220
commit-bot@chromium.org5396a042013-07-10 16:13:14 +0000221 fName.append(data.fName);
222
krajcevskif461a8f2014-06-19 14:14:06 -0700223 fDither = false;
224 fShader = this->makeShader(gradType, data, tm, scale);
tomhudson@google.com5ea050f2011-09-26 15:03:55 +0000225 fGeomType = geomType;
reed@google.com84e9c082011-04-13 17:44:24 +0000226 }
227
krajcevskif461a8f2014-06-19 14:14:06 -0700228 GradientBench(GradType gradType, GradData data, bool dither) {
229 const char *tmname = tilemodename(SkShader::kClamp_TileMode);
230 fName.printf("gradient_%s_%s", gGrads[gradType].fName, tmname);
231 fName.append(data.fName);
232
233 fDither = dither;
234 if (dither) {
235 fName.appendf("_dither");
236 }
237
238 fShader = this->makeShader(gradType, data, SkShader::kClamp_TileMode, 1.0f);
239 fGeomType = kRect_GeomType;
240 }
241
reed@google.com84e9c082011-04-13 17:44:24 +0000242 virtual ~GradientBench() {
243 fShader->unref();
244 }
245
246protected:
247 virtual const char* onGetName() {
248 return fName.c_str();
249 }
250
commit-bot@chromium.org33614712013-12-03 18:17:16 +0000251 virtual void onDraw(const int loops, SkCanvas* canvas) {
reed@google.com84e9c082011-04-13 17:44:24 +0000252 SkPaint paint;
253 this->setupPaint(&paint);
254
255 paint.setShader(fShader);
krajcevskif461a8f2014-06-19 14:14:06 -0700256 if (fDither) {
257 paint.setDither(true);
258 }
reed@google.com84e9c082011-04-13 17:44:24 +0000259
260 SkRect r = { 0, 0, SkIntToScalar(W), SkIntToScalar(H) };
bsalomona7f79b42014-08-14 12:24:46 -0700261 for (int i = 0; i < loops; i++) {
tomhudson@google.com5ea050f2011-09-26 15:03:55 +0000262 switch (fGeomType) {
263 case kRect_GeomType:
264 canvas->drawRect(r, paint);
265 break;
266 case kOval_GeomType:
267 canvas->drawOval(r, paint);
268 break;
269 }
reed@google.com84e9c082011-04-13 17:44:24 +0000270 }
271 }
272
273private:
tfarinaf168b862014-06-19 12:32:29 -0700274 typedef Benchmark INHERITED;
tomhudson@google.com5ea050f2011-09-26 15:03:55 +0000275
276 GeomType fGeomType;
reed@google.com84e9c082011-04-13 17:44:24 +0000277};
278
commit-bot@chromium.orgb120bd92013-10-07 17:18:21 +0000279DEF_BENCH( return new GradientBench(kLinear_GradType); )
280DEF_BENCH( return new GradientBench(kLinear_GradType, gGradData[1]); )
281DEF_BENCH( return new GradientBench(kLinear_GradType, gGradData[2]); )
282DEF_BENCH( return new GradientBench(kLinear_GradType, gGradData[0], SkShader::kMirror_TileMode); )
283
284DEF_BENCH( return new GradientBench(kRadial_GradType, gGradData[0]); )
285DEF_BENCH( return new GradientBench(kRadial_GradType, gGradData[1]); )
286DEF_BENCH( return new GradientBench(kRadial_GradType, gGradData[2]); )
287// Draw a radial gradient of radius 1/2 on a rectangle; half the lines should
288// be completely pinned, the other half should pe partially pinned
289DEF_BENCH( return new GradientBench(kRadial_GradType, gGradData[0], SkShader::kClamp_TileMode, kRect_GeomType, 0.5f); )
290
291// Draw a radial gradient on a circle of equal size; all the lines should
292// hit the unpinned fast path (so long as GradientBench.W == H)
293DEF_BENCH( return new GradientBench(kRadial_GradType, gGradData[0], SkShader::kClamp_TileMode, kOval_GeomType); )
294
295DEF_BENCH( return new GradientBench(kRadial_GradType, gGradData[0], SkShader::kMirror_TileMode); )
commit-bot@chromium.org34150b42013-10-16 18:59:44 +0000296DEF_BENCH( return new GradientBench(kRadial_GradType, gGradData[0], SkShader::kRepeat_TileMode); )
commit-bot@chromium.orgb120bd92013-10-07 17:18:21 +0000297DEF_BENCH( return new GradientBench(kSweep_GradType); )
298DEF_BENCH( return new GradientBench(kSweep_GradType, gGradData[1]); )
299DEF_BENCH( return new GradientBench(kSweep_GradType, gGradData[2]); )
commit-bot@chromium.orgb120bd92013-10-07 17:18:21 +0000300DEF_BENCH( return new GradientBench(kConical_GradType); )
301DEF_BENCH( return new GradientBench(kConical_GradType, gGradData[1]); )
302DEF_BENCH( return new GradientBench(kConical_GradType, gGradData[2]); )
commit-bot@chromium.org95f79262014-04-14 16:02:31 +0000303DEF_BENCH( return new GradientBench(kConicalZero_GradType); )
304DEF_BENCH( return new GradientBench(kConicalZero_GradType, gGradData[1]); )
305DEF_BENCH( return new GradientBench(kConicalZero_GradType, gGradData[2]); )
306DEF_BENCH( return new GradientBench(kConicalOut_GradType); )
307DEF_BENCH( return new GradientBench(kConicalOut_GradType, gGradData[1]); )
308DEF_BENCH( return new GradientBench(kConicalOut_GradType, gGradData[2]); )
309DEF_BENCH( return new GradientBench(kConicalOutZero_GradType); )
310DEF_BENCH( return new GradientBench(kConicalOutZero_GradType, gGradData[1]); )
311DEF_BENCH( return new GradientBench(kConicalOutZero_GradType, gGradData[2]); )
commit-bot@chromium.orgb120bd92013-10-07 17:18:21 +0000312
krajcevskif461a8f2014-06-19 14:14:06 -0700313// Dithering
314DEF_BENCH( return new GradientBench(kLinear_GradType, gGradData[3], true); )
315DEF_BENCH( return new GradientBench(kLinear_GradType, gGradData[3], false); )
316DEF_BENCH( return new GradientBench(kRadial_GradType, gGradData[3], true); )
317DEF_BENCH( return new GradientBench(kRadial_GradType, gGradData[3], false); )
318DEF_BENCH( return new GradientBench(kSweep_GradType, gGradData[3], true); )
319DEF_BENCH( return new GradientBench(kSweep_GradType, gGradData[3], false); )
320DEF_BENCH( return new GradientBench(kConical_GradType, gGradData[3], true); )
321DEF_BENCH( return new GradientBench(kConical_GradType, gGradData[3], false); )
322
commit-bot@chromium.orgb120bd92013-10-07 17:18:21 +0000323///////////////////////////////////////////////////////////////////////////////
324
tfarinaf168b862014-06-19 12:32:29 -0700325class Gradient2Bench : public Benchmark {
reed@google.com73349aa2013-02-04 18:09:58 +0000326 SkString fName;
327 bool fHasAlpha;
328
reed@google.com8ac7a0f2011-06-16 13:14:19 +0000329public:
mtklein@google.com410e6e82013-09-13 19:52:27 +0000330 Gradient2Bench(bool hasAlpha) {
reed@google.com73349aa2013-02-04 18:09:58 +0000331 fName.printf("gradient_create_%s", hasAlpha ? "alpha" : "opaque");
332 fHasAlpha = hasAlpha;
333 }
rmistry@google.comfbfcd562012-08-23 18:09:54 +0000334
reed@google.com8ac7a0f2011-06-16 13:14:19 +0000335protected:
336 virtual const char* onGetName() {
reed@google.com73349aa2013-02-04 18:09:58 +0000337 return fName.c_str();
reed@google.com8ac7a0f2011-06-16 13:14:19 +0000338 }
rmistry@google.comfbfcd562012-08-23 18:09:54 +0000339
commit-bot@chromium.org33614712013-12-03 18:17:16 +0000340 virtual void onDraw(const int loops, SkCanvas* canvas) {
reed@google.com8ac7a0f2011-06-16 13:14:19 +0000341 SkPaint paint;
342 this->setupPaint(&paint);
rmistry@google.comfbfcd562012-08-23 18:09:54 +0000343
reed@google.com8ac7a0f2011-06-16 13:14:19 +0000344 const SkRect r = { 0, 0, SkIntToScalar(4), SkIntToScalar(4) };
reed@google.com1ca4f262011-06-24 19:17:37 +0000345 const SkPoint pts[] = {
346 { 0, 0 },
347 { SkIntToScalar(100), SkIntToScalar(100) },
348 };
reed@google.com8ac7a0f2011-06-16 13:14:19 +0000349
commit-bot@chromium.org33614712013-12-03 18:17:16 +0000350 for (int i = 0; i < loops; i++) {
reed@google.com73349aa2013-02-04 18:09:58 +0000351 const int gray = i % 256;
352 const int alpha = fHasAlpha ? gray : 0xFF;
tomhudson@google.com5ea050f2011-09-26 15:03:55 +0000353 SkColor colors[] = {
354 SK_ColorBLACK,
reed@google.com73349aa2013-02-04 18:09:58 +0000355 SkColorSetARGB(alpha, gray, gray, gray),
tomhudson@google.com5ea050f2011-09-26 15:03:55 +0000356 SK_ColorWHITE };
halcanary96fcdcc2015-08-27 07:41:13 -0700357 SkShader* s = SkGradientShader::CreateLinear(pts, colors, nullptr,
reed@google.com8ac7a0f2011-06-16 13:14:19 +0000358 SK_ARRAY_COUNT(colors),
359 SkShader::kClamp_TileMode);
360 paint.setShader(s)->unref();
361 canvas->drawRect(r, paint);
362 }
363 }
rmistry@google.comfbfcd562012-08-23 18:09:54 +0000364
reed@google.com8ac7a0f2011-06-16 13:14:19 +0000365private:
tfarinaf168b862014-06-19 12:32:29 -0700366 typedef Benchmark INHERITED;
reed@google.com8ac7a0f2011-06-16 13:14:19 +0000367};
368
mtklein@google.com410e6e82013-09-13 19:52:27 +0000369DEF_BENCH( return new Gradient2Bench(false); )
370DEF_BENCH( return new Gradient2Bench(true); )