1 /*
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/gm.h"
9 #include "include/core/SkCanvas.h"
10 #include "include/core/SkColor.h"
11 #include "include/core/SkFont.h"
12 #include "include/core/SkMatrix.h"
13 #include "include/core/SkPaint.h"
14 #include "include/core/SkPath.h"
15 #include "include/core/SkPathEffect.h"
16 #include "include/core/SkPoint.h"
17 #include "include/core/SkRect.h"
18 #include "include/core/SkScalar.h"
19 #include "include/core/SkSize.h"
20 #include "include/core/SkString.h"
21 #include "include/core/SkTypeface.h"
22 #include "include/core/SkTypes.h"
23 #include "include/effects/SkDashPathEffect.h"
24 #include "tools/ToolUtils.h"
25
26 #include <math.h>
27 #include <initializer_list>
28
drawline(SkCanvas * canvas,int on,int off,const SkPaint & paint,SkScalar finalX=SkIntToScalar (600),SkScalar finalY=SkIntToScalar (0),SkScalar phase=SkIntToScalar (0),SkScalar startX=SkIntToScalar (0),SkScalar startY=SkIntToScalar (0))29 static void drawline(SkCanvas* canvas, int on, int off, const SkPaint& paint,
30 SkScalar finalX = SkIntToScalar(600), SkScalar finalY = SkIntToScalar(0),
31 SkScalar phase = SkIntToScalar(0),
32 SkScalar startX = SkIntToScalar(0), SkScalar startY = SkIntToScalar(0)) {
33 SkPaint p(paint);
34
35 const SkScalar intervals[] = {
36 SkIntToScalar(on),
37 SkIntToScalar(off),
38 };
39
40 p.setPathEffect(SkDashPathEffect::Make(intervals, 2, phase));
41 canvas->drawLine(startX, startY, finalX, finalY, p);
42 }
43
44 // earlier bug stopped us from drawing very long single-segment dashes, because
45 // SkPathMeasure was skipping very small delta-T values (nearlyzero). This is
46 // now fixes, so this giant dash should appear.
show_giant_dash(SkCanvas * canvas)47 static void show_giant_dash(SkCanvas* canvas) {
48 SkPaint paint;
49
50 drawline(canvas, 1, 1, paint, SkIntToScalar(20 * 1000));
51 }
52
show_zero_len_dash(SkCanvas * canvas)53 static void show_zero_len_dash(SkCanvas* canvas) {
54 SkPaint paint;
55
56 drawline(canvas, 2, 2, paint, SkIntToScalar(0));
57 paint.setStyle(SkPaint::kStroke_Style);
58 paint.setStrokeWidth(SkIntToScalar(2));
59 canvas->translate(0, SkIntToScalar(20));
60 drawline(canvas, 4, 4, paint, SkIntToScalar(0));
61 }
62
63 class DashingGM : public skiagm::GM {
onShortName()64 SkString onShortName() override { return SkString("dashing"); }
65
onISize()66 SkISize onISize() override { return {640, 340}; }
67
onDraw(SkCanvas * canvas)68 void onDraw(SkCanvas* canvas) override {
69 constexpr struct {
70 int fOnInterval;
71 int fOffInterval;
72 } gData[] = {
73 { 1, 1 },
74 { 4, 1 },
75 };
76
77 SkPaint paint;
78 paint.setStyle(SkPaint::kStroke_Style);
79
80 canvas->translate(SkIntToScalar(20), SkIntToScalar(20));
81 canvas->translate(0, SK_ScalarHalf);
82 for (int width = 0; width <= 2; ++width) {
83 for (size_t data = 0; data < SK_ARRAY_COUNT(gData); ++data) {
84 for (int aa = 0; aa <= 1; ++aa) {
85 int w = width * width * width;
86 paint.setAntiAlias(SkToBool(aa));
87 paint.setStrokeWidth(SkIntToScalar(w));
88
89 int scale = w ? w : 1;
90
91 drawline(canvas, gData[data].fOnInterval * scale,
92 gData[data].fOffInterval * scale,
93 paint);
94 canvas->translate(0, SkIntToScalar(20));
95 }
96 }
97 }
98
99 show_giant_dash(canvas);
100 canvas->translate(0, SkIntToScalar(20));
101 show_zero_len_dash(canvas);
102 canvas->translate(0, SkIntToScalar(20));
103 // Draw 0 on, 0 off dashed line
104 paint.setStrokeWidth(SkIntToScalar(8));
105 drawline(canvas, 0, 0, paint);
106 }
107 };
108
109 ///////////////////////////////////////////////////////////////////////////////
110
make_unit_star(SkPath * path,int n)111 static void make_unit_star(SkPath* path, int n) {
112 SkScalar rad = -SK_ScalarPI / 2;
113 const SkScalar drad = (n >> 1) * SK_ScalarPI * 2 / n;
114
115 path->moveTo(0, -SK_Scalar1);
116 for (int i = 1; i < n; i++) {
117 rad += drad;
118 path->lineTo(SkScalarCos(rad), SkScalarSin(rad));
119 }
120 path->close();
121 }
122
make_path_line(SkPath * path,const SkRect & bounds)123 static void make_path_line(SkPath* path, const SkRect& bounds) {
124 path->moveTo(bounds.left(), bounds.top());
125 path->lineTo(bounds.right(), bounds.bottom());
126 }
127
make_path_rect(SkPath * path,const SkRect & bounds)128 static void make_path_rect(SkPath* path, const SkRect& bounds) {
129 path->addRect(bounds);
130 }
131
make_path_oval(SkPath * path,const SkRect & bounds)132 static void make_path_oval(SkPath* path, const SkRect& bounds) {
133 path->addOval(bounds);
134 }
135
make_path_star(SkPath * path,const SkRect & bounds)136 static void make_path_star(SkPath* path, const SkRect& bounds) {
137 make_unit_star(path, 5);
138 SkMatrix matrix;
139 matrix.setRectToRect(path->getBounds(), bounds, SkMatrix::kCenter_ScaleToFit);
140 path->transform(matrix);
141 }
142
143 class Dashing2GM : public skiagm::GM {
onShortName()144 SkString onShortName() override { return SkString("dashing2"); }
145
onISize()146 SkISize onISize() override { return {640, 480}; }
147
onDraw(SkCanvas * canvas)148 void onDraw(SkCanvas* canvas) override {
149 constexpr int gIntervals[] = {
150 3, // 3 dashes: each count [0] followed by intervals [1..count]
151 2, 10, 10,
152 4, 20, 5, 5, 5,
153 2, 2, 2
154 };
155
156 void (*gProc[])(SkPath*, const SkRect&) = {
157 make_path_line, make_path_rect, make_path_oval, make_path_star,
158 };
159
160 SkPaint paint;
161 paint.setAntiAlias(true);
162 paint.setStyle(SkPaint::kStroke_Style);
163 paint.setStrokeWidth(SkIntToScalar(6));
164
165 SkRect bounds = SkRect::MakeWH(SkIntToScalar(120), SkIntToScalar(120));
166 bounds.offset(SkIntToScalar(20), SkIntToScalar(20));
167 SkScalar dx = bounds.width() * 4 / 3;
168 SkScalar dy = bounds.height() * 4 / 3;
169
170 const int* intervals = &gIntervals[1];
171 for (int y = 0; y < gIntervals[0]; ++y) {
172 SkScalar vals[SK_ARRAY_COUNT(gIntervals)]; // more than enough
173 int count = *intervals++;
174 for (int i = 0; i < count; ++i) {
175 vals[i] = SkIntToScalar(*intervals++);
176 }
177 SkScalar phase = vals[0] / 2;
178 paint.setPathEffect(SkDashPathEffect::Make(vals, count, phase));
179
180 for (size_t x = 0; x < SK_ARRAY_COUNT(gProc); ++x) {
181 SkPath path;
182 SkRect r = bounds;
183 r.offset(x * dx, y * dy);
184 gProc[x](&path, r);
185
186 canvas->drawPath(path, paint);
187 }
188 }
189 }
190 };
191
192 //////////////////////////////////////////////////////////////////////////////
193
194 // Test out the on/off line dashing Chrome if fond of
195 class Dashing3GM : public skiagm::GM {
onShortName()196 SkString onShortName() override { return SkString("dashing3"); }
197
onISize()198 SkISize onISize() override { return {640, 480}; }
199
200 // Draw a 100x100 block of dashed lines. The horizontal ones are BW
201 // while the vertical ones are AA.
drawDashedLines(SkCanvas * canvas,SkScalar lineLength,SkScalar phase,SkScalar dashLength,int strokeWidth,bool circles)202 void drawDashedLines(SkCanvas* canvas,
203 SkScalar lineLength,
204 SkScalar phase,
205 SkScalar dashLength,
206 int strokeWidth,
207 bool circles) {
208 SkPaint p;
209 p.setColor(SK_ColorBLACK);
210 p.setStyle(SkPaint::kStroke_Style);
211 p.setStrokeWidth(SkIntToScalar(strokeWidth));
212
213 if (circles) {
214 p.setStrokeCap(SkPaint::kRound_Cap);
215 }
216
217 SkScalar intervals[2] = { dashLength, dashLength };
218
219 p.setPathEffect(SkDashPathEffect::Make(intervals, 2, phase));
220
221 SkPoint pts[2];
222
223 for (int y = 0; y < 100; y += 10*strokeWidth) {
224 pts[0].set(0, SkIntToScalar(y));
225 pts[1].set(lineLength, SkIntToScalar(y));
226
227 canvas->drawPoints(SkCanvas::kLines_PointMode, 2, pts, p);
228 }
229
230 p.setAntiAlias(true);
231
232 for (int x = 0; x < 100; x += 14*strokeWidth) {
233 pts[0].set(SkIntToScalar(x), 0);
234 pts[1].set(SkIntToScalar(x), lineLength);
235
236 canvas->drawPoints(SkCanvas::kLines_PointMode, 2, pts, p);
237 }
238 }
239
onDraw(SkCanvas * canvas)240 void onDraw(SkCanvas* canvas) override {
241 // 1on/1off 1x1 squares with phase of 0 - points fastpath
242 canvas->save();
243 canvas->translate(2, 0);
244 this->drawDashedLines(canvas, 100, 0, SK_Scalar1, 1, false);
245 canvas->restore();
246
247 // 1on/1off 1x1 squares with phase of .5 - rects fastpath (due to partial squares)
248 canvas->save();
249 canvas->translate(112, 0);
250 this->drawDashedLines(canvas, 100, SK_ScalarHalf, SK_Scalar1, 1, false);
251 canvas->restore();
252
253 // 1on/1off 1x1 squares with phase of 1 - points fastpath
254 canvas->save();
255 canvas->translate(222, 0);
256 this->drawDashedLines(canvas, 100, SK_Scalar1, SK_Scalar1, 1, false);
257 canvas->restore();
258
259 // 1on/1off 1x1 squares with phase of 1 and non-integer length - rects fastpath
260 canvas->save();
261 canvas->translate(332, 0);
262 this->drawDashedLines(canvas, 99.5f, SK_ScalarHalf, SK_Scalar1, 1, false);
263 canvas->restore();
264
265 // 255on/255off 1x1 squares with phase of 0 - rects fast path
266 canvas->save();
267 canvas->translate(446, 0);
268 this->drawDashedLines(canvas, 100, 0, SkIntToScalar(255), 1, false);
269 canvas->restore();
270
271 // 1on/1off 3x3 squares with phase of 0 - points fast path
272 canvas->save();
273 canvas->translate(2, 110);
274 this->drawDashedLines(canvas, 100, 0, SkIntToScalar(3), 3, false);
275 canvas->restore();
276
277 // 1on/1off 3x3 squares with phase of 1.5 - rects fast path
278 canvas->save();
279 canvas->translate(112, 110);
280 this->drawDashedLines(canvas, 100, 1.5f, SkIntToScalar(3), 3, false);
281 canvas->restore();
282
283 // 1on/1off 1x1 circles with phase of 1 - no fast path yet
284 canvas->save();
285 canvas->translate(2, 220);
286 this->drawDashedLines(canvas, 100, SK_Scalar1, SK_Scalar1, 1, true);
287 canvas->restore();
288
289 // 1on/1off 3x3 circles with phase of 1 - no fast path yet
290 canvas->save();
291 canvas->translate(112, 220);
292 this->drawDashedLines(canvas, 100, 0, SkIntToScalar(3), 3, true);
293 canvas->restore();
294
295 // 1on/1off 1x1 squares with rotation - should break fast path
296 canvas->save();
297 canvas->translate(332+SK_ScalarRoot2Over2*100, 110+SK_ScalarRoot2Over2*100);
298 canvas->rotate(45);
299 canvas->translate(-50, -50);
300
301 this->drawDashedLines(canvas, 100, SK_Scalar1, SK_Scalar1, 1, false);
302 canvas->restore();
303
304 // 3on/3off 3x1 rects - should use rect fast path regardless of phase
305 for (int phase = 0; phase <= 3; ++phase) {
306 canvas->save();
307 canvas->translate(SkIntToScalar(phase*110+2),
308 SkIntToScalar(330));
309 this->drawDashedLines(canvas, 100, SkIntToScalar(phase), SkIntToScalar(3), 1, false);
310 canvas->restore();
311 }
312 }
313
314 };
315
316 //////////////////////////////////////////////////////////////////////////////
317
318 class Dashing4GM : public skiagm::GM {
onShortName()319 SkString onShortName() override { return SkString("dashing4"); }
320
onISize()321 SkISize onISize() override { return {640, 1100}; }
322
onDraw(SkCanvas * canvas)323 void onDraw(SkCanvas* canvas) override {
324 constexpr struct {
325 int fOnInterval;
326 int fOffInterval;
327 } gData[] = {
328 { 1, 1 },
329 { 4, 2 },
330 { 0, 4 }, // test for zero length on interval
331 };
332
333 SkPaint paint;
334 paint.setStyle(SkPaint::kStroke_Style);
335
336 canvas->translate(SkIntToScalar(20), SkIntToScalar(20));
337 canvas->translate(SK_ScalarHalf, SK_ScalarHalf);
338
339 for (int width = 0; width <= 2; ++width) {
340 for (size_t data = 0; data < SK_ARRAY_COUNT(gData); ++data) {
341 for (int aa = 0; aa <= 1; ++aa) {
342 for (int cap = 0; cap <= 1; ++cap) {
343 int w = width * width * width;
344 paint.setAntiAlias(SkToBool(aa));
345 paint.setStrokeWidth(SkIntToScalar(w));
346
347 SkToBool(cap) ? paint.setStrokeCap(SkPaint::kSquare_Cap)
348 : paint.setStrokeCap(SkPaint::kRound_Cap);
349
350 int scale = w ? w : 1;
351
352 drawline(canvas, gData[data].fOnInterval * scale,
353 gData[data].fOffInterval * scale,
354 paint);
355 canvas->translate(0, SkIntToScalar(20));
356 }
357 }
358 }
359 }
360
361 for (int aa = 0; aa <= 1; ++aa) {
362 paint.setAntiAlias(SkToBool(aa));
363 paint.setStrokeWidth(8.f);
364 paint.setStrokeCap(SkPaint::kSquare_Cap);
365 // Single dash element that is cut off at start and end
366 drawline(canvas, 32, 16, paint, 20.f, 0, 5.f);
367 canvas->translate(0, SkIntToScalar(20));
368
369 // Two dash elements where each one is cut off at beginning and end respectively
370 drawline(canvas, 32, 16, paint, 56.f, 0, 5.f);
371 canvas->translate(0, SkIntToScalar(20));
372
373 // Many dash elements where first and last are cut off at beginning and end respectively
374 drawline(canvas, 32, 16, paint, 584.f, 0, 5.f);
375 canvas->translate(0, SkIntToScalar(20));
376
377 // Diagonal dash line where src pnts are not axis aligned (as apposed to being diagonal from
378 // a canvas rotation)
379 drawline(canvas, 32, 16, paint, 600.f, 30.f);
380 canvas->translate(0, SkIntToScalar(20));
381
382 // Case where only the off interval exists on the line. Thus nothing should be drawn
383 drawline(canvas, 32, 16, paint, 8.f, 0.f, 40.f);
384 canvas->translate(0, SkIntToScalar(20));
385 }
386
387 // Test overlapping circles.
388 canvas->translate(SkIntToScalar(5), SkIntToScalar(20));
389 paint.setAntiAlias(true);
390 paint.setStrokeCap(SkPaint::kRound_Cap);
391 paint.setColor(0x44000000);
392 paint.setStrokeWidth(40);
393 drawline(canvas, 0, 30, paint);
394
395 canvas->translate(0, SkIntToScalar(50));
396 paint.setStrokeCap(SkPaint::kSquare_Cap);
397 drawline(canvas, 0, 30, paint);
398
399 // Test we draw the cap when the line length is zero.
400 canvas->translate(0, SkIntToScalar(50));
401 paint.setStrokeCap(SkPaint::kRound_Cap);
402 paint.setColor(0xFF000000);
403 paint.setStrokeWidth(11);
404 drawline(canvas, 0, 30, paint, 0);
405
406 canvas->translate(SkIntToScalar(100), 0);
407 drawline(canvas, 1, 30, paint, 0);
408 }
409 };
410
411 //////////////////////////////////////////////////////////////////////////////
412
413 class Dashing5GM : public skiagm::GM {
414 public:
Dashing5GM(bool doAA)415 Dashing5GM(bool doAA) : fDoAA(doAA) {}
416
417 private:
runAsBench() const418 bool runAsBench() const override { return true; }
419
onShortName()420 SkString onShortName() override { return SkString(fDoAA ? "dashing5_aa" : "dashing5_bw"); }
421
onISize()422 SkISize onISize() override { return {400, 200}; }
423
onDraw(SkCanvas * canvas)424 void onDraw(SkCanvas* canvas) override {
425 constexpr int kOn = 4;
426 constexpr int kOff = 4;
427 constexpr int kIntervalLength = kOn + kOff;
428
429 constexpr SkColor gColors[kIntervalLength] = {
430 SK_ColorRED,
431 SK_ColorGREEN,
432 SK_ColorBLUE,
433 SK_ColorCYAN,
434 SK_ColorMAGENTA,
435 SK_ColorYELLOW,
436 SK_ColorGRAY,
437 SK_ColorDKGRAY
438 };
439
440 SkPaint paint;
441 paint.setStyle(SkPaint::kStroke_Style);
442
443 paint.setAntiAlias(fDoAA);
444
445 SkMatrix rot;
446 rot.setRotate(90);
447 SkASSERT(rot.rectStaysRect());
448
449 canvas->concat(rot);
450
451 int sign; // used to toggle the direction of the lines
452 int phase = 0;
453
454 for (int x = 0; x < 200; x += 10) {
455 paint.setStrokeWidth(SkIntToScalar(phase+1));
456 paint.setColor(gColors[phase]);
457 sign = (x % 20) ? 1 : -1;
458 drawline(canvas, kOn, kOff, paint,
459 SkIntToScalar(x), -sign * SkIntToScalar(10003),
460 SkIntToScalar(phase),
461 SkIntToScalar(x), sign * SkIntToScalar(10003));
462 phase = (phase + 1) % kIntervalLength;
463 }
464
465 for (int y = -400; y < 0; y += 10) {
466 paint.setStrokeWidth(SkIntToScalar(phase+1));
467 paint.setColor(gColors[phase]);
468 sign = (y % 20) ? 1 : -1;
469 drawline(canvas, kOn, kOff, paint,
470 -sign * SkIntToScalar(10003), SkIntToScalar(y),
471 SkIntToScalar(phase),
472 sign * SkIntToScalar(10003), SkIntToScalar(y));
473 phase = (phase + 1) % kIntervalLength;
474 }
475 }
476
477 private:
478 bool fDoAA;
479 };
480
481 DEF_SIMPLE_GM(longpathdash, canvas, 612, 612) {
482 SkPath lines;
483 for (int x = 32; x < 256; x += 16) {
484 for (SkScalar a = 0; a < 3.141592f * 2; a += 0.03141592f) {
485 SkPoint pts[2] = {
486 { 256 + (float) sin(a) * x,
487 256 + (float) cos(a) * x },
488 { 256 + (float) sin(a + 3.141592 / 3) * (x + 64),
489 256 + (float) cos(a + 3.141592 / 3) * (x + 64) }
490 };
491 lines.moveTo(pts[0]);
492 for (SkScalar i = 0; i < 1; i += 0.05f) {
493 lines.lineTo(pts[0].fX * (1 - i) + pts[1].fX * i,
494 pts[0].fY * (1 - i) + pts[1].fY * i);
495 }
496 }
497 }
498 SkPaint p;
499 p.setAntiAlias(true);
500 p.setStyle(SkPaint::kStroke_Style);
501 p.setStrokeWidth(1);
502 const SkScalar intervals[] = { 1, 1 };
503 p.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 0));
504
505 canvas->translate(50, 50);
506 canvas->drawPath(lines, p);
507 }
508
509 DEF_SIMPLE_GM(longlinedash, canvas, 512, 512) {
510 SkPaint p;
511 p.setAntiAlias(true);
512 p.setStyle(SkPaint::kStroke_Style);
513 p.setStrokeWidth(80);
514
515 const SkScalar intervals[] = { 2, 2 };
516 p.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 0));
517 canvas->drawRect(SkRect::MakeXYWH(-10000, 100, 20000, 20), p);
518 }
519
520 DEF_SIMPLE_GM(longwavyline, canvas, 512, 512) {
521 SkPaint p;
522 p.setAntiAlias(true);
523 p.setStyle(SkPaint::kStroke_Style);
524 p.setStrokeWidth(2);
525
526 SkPath wavy;
527 wavy.moveTo(-10000, 100);
528 for (SkScalar i = -10000; i < 10000; i += 20) {
529 wavy.quadTo(i + 5, 95, i + 10, 100);
530 wavy.quadTo(i + 15, 105, i + 20, 100);
531 }
532 canvas->drawPath(wavy, p);
533 }
534
535 DEF_SIMPLE_GM(dashtextcaps, canvas, 512, 512) {
536 SkPaint p;
537 p.setAntiAlias(true);
538 p.setStyle(SkPaint::kStroke_Style);
539 p.setStrokeWidth(10);
540 p.setStrokeCap(SkPaint::kRound_Cap);
541 p.setStrokeJoin(SkPaint::kRound_Join);
542 p.setARGB(0xff, 0xbb, 0x00, 0x00);
543
544 SkFont font(ToolUtils::create_portable_typeface(), 100);
545
546 const SkScalar intervals[] = { 12, 12 };
547 p.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 0));
548 canvas->drawString("Sausages", 10, 90, font, p);
549 canvas->drawLine(8, 120, 456, 120, p);
550 }
551
552 DEF_SIMPLE_GM(dash_line_zero_off_interval, canvas, 160, 330) {
553 static constexpr SkScalar kIntervals[] = {5.f, 0.f, 2.f, 0.f};
554 SkPaint dashPaint;
555 dashPaint.setPathEffect(SkDashPathEffect::Make(kIntervals, SK_ARRAY_COUNT(kIntervals), 0.f));
556 SkASSERT(dashPaint.getPathEffect());
557 dashPaint.setStyle(SkPaint::kStroke_Style);
558 dashPaint.setStrokeWidth(20.f);
559 static constexpr struct {
560 SkPoint fA, fB;
561 } kLines[] = {{{0.5f, 0.5f}, {30.5f, 0.5f}}, // horizontal
562 {{0.5f, 0.5f}, {0.5f, 30.5f}}, // vertical
563 {{0.5f, 0.5f}, {0.5f, 0.5f}}, // point
564 {{0.5f, 0.5f}, {25.5f, 25.5f}}}; // diagonal
565 SkScalar pad = 5.f + dashPaint.getStrokeWidth();
566 canvas->translate(pad / 2.f, pad / 2.f);
567 canvas->save();
568 SkScalar h = 0.f;
569 for (const auto& line : kLines) {
570 h = SkTMax(h, SkScalarAbs(line.fA.fY - line.fB.fY));
571 }
572 for (const auto& line : kLines) {
573 SkScalar w = SkScalarAbs(line.fA.fX - line.fB.fX);
574 for (auto cap : {SkPaint::kButt_Cap, SkPaint::kSquare_Cap, SkPaint::kRound_Cap}) {
575 dashPaint.setStrokeCap(cap);
576 for (auto aa : {false, true}) {
577 dashPaint.setAntiAlias(aa);
578 canvas->drawLine(line.fA, line.fB, dashPaint);
579 canvas->translate(0.f, pad + h);
580 }
581 }
582 canvas->restore();
583 canvas->translate(pad + w, 0.f);
584 canvas->save();
585 }
586 }
587
588 //////////////////////////////////////////////////////////////////////////////
589
590 DEF_GM(return new DashingGM;)
591 DEF_GM(return new Dashing2GM;)
592 DEF_GM(return new Dashing3GM;)
593 DEF_GM(return new Dashing4GM;)
594 DEF_GM(return new Dashing5GM(true);)
595 DEF_GM(return new Dashing5GM(false);)
596