blob: d6c1c97df9c81ba4177117a02f3a6f72d6718b97 [file] [log] [blame]
reed@google.com35a81df2012-05-04 21:49:27 +00001/*
2 * 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 */
7
8#include "gm.h"
9#include "SkCanvas.h"
10#include "SkPaint.h"
11#include "SkDashPathEffect.h"
12
reed@google.comde1837b2012-05-21 16:47:43 +000013static void drawline(SkCanvas* canvas, int on, int off, const SkPaint& paint,
commit-bot@chromium.org628ed0b2014-05-19 14:32:49 +000014 SkScalar finalX = SkIntToScalar(600), SkScalar finalY = SkIntToScalar(0),
robertphillips9f2251c2014-11-04 13:33:50 -080015 SkScalar phase = SkIntToScalar(0),
16 SkScalar startX = SkIntToScalar(0), SkScalar startY = SkIntToScalar(0)) {
reed@google.com35a81df2012-05-04 21:49:27 +000017 SkPaint p(paint);
18
19 const SkScalar intervals[] = {
20 SkIntToScalar(on),
21 SkIntToScalar(off),
22 };
23
commit-bot@chromium.org628ed0b2014-05-19 14:32:49 +000024 p.setPathEffect(SkDashPathEffect::Create(intervals, 2, phase))->unref();
robertphillips9f2251c2014-11-04 13:33:50 -080025 canvas->drawLine(startX, startY, finalX, finalY, p);
reed@google.comde1837b2012-05-21 16:47:43 +000026}
27
28// earlier bug stopped us from drawing very long single-segment dashes, because
29// SkPathMeasure was skipping very small delta-T values (nearlyzero). This is
30// now fixes, so this giant dash should appear.
31static void show_giant_dash(SkCanvas* canvas) {
32 SkPaint paint;
33
34 drawline(canvas, 1, 1, paint, SkIntToScalar(20 * 1000));
reed@google.com35a81df2012-05-04 21:49:27 +000035}
36
reed@google.com21384df2012-05-18 17:59:08 +000037class DashingGM : public skiagm::GM {
reed@google.com35a81df2012-05-04 21:49:27 +000038public:
39 DashingGM() {}
40
41protected:
commit-bot@chromium.orga90c6802014-04-30 13:20:45 +000042 virtual uint32_t onGetFlags() const SK_OVERRIDE {
43 return kSkipTiled_Flag;
44 }
45
reed@google.com35a81df2012-05-04 21:49:27 +000046 SkString onShortName() {
47 return SkString("dashing");
48 }
49
tfarinaf5393182014-06-09 23:59:03 -070050 SkISize onISize() { return SkISize::Make(640, 300); }
reed@google.com35a81df2012-05-04 21:49:27 +000051
52 virtual void onDraw(SkCanvas* canvas) {
53 static const struct {
54 int fOnInterval;
55 int fOffInterval;
56 } gData[] = {
57 { 1, 1 },
58 { 4, 1 },
59 };
rmistry@google.comae933ce2012-08-23 18:19:56 +000060
reed@google.com35a81df2012-05-04 21:49:27 +000061 SkPaint paint;
62 paint.setStyle(SkPaint::kStroke_Style);
63
64 canvas->translate(SkIntToScalar(20), SkIntToScalar(20));
65 canvas->translate(0, SK_ScalarHalf);
reed@google.com35a81df2012-05-04 21:49:27 +000066 for (int width = 0; width <= 2; ++width) {
67 for (size_t data = 0; data < SK_ARRAY_COUNT(gData); ++data) {
68 for (int aa = 0; aa <= 1; ++aa) {
69 int w = width * width * width;
70 paint.setAntiAlias(SkToBool(aa));
71 paint.setStrokeWidth(SkIntToScalar(w));
rmistry@google.comae933ce2012-08-23 18:19:56 +000072
reed@google.com35a81df2012-05-04 21:49:27 +000073 int scale = w ? w : 1;
74
75 drawline(canvas, gData[data].fOnInterval * scale,
76 gData[data].fOffInterval * scale,
77 paint);
78 canvas->translate(0, SkIntToScalar(20));
79 }
80 }
81 }
rmistry@google.comae933ce2012-08-23 18:19:56 +000082
reed@google.comde1837b2012-05-21 16:47:43 +000083 show_giant_dash(canvas);
reed@google.com35a81df2012-05-04 21:49:27 +000084 }
reed@google.com21384df2012-05-18 17:59:08 +000085};
reed@google.com35a81df2012-05-04 21:49:27 +000086
reed@google.com21384df2012-05-18 17:59:08 +000087///////////////////////////////////////////////////////////////////////////////
88
89static void make_unit_star(SkPath* path, int n) {
90 SkScalar rad = -SK_ScalarPI / 2;
91 const SkScalar drad = (n >> 1) * SK_ScalarPI * 2 / n;
rmistry@google.comae933ce2012-08-23 18:19:56 +000092
reed@google.com21384df2012-05-18 17:59:08 +000093 path->moveTo(0, -SK_Scalar1);
94 for (int i = 1; i < n; i++) {
95 rad += drad;
96 SkScalar cosV, sinV = SkScalarSinCos(rad, &cosV);
97 path->lineTo(cosV, sinV);
98 }
99 path->close();
100}
101
102static void make_path_line(SkPath* path, const SkRect& bounds) {
103 path->moveTo(bounds.left(), bounds.top());
104 path->lineTo(bounds.right(), bounds.bottom());
105}
106
107static void make_path_rect(SkPath* path, const SkRect& bounds) {
108 path->addRect(bounds);
109}
110
111static void make_path_oval(SkPath* path, const SkRect& bounds) {
112 path->addOval(bounds);
113}
114
115static void make_path_star(SkPath* path, const SkRect& bounds) {
116 make_unit_star(path, 5);
117 SkMatrix matrix;
118 matrix.setRectToRect(path->getBounds(), bounds, SkMatrix::kCenter_ScaleToFit);
119 path->transform(matrix);
120}
121
122class Dashing2GM : public skiagm::GM {
123public:
124 Dashing2GM() {}
rmistry@google.comae933ce2012-08-23 18:19:56 +0000125
reed@google.com21384df2012-05-18 17:59:08 +0000126protected:
commit-bot@chromium.orga90c6802014-04-30 13:20:45 +0000127 virtual uint32_t onGetFlags() const SK_OVERRIDE {
128 return kSkipTiled_Flag;
129 }
130
reed@google.com21384df2012-05-18 17:59:08 +0000131 SkString onShortName() {
132 return SkString("dashing2");
133 }
rmistry@google.comae933ce2012-08-23 18:19:56 +0000134
tfarinaf5393182014-06-09 23:59:03 -0700135 SkISize onISize() { return SkISize::Make(640, 480); }
rmistry@google.comae933ce2012-08-23 18:19:56 +0000136
reed@google.com21384df2012-05-18 17:59:08 +0000137 virtual void onDraw(SkCanvas* canvas) {
138 static const int gIntervals[] = {
139 3, // 3 dashes: each count [0] followed by intervals [1..count]
140 2, 10, 10,
141 4, 20, 5, 5, 5,
142 2, 2, 2
143 };
144
145 void (*gProc[])(SkPath*, const SkRect&) = {
146 make_path_line, make_path_rect, make_path_oval, make_path_star,
147 };
rmistry@google.comae933ce2012-08-23 18:19:56 +0000148
reed@google.com21384df2012-05-18 17:59:08 +0000149 SkPaint paint;
150 paint.setAntiAlias(true);
151 paint.setStyle(SkPaint::kStroke_Style);
152 paint.setStrokeWidth(SkIntToScalar(6));
rmistry@google.comae933ce2012-08-23 18:19:56 +0000153
reed@google.com21384df2012-05-18 17:59:08 +0000154 SkRect bounds = SkRect::MakeWH(SkIntToScalar(120), SkIntToScalar(120));
155 bounds.offset(SkIntToScalar(20), SkIntToScalar(20));
156 SkScalar dx = bounds.width() * 4 / 3;
157 SkScalar dy = bounds.height() * 4 / 3;
158
159 const int* intervals = &gIntervals[1];
160 for (int y = 0; y < gIntervals[0]; ++y) {
161 SkScalar vals[SK_ARRAY_COUNT(gIntervals)]; // more than enough
162 int count = *intervals++;
163 for (int i = 0; i < count; ++i) {
164 vals[i] = SkIntToScalar(*intervals++);
165 }
166 SkScalar phase = vals[0] / 2;
commit-bot@chromium.org0a2bf902014-02-20 20:40:19 +0000167 paint.setPathEffect(SkDashPathEffect::Create(vals, count, phase))->unref();
rmistry@google.comae933ce2012-08-23 18:19:56 +0000168
reed@google.com21384df2012-05-18 17:59:08 +0000169 for (size_t x = 0; x < SK_ARRAY_COUNT(gProc); ++x) {
170 SkPath path;
171 SkRect r = bounds;
172 r.offset(x * dx, y * dy);
173 gProc[x](&path, r);
rmistry@google.comae933ce2012-08-23 18:19:56 +0000174
reed@google.com21384df2012-05-18 17:59:08 +0000175 canvas->drawPath(path, paint);
176 }
177 }
178 }
reed@google.com35a81df2012-05-04 21:49:27 +0000179};
180
181//////////////////////////////////////////////////////////////////////////////
182
robertphillips@google.com629ab542012-11-28 17:18:11 +0000183// Test out the on/off line dashing Chrome if fond of
184class Dashing3GM : public skiagm::GM {
185public:
186 Dashing3GM() {}
187
188protected:
commit-bot@chromium.orga90c6802014-04-30 13:20:45 +0000189 virtual uint32_t onGetFlags() const SK_OVERRIDE {
190 return kSkipTiled_Flag;
191 }
192
robertphillips@google.com629ab542012-11-28 17:18:11 +0000193 SkString onShortName() {
194 return SkString("dashing3");
195 }
196
tfarinaf5393182014-06-09 23:59:03 -0700197 SkISize onISize() { return SkISize::Make(640, 480); }
robertphillips@google.com629ab542012-11-28 17:18:11 +0000198
199 // Draw a 100x100 block of dashed lines. The horizontal ones are BW
200 // while the vertical ones are AA.
skia.committer@gmail.com73b140a2012-12-05 02:01:21 +0000201 void drawDashedLines(SkCanvas* canvas,
202 SkScalar lineLength,
robertphillips@google.com8c685c52012-12-04 20:34:11 +0000203 SkScalar phase,
204 SkScalar dashLength,
205 int strokeWidth,
206 bool circles) {
robertphillips@google.com629ab542012-11-28 17:18:11 +0000207 SkPaint p;
208 p.setColor(SK_ColorBLACK);
209 p.setStyle(SkPaint::kStroke_Style);
robertphillips@google.com8c685c52012-12-04 20:34:11 +0000210 p.setStrokeWidth(SkIntToScalar(strokeWidth));
robertphillips@google.com629ab542012-11-28 17:18:11 +0000211
robertphillips@google.com8c685c52012-12-04 20:34:11 +0000212 if (circles) {
213 p.setStrokeCap(SkPaint::kRound_Cap);
214 }
215
216 SkScalar intervals[2] = { dashLength, dashLength };
robertphillips@google.com629ab542012-11-28 17:18:11 +0000217
commit-bot@chromium.org35c03fb2014-03-31 18:52:51 +0000218 p.setPathEffect(SkDashPathEffect::Create(intervals, 2, phase))->unref();
robertphillips@google.com629ab542012-11-28 17:18:11 +0000219
220 SkPoint pts[2];
221
robertphillips@google.com8c685c52012-12-04 20:34:11 +0000222 for (int y = 0; y < 100; y += 10*strokeWidth) {
robertphillips@google.com629ab542012-11-28 17:18:11 +0000223 pts[0].set(0, SkIntToScalar(y));
robertphillips@google.com8c685c52012-12-04 20:34:11 +0000224 pts[1].set(lineLength, SkIntToScalar(y));
robertphillips@google.com629ab542012-11-28 17:18:11 +0000225
226 canvas->drawPoints(SkCanvas::kLines_PointMode, 2, pts, p);
227 }
228
229 p.setAntiAlias(true);
230
robertphillips@google.com8c685c52012-12-04 20:34:11 +0000231 for (int x = 0; x < 100; x += 14*strokeWidth) {
robertphillips@google.com629ab542012-11-28 17:18:11 +0000232 pts[0].set(SkIntToScalar(x), 0);
robertphillips@google.com8c685c52012-12-04 20:34:11 +0000233 pts[1].set(SkIntToScalar(x), lineLength);
robertphillips@google.com629ab542012-11-28 17:18:11 +0000234
235 canvas->drawPoints(SkCanvas::kLines_PointMode, 2, pts, p);
236 }
237 }
238
239 virtual void onDraw(SkCanvas* canvas) {
robertphillips@google.com8c685c52012-12-04 20:34:11 +0000240 // 1on/1off 1x1 squares with phase of 0 - points fastpath
robertphillips@google.com629ab542012-11-28 17:18:11 +0000241 canvas->save();
robertphillips@google.com8c685c52012-12-04 20:34:11 +0000242 canvas->translate(2, 0);
243 this->drawDashedLines(canvas, 100, 0, SK_Scalar1, 1, false);
robertphillips@google.com629ab542012-11-28 17:18:11 +0000244 canvas->restore();
245
robertphillips@google.com8c685c52012-12-04 20:34:11 +0000246 // 1on/1off 1x1 squares with phase of .5 - rects fastpath (due to partial squares)
robertphillips@google.com629ab542012-11-28 17:18:11 +0000247 canvas->save();
robertphillips@google.com8c685c52012-12-04 20:34:11 +0000248 canvas->translate(112, 0);
249 this->drawDashedLines(canvas, 100, SK_ScalarHalf, SK_Scalar1, 1, false);
robertphillips@google.com629ab542012-11-28 17:18:11 +0000250 canvas->restore();
251
robertphillips@google.com8c685c52012-12-04 20:34:11 +0000252 // 1on/1off 1x1 squares with phase of 1 - points fastpath
robertphillips@google.com629ab542012-11-28 17:18:11 +0000253 canvas->save();
robertphillips@google.com8c685c52012-12-04 20:34:11 +0000254 canvas->translate(222, 0);
255 this->drawDashedLines(canvas, 100, SK_Scalar1, SK_Scalar1, 1, false);
robertphillips@google.com629ab542012-11-28 17:18:11 +0000256 canvas->restore();
257
robertphillips@google.com8c685c52012-12-04 20:34:11 +0000258 // 1on/1off 1x1 squares with phase of 1 and non-integer length - rects fastpath
robertphillips@google.com629ab542012-11-28 17:18:11 +0000259 canvas->save();
robertphillips@google.com8c685c52012-12-04 20:34:11 +0000260 canvas->translate(332, 0);
reed@google.com140d7282013-01-07 20:25:04 +0000261 this->drawDashedLines(canvas, 99.5f, SK_ScalarHalf, SK_Scalar1, 1, false);
robertphillips@google.com8c685c52012-12-04 20:34:11 +0000262 canvas->restore();
263
robertphillips@google.com5c4d5582013-01-15 12:53:31 +0000264 // 255on/255off 1x1 squares with phase of 0 - rects fast path
265 canvas->save();
266 canvas->translate(446, 0);
267 this->drawDashedLines(canvas, 100, 0, SkIntToScalar(255), 1, false);
268 canvas->restore();
269
robertphillips@google.com8c685c52012-12-04 20:34:11 +0000270 // 1on/1off 3x3 squares with phase of 0 - points fast path
271 canvas->save();
272 canvas->translate(2, 110);
273 this->drawDashedLines(canvas, 100, 0, SkIntToScalar(3), 3, false);
274 canvas->restore();
275
276 // 1on/1off 3x3 squares with phase of 1.5 - rects fast path
277 canvas->save();
278 canvas->translate(112, 110);
commit-bot@chromium.org4b413c82013-11-25 19:44:07 +0000279 this->drawDashedLines(canvas, 100, 1.5f, SkIntToScalar(3), 3, false);
robertphillips@google.com8c685c52012-12-04 20:34:11 +0000280 canvas->restore();
281
282 // 1on/1off 1x1 circles with phase of 1 - no fast path yet
283 canvas->save();
284 canvas->translate(2, 220);
285 this->drawDashedLines(canvas, 100, SK_Scalar1, SK_Scalar1, 1, true);
286 canvas->restore();
287
288 // 1on/1off 3x3 circles with phase of 1 - no fast path yet
289 canvas->save();
290 canvas->translate(112, 220);
291 this->drawDashedLines(canvas, 100, 0, SkIntToScalar(3), 3, true);
292 canvas->restore();
293
294 // 1on/1off 1x1 squares with rotation - should break fast path
295 canvas->save();
296 canvas->translate(332+SK_ScalarRoot2Over2*100, 110+SK_ScalarRoot2Over2*100);
robertphillips@google.com629ab542012-11-28 17:18:11 +0000297 canvas->rotate(45);
298 canvas->translate(-50, -50);
299
robertphillips@google.com8c685c52012-12-04 20:34:11 +0000300 this->drawDashedLines(canvas, 100, SK_Scalar1, SK_Scalar1, 1, false);
robertphillips@google.com629ab542012-11-28 17:18:11 +0000301 canvas->restore();
302
robertphillips@google.com8c685c52012-12-04 20:34:11 +0000303 // 3on/3off 3x1 rects - should use rect fast path regardless of phase
304 for (int phase = 0; phase <= 3; ++phase) {
305 canvas->save();
skia.committer@gmail.com73b140a2012-12-05 02:01:21 +0000306 canvas->translate(SkIntToScalar(phase*110+2),
robertphillips@google.com8c685c52012-12-04 20:34:11 +0000307 SkIntToScalar(330));
308 this->drawDashedLines(canvas, 100, SkIntToScalar(phase), SkIntToScalar(3), 1, false);
309 canvas->restore();
310 }
robertphillips@google.com629ab542012-11-28 17:18:11 +0000311 }
312
313};
314
315//////////////////////////////////////////////////////////////////////////////
316
commit-bot@chromium.org628ed0b2014-05-19 14:32:49 +0000317class Dashing4GM : public skiagm::GM {
318public:
319 Dashing4GM() {}
320
321protected:
322 virtual uint32_t onGetFlags() const SK_OVERRIDE {
323 return kSkipTiled_Flag;
324 }
325
326 SkString onShortName() {
327 return SkString("dashing4");
328 }
329
tfarinaf5393182014-06-09 23:59:03 -0700330 SkISize onISize() { return SkISize::Make(640, 950); }
commit-bot@chromium.org628ed0b2014-05-19 14:32:49 +0000331
332 virtual void onDraw(SkCanvas* canvas) {
333 static const struct {
334 int fOnInterval;
335 int fOffInterval;
336 } gData[] = {
337 { 1, 1 },
338 { 4, 2 },
339 { 0, 4 }, // test for zero length on interval
340 };
341
342 SkPaint paint;
343 paint.setStyle(SkPaint::kStroke_Style);
344
345 canvas->translate(SkIntToScalar(20), SkIntToScalar(20));
346 canvas->translate(0, SK_ScalarHalf);
347
348 for (int width = 0; width <= 2; ++width) {
349 for (size_t data = 0; data < SK_ARRAY_COUNT(gData); ++data) {
350 for (int aa = 0; aa <= 1; ++aa) {
351 for (int cap = 0; cap <= 1; ++cap) {
352 int w = width * width * width;
353 paint.setAntiAlias(SkToBool(aa));
354 paint.setStrokeWidth(SkIntToScalar(w));
355
356 SkToBool(cap) ? paint.setStrokeCap(SkPaint::kSquare_Cap)
357 : paint.setStrokeCap(SkPaint::kRound_Cap);
358
359 int scale = w ? w : 1;
360
361 drawline(canvas, gData[data].fOnInterval * scale,
362 gData[data].fOffInterval * scale,
363 paint);
364 canvas->translate(0, SkIntToScalar(20));
365 }
366 }
367 }
368 }
369
370 for (int aa = 0; aa <= 1; ++aa) {
371 paint.setAntiAlias(SkToBool(aa));
372 paint.setStrokeWidth(8.f);
373 paint.setStrokeCap(SkPaint::kSquare_Cap);
commit-bot@chromium.org628ed0b2014-05-19 14:32:49 +0000374 // Single dash element that is cut off at start and end
commit-bot@chromium.org71db8822014-05-19 14:59:04 +0000375 drawline(canvas, 32, 16, paint, 20.f, 0, 5.f);
commit-bot@chromium.org628ed0b2014-05-19 14:32:49 +0000376 canvas->translate(0, SkIntToScalar(20));
377
378 // Two dash elements where each one is cut off at beginning and end respectively
commit-bot@chromium.org71db8822014-05-19 14:59:04 +0000379 drawline(canvas, 32, 16, paint, 56.f, 0, 5.f);
commit-bot@chromium.org628ed0b2014-05-19 14:32:49 +0000380 canvas->translate(0, SkIntToScalar(20));
381
382 // Many dash elements where first and last are cut off at beginning and end respectively
commit-bot@chromium.org71db8822014-05-19 14:59:04 +0000383 drawline(canvas, 32, 16, paint, 584.f, 0, 5.f);
commit-bot@chromium.org628ed0b2014-05-19 14:32:49 +0000384 canvas->translate(0, SkIntToScalar(20));
385
386 // Diagonal dash line where src pnts are not axis aligned (as apposed to being diagonal from
387 // a canvas rotation)
commit-bot@chromium.org71db8822014-05-19 14:59:04 +0000388 drawline(canvas, 32, 16, paint, 600.f, 30.f);
commit-bot@chromium.org628ed0b2014-05-19 14:32:49 +0000389 canvas->translate(0, SkIntToScalar(20));
390
391 // Case where only the off interval exists on the line. Thus nothing should be drawn
commit-bot@chromium.org71db8822014-05-19 14:59:04 +0000392 drawline(canvas, 32, 16, paint, 8.f, 0.f, 40.f);
commit-bot@chromium.org628ed0b2014-05-19 14:32:49 +0000393 canvas->translate(0, SkIntToScalar(20));
394 }
395 }
396};
397
398//////////////////////////////////////////////////////////////////////////////
399
robertphillips9f2251c2014-11-04 13:33:50 -0800400class Dashing5GM : public skiagm::GM {
401public:
402 Dashing5GM(bool doAA) : fDoAA(doAA) {}
reed@google.com35a81df2012-05-04 21:49:27 +0000403
robertphillips9f2251c2014-11-04 13:33:50 -0800404protected:
405 virtual uint32_t onGetFlags() const SK_OVERRIDE { return kAsBench_Flag | kSkipTiled_Flag; }
406
407 virtual SkString onShortName() SK_OVERRIDE {
408 if (fDoAA) {
409 return SkString("dashing5_aa");
410 } else {
411 return SkString("dashing5_bw");
412 }
413 }
414
415 virtual SkISize onISize() SK_OVERRIDE { return SkISize::Make(400, 200); }
416
417 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
418 static const int kOn = 4;
419 static const int kOff = 4;
420 static const int kIntervalLength = kOn + kOff;
421
422 static const SkColor gColors[kIntervalLength] = {
423 SK_ColorRED,
424 SK_ColorGREEN,
425 SK_ColorBLUE,
426 SK_ColorCYAN,
427 SK_ColorMAGENTA,
428 SK_ColorYELLOW,
429 SK_ColorGRAY,
430 SK_ColorDKGRAY
431 };
432
433 SkPaint paint;
434 paint.setStyle(SkPaint::kStroke_Style);
435
436 paint.setAntiAlias(fDoAA);
437
438 SkMatrix rot;
439 rot.setRotate(90);
440 SkASSERT(rot.rectStaysRect());
441
442 canvas->concat(rot);
443
444 int sign; // used to toggle the direction of the lines
445 int phase = 0;
446
447 for (int x = 0; x < 200; x += 10) {
448 paint.setStrokeWidth(SkIntToScalar(phase+1));
449 paint.setColor(gColors[phase]);
450 sign = (x % 20) ? 1 : -1;
451 drawline(canvas, kOn, kOff, paint,
452 SkIntToScalar(x), -sign * SkIntToScalar(10003),
453 SkIntToScalar(phase),
454 SkIntToScalar(x), sign * SkIntToScalar(10003));
455 phase = (phase + 1) % kIntervalLength;
456 }
457
458 for (int y = -400; y < 0; y += 10) {
459 paint.setStrokeWidth(SkIntToScalar(phase+1));
460 paint.setColor(gColors[phase]);
461 sign = (y % 20) ? 1 : -1;
462 drawline(canvas, kOn, kOff, paint,
463 -sign * SkIntToScalar(10003), SkIntToScalar(y),
464 SkIntToScalar(phase),
465 sign * SkIntToScalar(10003), SkIntToScalar(y));
466 phase = (phase + 1) % kIntervalLength;
467 }
468 }
469
470private:
471 bool fDoAA;
472};
473
474//////////////////////////////////////////////////////////////////////////////
475
476DEF_GM(return SkNEW(DashingGM);)
477DEF_GM(return SkNEW(Dashing2GM);)
478DEF_GM(return SkNEW(Dashing3GM);)
479DEF_GM(return SkNEW(Dashing4GM);)
480DEF_GM(return SkNEW_ARGS(Dashing5GM, (true));)
481DEF_GM(return SkNEW_ARGS(Dashing5GM, (false));)
482