blob: bc5dbc8adfb42e936278eef771b4cde1637042c1 [file] [log] [blame]
reed@google.comdb87c962012-11-02 21:11:12 +00001/*
humper@google.coma99a92c2013-02-20 16:42:06 +00002* Copyright 2012 Google Inc.
3*
4* Use of this source code is governed by a BSD-style license that can be
5* found in the LICENSE file.
6*/
reed@google.comdb87c962012-11-02 21:11:12 +00007
8#include "gm.h"
humper@google.com7c7292c2013-01-04 20:29:03 +00009#include "SkBlurMask.h"
robertphillips@google.comb7061172013-09-06 14:16:12 +000010#include "SkBlurMaskFilter.h"
reed@google.comdb87c962012-11-02 21:11:12 +000011#include "SkCanvas.h"
12#include "SkPath.h"
13
14#define STROKE_WIDTH SkIntToScalar(10)
15
16typedef void (*Proc)(SkCanvas*, const SkRect&, const SkPaint&);
17
18static void fill_rect(SkCanvas* canvas, const SkRect& r, const SkPaint& p) {
19 canvas->drawRect(r, p);
20}
21
reed@google.comdb87c962012-11-02 21:11:12 +000022static void draw_donut(SkCanvas* canvas, const SkRect& r, const SkPaint& p) {
23 SkRect rect;
24 SkPath path;
skia.committer@gmail.com34587162012-11-20 02:01:23 +000025
reed@google.comdb87c962012-11-02 21:11:12 +000026 rect = r;
27 rect.outset(STROKE_WIDTH/2, STROKE_WIDTH/2);
28 path.addRect(rect);
29 rect = r;
30 rect.inset(STROKE_WIDTH/2, STROKE_WIDTH/2);
skia.committer@gmail.com34587162012-11-20 02:01:23 +000031
reed@google.comdb87c962012-11-02 21:11:12 +000032 path.addRect(rect);
33 path.setFillType(SkPath::kEvenOdd_FillType);
skia.committer@gmail.com34587162012-11-20 02:01:23 +000034
reed@google.com808b70f2012-11-19 16:14:02 +000035 canvas->drawPath(path, p);
36}
reed@google.comdb87c962012-11-02 21:11:12 +000037
reed@google.com808b70f2012-11-19 16:14:02 +000038static void draw_donut_skewed(SkCanvas* canvas, const SkRect& r, const SkPaint& p) {
39 SkRect rect;
40 SkPath path;
skia.committer@gmail.com34587162012-11-20 02:01:23 +000041
reed@google.com808b70f2012-11-19 16:14:02 +000042 rect = r;
43 rect.outset(STROKE_WIDTH/2, STROKE_WIDTH/2);
44 path.addRect(rect);
45 rect = r;
46 rect.inset(STROKE_WIDTH/2, STROKE_WIDTH/2);
skia.committer@gmail.com34587162012-11-20 02:01:23 +000047
reed@google.com808b70f2012-11-19 16:14:02 +000048 rect.offset(7, -7);
skia.committer@gmail.com34587162012-11-20 02:01:23 +000049
reed@google.com808b70f2012-11-19 16:14:02 +000050 path.addRect(rect);
51 path.setFillType(SkPath::kEvenOdd_FillType);
skia.committer@gmail.com34587162012-11-20 02:01:23 +000052
reed@google.comdb87c962012-11-02 21:11:12 +000053 canvas->drawPath(path, p);
54}
55
reed@google.com53007a22012-11-26 14:39:50 +000056#include "SkGradientShader.h"
57
58typedef void (*PaintProc)(SkPaint*, SkScalar width);
59
reed@google.comdb87c962012-11-02 21:11:12 +000060class BlurRectGM : public skiagm::GM {
commit-bot@chromium.orge3964552014-04-28 16:25:35 +000061 SkAutoTUnref<SkMaskFilter> fMaskFilters[kLastEnum_SkBlurStyle + 1];
humper@google.coma99a92c2013-02-20 16:42:06 +000062 SkString fName;
humper@google.coma99a92c2013-02-20 16:42:06 +000063 SkAlpha fAlpha;
reed@google.comdb87c962012-11-02 21:11:12 +000064public:
commit-bot@chromium.org7cced562014-01-10 23:10:13 +000065 BlurRectGM(const char name[], U8CPU alpha)
66 : fName(name)
67 , fAlpha(SkToU8(alpha)) {
reed@google.com57850b92012-12-17 21:20:53 +000068 }
reed@google.comdb87c962012-11-02 21:11:12 +000069
70protected:
commit-bot@chromium.org7cced562014-01-10 23:10:13 +000071 virtual void onOnceBeforeDraw() SK_OVERRIDE {
commit-bot@chromium.orge3964552014-04-28 16:25:35 +000072 for (int i = 0; i <= kLastEnum_SkBlurStyle; ++i) {
73 fMaskFilters[i].reset(SkBlurMaskFilter::Create((SkBlurStyle)i,
commit-bot@chromium.org7cced562014-01-10 23:10:13 +000074 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(STROKE_WIDTH/2)),
75 SkBlurMaskFilter::kHighQuality_BlurFlag));
76 }
77 }
78
reed@google.comdb87c962012-11-02 21:11:12 +000079 virtual SkString onShortName() {
reed@google.com53007a22012-11-26 14:39:50 +000080 return fName;
reed@google.comdb87c962012-11-02 21:11:12 +000081 }
82
83 virtual SkISize onISize() {
commit-bot@chromium.org7cced562014-01-10 23:10:13 +000084 return SkISize::Make(440, 820);
reed@google.comdb87c962012-11-02 21:11:12 +000085 }
86
87 virtual void onDraw(SkCanvas* canvas) {
88 canvas->translate(STROKE_WIDTH*3/2, STROKE_WIDTH*3/2);
89
commit-bot@chromium.org7cced562014-01-10 23:10:13 +000090 SkRect r = { 0, 0, 100, 50 };
91 SkScalar scales[] = { SK_Scalar1, 0.6f };
skia.committer@gmail.com8ccf5902012-11-27 02:01:19 +000092
commit-bot@chromium.org7cced562014-01-10 23:10:13 +000093 for (size_t s = 0; s < SK_ARRAY_COUNT(scales); ++s) {
94 canvas->save();
95 for (size_t f = 0; f < SK_ARRAY_COUNT(fMaskFilters); ++f) {
96 SkPaint paint;
97 paint.setMaskFilter(fMaskFilters[f]);
98 paint.setAlpha(fAlpha);
99
100 static const Proc procs[] = {
101 fill_rect, draw_donut, draw_donut_skewed
102 };
103
104 canvas->save();
105 canvas->scale(scales[s], scales[s]);
106 this->drawProcs(canvas, r, paint, false, procs, SK_ARRAY_COUNT(procs));
107 canvas->translate(r.width() * 4/3, 0);
108 this->drawProcs(canvas, r, paint, true, procs, SK_ARRAY_COUNT(procs));
109 canvas->restore();
110
111 canvas->translate(0, SK_ARRAY_COUNT(procs) * r.height() * 4/3 * scales[s]);
112 }
113 canvas->restore();
114 canvas->translate(2 * r.width() * 4/3 * scales[s], 0);
reed@google.com53007a22012-11-26 14:39:50 +0000115 }
reed@google.comdb87c962012-11-02 21:11:12 +0000116 }
117
118 virtual uint32_t onGetFlags() const { return kSkipPipe_Flag; }
119
120private:
121 void drawProcs(SkCanvas* canvas, const SkRect& r, const SkPaint& paint,
122 bool doClip, const Proc procs[], size_t procsCount) {
123 SkAutoCanvasRestore acr(canvas, true);
124 for (size_t i = 0; i < procsCount; ++i) {
125 if (doClip) {
126 SkRect clipRect(r);
127 clipRect.inset(STROKE_WIDTH/2, STROKE_WIDTH/2);
128 canvas->save();
129 canvas->clipRect(r);
130 }
131 procs[i](canvas, r, paint);
132 if (doClip) {
133 canvas->restore();
134 }
135 canvas->translate(0, r.height() * 4/3);
136 }
137 }
humper@google.coma99a92c2013-02-20 16:42:06 +0000138private:
reed@google.comdb87c962012-11-02 21:11:12 +0000139 typedef GM INHERITED;
140};
141
humper@google.com7c7292c2013-01-04 20:29:03 +0000142class BlurRectCompareGM : public skiagm::GM {
143 SkString fName;
144 unsigned int fRectWidth, fRectHeight;
reed@google.com140d7282013-01-07 20:25:04 +0000145 SkScalar fRadius;
commit-bot@chromium.orge3964552014-04-28 16:25:35 +0000146 SkBlurStyle fStyle;
humper@google.com7c7292c2013-01-04 20:29:03 +0000147public:
skia.committer@gmail.comb3ec29d2013-09-07 07:01:16 +0000148 BlurRectCompareGM(const char name[], unsigned int rectWidth,
149 unsigned int rectHeight, float radius,
commit-bot@chromium.orge3964552014-04-28 16:25:35 +0000150 SkBlurStyle style)
bsalomon@google.com33cdbde2013-01-11 20:54:44 +0000151 : fName(name)
152 , fRectWidth(rectWidth)
153 , fRectHeight(rectHeight)
154 , fRadius(radius)
robertphillips@google.comb7061172013-09-06 14:16:12 +0000155 , fStyle(style) {
156 }
skia.committer@gmail.comd454ec12013-02-21 07:15:03 +0000157 int width() const {
158 return fRectWidth;
humper@google.coma99a92c2013-02-20 16:42:06 +0000159 }
skia.committer@gmail.comd454ec12013-02-21 07:15:03 +0000160 int height() const {
161 return fRectHeight;
humper@google.coma99a92c2013-02-20 16:42:06 +0000162 }
skia.committer@gmail.comd454ec12013-02-21 07:15:03 +0000163 SkScalar radius() const {
164 return fRadius;
humper@google.coma99a92c2013-02-20 16:42:06 +0000165 }
commit-bot@chromium.orge3964552014-04-28 16:25:35 +0000166 SkBlurStyle style() const {
skia.committer@gmail.comd454ec12013-02-21 07:15:03 +0000167 return fStyle;
humper@google.coma99a92c2013-02-20 16:42:06 +0000168 }
humper@google.com7c7292c2013-01-04 20:29:03 +0000169
170protected:
171 virtual SkString onShortName() {
172 return fName;
173 }
174
175 virtual SkISize onISize() {
176 return SkISize::Make(640, 480);
177 }
skia.committer@gmail.com8ae714b2013-01-05 02:02:05 +0000178
humper@google.coma99a92c2013-02-20 16:42:06 +0000179 virtual bool makeMask(SkMask *m, const SkRect&) = 0;
humper@google.com7c7292c2013-01-04 20:29:03 +0000180
181 virtual void onDraw(SkCanvas* canvas) {
humper@google.coma99a92c2013-02-20 16:42:06 +0000182 SkRect r;
183 r.setWH(SkIntToScalar(fRectWidth), SkIntToScalar(fRectHeight));
humper@google.com7c7292c2013-01-04 20:29:03 +0000184
humper@google.coma99a92c2013-02-20 16:42:06 +0000185 SkISize canvas_size = canvas->getDeviceSize();
jvanverth@google.comd98df1a2013-02-20 19:02:34 +0000186 int center_x = (canvas_size.fWidth - (int)(r.width()))/2;
187 int center_y = (canvas_size.fHeight - (int)(r.height()))/2;
humper@google.com7c7292c2013-01-04 20:29:03 +0000188
humper@google.coma99a92c2013-02-20 16:42:06 +0000189 SkMask mask;
humper@google.com7c7292c2013-01-04 20:29:03 +0000190
humper@google.coma99a92c2013-02-20 16:42:06 +0000191 if (!this->makeMask(&mask, r)) {
192 SkPaint paint;
jvanverth@google.comd98df1a2013-02-20 19:02:34 +0000193 r.offset( SkIntToScalar(center_x), SkIntToScalar(center_y) );
humper@google.coma99a92c2013-02-20 16:42:06 +0000194 canvas->drawRect(r,paint);
195 return;
196 }
197 SkAutoMaskFreeImage amfi(mask.fImage);
198
199 SkBitmap bm;
commit-bot@chromium.orgdac52252014-02-17 21:21:46 +0000200 bm.installMaskPixels(mask);
humper@google.coma99a92c2013-02-20 16:42:06 +0000201
202 center_x = (canvas_size.fWidth - mask.fBounds.width())/2;
203 center_y = (canvas_size.fHeight - mask.fBounds.height())/2;
204
jvanverth@google.comd98df1a2013-02-20 19:02:34 +0000205 canvas->drawBitmap(bm, SkIntToScalar(center_x), SkIntToScalar(center_y), NULL);
humper@google.com7c7292c2013-01-04 20:29:03 +0000206 }
207
208 virtual uint32_t onGetFlags() const { return kSkipPipe_Flag; }
209
210private:
211 typedef GM INHERITED;
212};
213
214class BlurRectFastGM: public BlurRectCompareGM {
215public:
robertphillips@google.com7ce661d2013-08-27 16:14:03 +0000216 BlurRectFastGM(const char name[], unsigned int rectWidth,
217 unsigned int rectHeight, float blurRadius,
commit-bot@chromium.orge3964552014-04-28 16:25:35 +0000218 SkBlurStyle style) :
robertphillips@google.com7ce661d2013-08-27 16:14:03 +0000219 INHERITED(name, rectWidth, rectHeight, blurRadius, style) {
humper@google.coma99a92c2013-02-20 16:42:06 +0000220 }
robertphillips@google.com7ce661d2013-08-27 16:14:03 +0000221
humper@google.com7c7292c2013-01-04 20:29:03 +0000222protected:
humper@google.coma99a92c2013-02-20 16:42:06 +0000223 virtual bool makeMask(SkMask *m, const SkRect& r) SK_OVERRIDE {
robertphillips@google.comb7061172013-09-06 14:16:12 +0000224 return SkBlurMask::BlurRect(SkBlurMask::ConvertRadiusToSigma(this->radius()),
225 m, r, this->style());
reed@google.com140d7282013-01-07 20:25:04 +0000226 }
humper@google.coma99a92c2013-02-20 16:42:06 +0000227private:
228 typedef BlurRectCompareGM INHERITED;
humper@google.com7c7292c2013-01-04 20:29:03 +0000229};
230
231class BlurRectSlowGM: public BlurRectCompareGM {
232public:
robertphillips@google.comb7061172013-09-06 14:16:12 +0000233 BlurRectSlowGM(const char name[], unsigned int rectWidth, unsigned int rectHeight,
commit-bot@chromium.orge3964552014-04-28 16:25:35 +0000234 float blurRadius, SkBlurStyle style)
robertphillips@google.comb7061172013-09-06 14:16:12 +0000235 : INHERITED(name, rectWidth, rectHeight, blurRadius, style) {
humper@google.coma99a92c2013-02-20 16:42:06 +0000236 }
robertphillips@google.comb7061172013-09-06 14:16:12 +0000237
humper@google.com7c7292c2013-01-04 20:29:03 +0000238protected:
humper@google.coma99a92c2013-02-20 16:42:06 +0000239 virtual bool makeMask(SkMask *m, const SkRect& r) SK_OVERRIDE {
reed@google.com140d7282013-01-07 20:25:04 +0000240 SkMask src;
241 r.roundOut(&src.fBounds);
242 src.fBounds.offset(-src.fBounds.fLeft, -src.fBounds.fTop); // move to origin
243 src.fFormat = SkMask::kA8_Format;
244 src.fRowBytes = src.fBounds.width();
humper@google.coma99a92c2013-02-20 16:42:06 +0000245 src.fImage = SkMask::AllocImage(src.computeTotalImageSize());
bsalomon@google.com33cdbde2013-01-11 20:54:44 +0000246 SkAutoMaskFreeImage amfi(src.fImage);
humper@google.com7c7292c2013-01-04 20:29:03 +0000247
bsalomon@google.com33cdbde2013-01-11 20:54:44 +0000248 memset(src.fImage, 0xff, src.computeTotalImageSize());
humper@google.com7c7292c2013-01-04 20:29:03 +0000249
skia.committer@gmail.comb3ec29d2013-09-07 07:01:16 +0000250 return SkBlurMask::BoxBlur(m, src,
251 SkBlurMask::ConvertRadiusToSigma(this->radius()),
robertphillips@google.comb7061172013-09-06 14:16:12 +0000252 this->style(), this->getQuality());
reed@google.com140d7282013-01-07 20:25:04 +0000253 }
humper@google.coma99a92c2013-02-20 16:42:06 +0000254
commit-bot@chromium.orge3964552014-04-28 16:25:35 +0000255 virtual SkBlurQuality getQuality() {
256 return kHigh_SkBlurQuality;
humper@google.coma99a92c2013-02-20 16:42:06 +0000257 }
258private:
259 typedef BlurRectCompareGM INHERITED;
260};
261
262class BlurRectSlowLowGM: public BlurRectSlowGM {
263public:
skia.committer@gmail.comd454ec12013-02-21 07:15:03 +0000264 BlurRectSlowLowGM(const char name[], unsigned int rectWidth, unsigned int rectHeight,
commit-bot@chromium.orge3964552014-04-28 16:25:35 +0000265 float blurRadius, SkBlurStyle style)
robertphillips@google.comb7061172013-09-06 14:16:12 +0000266 : INHERITED(name, rectWidth, rectHeight, blurRadius, style) {
humper@google.coma99a92c2013-02-20 16:42:06 +0000267 }
robertphillips@google.comb7061172013-09-06 14:16:12 +0000268
humper@google.coma99a92c2013-02-20 16:42:06 +0000269protected:
commit-bot@chromium.orge3964552014-04-28 16:25:35 +0000270 virtual SkBlurQuality getQuality() SK_OVERRIDE {
271 return kLow_SkBlurQuality;
humper@google.coma99a92c2013-02-20 16:42:06 +0000272 }
273private:
274 typedef BlurRectSlowGM INHERITED;
275};
276
277class BlurRectGroundTruthGM: public BlurRectCompareGM {
278public:
skia.committer@gmail.comd454ec12013-02-21 07:15:03 +0000279 BlurRectGroundTruthGM(const char name[], unsigned int rectWidth, unsigned int rectHeight,
commit-bot@chromium.orge3964552014-04-28 16:25:35 +0000280 float blurRadius, SkBlurStyle style)
robertphillips@google.comb7061172013-09-06 14:16:12 +0000281 : INHERITED(name, rectWidth, rectHeight, blurRadius, style) {
humper@google.coma99a92c2013-02-20 16:42:06 +0000282 }
robertphillips@google.comb7061172013-09-06 14:16:12 +0000283
humper@google.coma99a92c2013-02-20 16:42:06 +0000284protected:
285 virtual bool makeMask(SkMask *m, const SkRect& r) SK_OVERRIDE {
286 SkMask src;
287 r.roundOut(&src.fBounds);
288 src.fBounds.offset(-src.fBounds.fLeft, -src.fBounds.fTop); // move to origin
289 src.fFormat = SkMask::kA8_Format;
290 src.fRowBytes = src.fBounds.width();
291 src.fImage = SkMask::AllocImage(src.computeTotalImageSize());
292 SkAutoMaskFreeImage amfi(src.fImage);
293
294 memset(src.fImage, 0xff, src.computeTotalImageSize());
295
robertphillips@google.comb7061172013-09-06 14:16:12 +0000296 return SkBlurMask::BlurGroundTruth(SkBlurMask::ConvertRadiusToSigma(this->radius()),
297 m, src, this->style());
humper@google.coma99a92c2013-02-20 16:42:06 +0000298 }
299
commit-bot@chromium.orge3964552014-04-28 16:25:35 +0000300 virtual SkBlurQuality getQuality() {
301 return kHigh_SkBlurQuality;
humper@google.coma99a92c2013-02-20 16:42:06 +0000302 }
303private:
304 typedef BlurRectCompareGM INHERITED;
humper@google.com7c7292c2013-01-04 20:29:03 +0000305};
306
307
reed@google.comdb87c962012-11-02 21:11:12 +0000308//////////////////////////////////////////////////////////////////////////////
309
commit-bot@chromium.org7cced562014-01-10 23:10:13 +0000310DEF_GM(return new BlurRectGM("blurrects", 0xFF);)
reed@google.com57850b92012-12-17 21:20:53 +0000311
commit-bot@chromium.org4b413c82013-11-25 19:44:07 +0000312static const SkScalar kBig = 20;
313static const SkScalar kSmall = 2;
robertphillips@google.comb7061172013-09-06 14:16:12 +0000314
humper@google.coma99a92c2013-02-20 16:42:06 +0000315// regular size rects, blurs should be small enough not to completely overlap.
reed@google.comdb87c962012-11-02 21:11:12 +0000316
commit-bot@chromium.orge3964552014-04-28 16:25:35 +0000317DEF_GM(return new BlurRectFastGM( "blurrect_25_100_2_normal_fast", 25, 100, kSmall, kNormal_SkBlurStyle);)
318DEF_GM(return new BlurRectFastGM("blurrect_25_100_20_normal_fast", 25, 100, kBig, kNormal_SkBlurStyle);)
319DEF_GM(return new BlurRectSlowGM( "blurrect_25_100_2_normal_slow", 25, 100, kSmall, kNormal_SkBlurStyle);)
320DEF_GM(return new BlurRectSlowGM("blurrect_25_100_20_normal_slow", 25, 100, kBig, kNormal_SkBlurStyle);)
321DEF_GM(return new BlurRectFastGM( "blurrect_25_100_2_inner_fast", 25, 100, kSmall, kInner_SkBlurStyle);)
322DEF_GM(return new BlurRectFastGM("blurrect_25_100_20_inner_fast", 25, 100, kBig, kInner_SkBlurStyle);)
323DEF_GM(return new BlurRectSlowGM( "blurrect_25_100_2_inner_slow", 25, 100, kSmall, kInner_SkBlurStyle);)
324DEF_GM(return new BlurRectSlowGM("blurrect_25_100_20_inner_slow", 25, 100, kBig, kInner_SkBlurStyle);)
325DEF_GM(return new BlurRectFastGM( "blurrect_25_100_2_outer_fast", 25, 100, kSmall, kOuter_SkBlurStyle);)
326DEF_GM(return new BlurRectFastGM("blurrect_25_100_20_outer_fast", 25, 100, kBig, kOuter_SkBlurStyle);)
327DEF_GM(return new BlurRectSlowGM( "blurrect_25_100_2_outer_slow", 25, 100, kSmall, kOuter_SkBlurStyle);)
328DEF_GM(return new BlurRectSlowGM("blurrect_25_100_20_outer_slow", 25, 100, kBig, kOuter_SkBlurStyle);)
humper@google.coma99a92c2013-02-20 16:42:06 +0000329
330// skinny tall rects, blurs overlap in X but not y
331
commit-bot@chromium.orge3964552014-04-28 16:25:35 +0000332DEF_GM(return new BlurRectFastGM( "blurrect_5_100_2_normal_fast", 5, 100, kSmall, kNormal_SkBlurStyle);)
333DEF_GM(return new BlurRectFastGM("blurrect_5_100_20_normal_fast", 5, 100, kBig, kNormal_SkBlurStyle);)
334DEF_GM(return new BlurRectSlowGM( "blurrect_5_100_2_normal_slow", 5, 100, kSmall, kNormal_SkBlurStyle);)
335DEF_GM(return new BlurRectSlowGM("blurrect_5_100_20_normal_slow", 5, 100, kBig, kNormal_SkBlurStyle);)
336DEF_GM(return new BlurRectFastGM( "blurrect_5_100_2_inner_fast", 5, 100, kSmall, kInner_SkBlurStyle);)
337DEF_GM(return new BlurRectFastGM("blurrect_5_100_20_inner_fast", 5, 100, kBig, kInner_SkBlurStyle);)
338DEF_GM(return new BlurRectSlowGM( "blurrect_5_100_2_inner_slow", 5, 100, kSmall, kInner_SkBlurStyle);)
339DEF_GM(return new BlurRectSlowGM("blurrect_5_100_20_inner_slow", 5, 100, kBig, kInner_SkBlurStyle);)
340DEF_GM(return new BlurRectFastGM( "blurrect_5_100_2_outer_fast", 5, 100, kSmall, kOuter_SkBlurStyle);)
341DEF_GM(return new BlurRectFastGM("blurrect_5_100_20_outer_fast", 5, 100, kBig, kOuter_SkBlurStyle);)
342DEF_GM(return new BlurRectSlowGM( "blurrect_5_100_2_outer_slow", 5, 100, kSmall, kOuter_SkBlurStyle);)
343DEF_GM(return new BlurRectSlowGM("blurrect_5_100_20_outer_slow", 5, 100, kBig, kOuter_SkBlurStyle);)
humper@google.coma99a92c2013-02-20 16:42:06 +0000344
345// tiny rects, blurs overlap in X and Y
346
commit-bot@chromium.orge3964552014-04-28 16:25:35 +0000347DEF_GM(return new BlurRectFastGM( "blurrect_5_5_2_normal_fast", 5, 5, kSmall, kNormal_SkBlurStyle);)
348DEF_GM(return new BlurRectFastGM("blurrect_5_5_20_normal_fast", 5, 5, kBig, kNormal_SkBlurStyle);)
349DEF_GM(return new BlurRectSlowGM( "blurrect_5_5_2_normal_slow", 5, 5, kSmall, kNormal_SkBlurStyle);)
350DEF_GM(return new BlurRectSlowGM("blurrect_5_5_20_normal_slow", 5, 5, kBig, kNormal_SkBlurStyle);)
351DEF_GM(return new BlurRectFastGM( "blurrect_5_5_2_inner_fast", 5, 5, kSmall, kInner_SkBlurStyle);)
352DEF_GM(return new BlurRectFastGM("blurrect_5_5_20_inner_fast", 5, 5, kBig, kInner_SkBlurStyle);)
353DEF_GM(return new BlurRectSlowGM( "blurrect_5_5_2_inner_slow", 5, 5, kSmall, kInner_SkBlurStyle);)
354DEF_GM(return new BlurRectSlowGM("blurrect_5_5_20_inner_slow", 5, 5, kBig, kInner_SkBlurStyle);)
355DEF_GM(return new BlurRectFastGM( "blurrect_5_5_2_outer_fast", 5, 5, kSmall, kOuter_SkBlurStyle);)
356DEF_GM(return new BlurRectFastGM("blurrect_5_5_20_outer_fast", 5, 5, kBig, kOuter_SkBlurStyle);)
357DEF_GM(return new BlurRectSlowGM( "blurrect_5_5_2_outer_slow", 5, 5, kSmall, kOuter_SkBlurStyle);)
358DEF_GM(return new BlurRectSlowGM("blurrect_5_5_20_outer_slow", 5, 5, kBig, kOuter_SkBlurStyle);)
humper@google.coma99a92c2013-02-20 16:42:06 +0000359
360
361#if 0
362// dont' need to GM the gaussian convolution; it's slow and intended
363// as a ground truth comparison only. Leaving these here in case we
364// ever want to turn these back on for debugging reasons.
365DEF_GM(return new BlurRectGroundTruthGM( "blurrect_25_100_1_simple", 25, 100, 1);)
366DEF_GM(return new BlurRectGroundTruthGM( "blurrect_25_100_2_simple", 25, 100, 2);)
367DEF_GM(return new BlurRectGroundTruthGM( "blurrect_25_100_3_simple", 25, 100, 3);)
368DEF_GM(return new BlurRectGroundTruthGM( "blurrect_25_100_4_simple", 25, 100, 4);)
369DEF_GM(return new BlurRectGroundTruthGM( "blurrect_25_100_5_simple", 25, 100, 5);)
370DEF_GM(return new BlurRectGroundTruthGM( "blurrect_25_100_6_simple", 25, 100, 6);)
371DEF_GM(return new BlurRectGroundTruthGM( "blurrect_25_100_7_simple", 25, 100, 7);)
372DEF_GM(return new BlurRectGroundTruthGM( "blurrect_25_100_8_simple", 25, 100, 8);)
373DEF_GM(return new BlurRectGroundTruthGM( "blurrect_25_100_9_simple", 25, 100, 9);)
374DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_10_simple", 25, 100, 10);)
375DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_11_simple", 25, 100, 11);)
376DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_12_simple", 25, 100, 12);)
377DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_13_simple", 25, 100, 13);)
378DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_14_simple", 25, 100, 14);)
379DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_15_simple", 25, 100, 15);)
380DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_16_simple", 25, 100, 16);)
381DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_17_simple", 25, 100, 17);)
382DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_18_simple", 25, 100, 18);)
383DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_19_simple", 25, 100, 19);)
384#endif