blob: 303d4a538bfcd117f0cd364aa81f221f298ee528 [file] [log] [blame]
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +00001/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00002 * Copyright 2011 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.
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +00006 */
7
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +00008#include "gm.h"
bungemand3ebb482015-08-05 13:57:49 -07009#include "SkPath.h"
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +000010#include "SkRandom.h"
caryclark5cb00a92015-08-26 09:04:55 -070011#include "SkDashPathEffect.h"
12#include "SkParsePath.h"
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +000013
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +000014#define W 400
15#define H 400
16#define N 50
17
18static const SkScalar SW = SkIntToScalar(W);
19static const SkScalar SH = SkIntToScalar(H);
20
scroggof9d61012014-12-15 12:54:51 -080021static void rnd_rect(SkRect* r, SkPaint* paint, SkRandom& rand) {
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +000022 SkScalar x = rand.nextUScalar1() * W;
23 SkScalar y = rand.nextUScalar1() * H;
24 SkScalar w = rand.nextUScalar1() * (W >> 2);
25 SkScalar h = rand.nextUScalar1() * (H >> 2);
epoger@google.com17b78942011-08-26 14:40:38 +000026 SkScalar hoffset = rand.nextSScalar1();
27 SkScalar woffset = rand.nextSScalar1();
rmistry@google.comae933ce2012-08-23 18:19:56 +000028
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +000029 r->set(x, y, x + w, y + h);
epoger@google.com17b78942011-08-26 14:40:38 +000030 r->offset(-w/2 + woffset, -h/2 + hoffset);
rmistry@google.comae933ce2012-08-23 18:19:56 +000031
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +000032 paint->setColor(rand.nextU());
33 paint->setAlpha(0xFF);
34}
35
rmistry@google.comae933ce2012-08-23 18:19:56 +000036
reed@google.com4384fab2012-06-05 16:14:23 +000037class StrokesGM : public skiagm::GM {
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +000038public:
39 StrokesGM() {}
rmistry@google.comae933ce2012-08-23 18:19:56 +000040
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +000041protected:
commit-bot@chromium.orga90c6802014-04-30 13:20:45 +000042
mtklein36352bf2015-03-25 18:17:31 -070043 SkString onShortName() override {
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +000044 return SkString("strokes_round");
45 }
rmistry@google.comae933ce2012-08-23 18:19:56 +000046
mtklein36352bf2015-03-25 18:17:31 -070047 SkISize onISize() override {
reed@google.com4384fab2012-06-05 16:14:23 +000048 return SkISize::Make(W, H*2);
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +000049 }
rmistry@google.comae933ce2012-08-23 18:19:56 +000050
mtklein36352bf2015-03-25 18:17:31 -070051 void onDraw(SkCanvas* canvas) override {
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +000052 SkPaint paint;
53 paint.setStyle(SkPaint::kStroke_Style);
54 paint.setStrokeWidth(SkIntToScalar(9)/2);
rmistry@google.comae933ce2012-08-23 18:19:56 +000055
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +000056 for (int y = 0; y < 2; y++) {
57 paint.setAntiAlias(!!y);
58 SkAutoCanvasRestore acr(canvas, true);
59 canvas->translate(0, SH * y);
60 canvas->clipRect(SkRect::MakeLTRB(
61 SkIntToScalar(2), SkIntToScalar(2)
62 , SW - SkIntToScalar(2), SH - SkIntToScalar(2)
63 ));
rmistry@google.comae933ce2012-08-23 18:19:56 +000064
scroggof9d61012014-12-15 12:54:51 -080065 SkRandom rand;
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +000066 for (int i = 0; i < N; i++) {
67 SkRect r;
68 rnd_rect(&r, &paint, rand);
69 canvas->drawOval(r, paint);
70 rnd_rect(&r, &paint, rand);
71 canvas->drawRoundRect(r, r.width()/4, r.height()/4, paint);
72 rnd_rect(&r, &paint, rand);
73 }
74 }
75 }
rmistry@google.comae933ce2012-08-23 18:19:56 +000076
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +000077private:
reed@google.com4384fab2012-06-05 16:14:23 +000078 typedef skiagm::GM INHERITED;
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +000079};
80
caryclark5cb00a92015-08-26 09:04:55 -070081/* See
82 https://code.google.com/p/chromium/issues/detail?id=422974 and
83 http://jsfiddle.net/1xnku3sg/2/
84 */
85class ZeroLenStrokesGM : public skiagm::GM {
86 SkPath fMoveHfPath, fMoveZfPath, fDashedfPath, fRefPath[4];
caryclark6651a322015-09-09 13:20:49 -070087 SkPath fCubicPath, fQuadPath, fLinePath;
caryclark5cb00a92015-08-26 09:04:55 -070088protected:
89 void onOnceBeforeDraw() override {
90
91 SkAssertResult(SkParsePath::FromSVGString("M0,0h0M10,0h0M20,0h0", &fMoveHfPath));
92 SkAssertResult(SkParsePath::FromSVGString("M0,0zM10,0zM20,0z", &fMoveZfPath));
93 SkAssertResult(SkParsePath::FromSVGString("M0,0h25", &fDashedfPath));
caryclark6651a322015-09-09 13:20:49 -070094 SkAssertResult(SkParsePath::FromSVGString("M 0 0 C 0 0 0 0 0 0", &fCubicPath));
95 SkAssertResult(SkParsePath::FromSVGString("M 0 0 Q 0 0 0 0", &fQuadPath));
96 SkAssertResult(SkParsePath::FromSVGString("M 0 0 L 0 0", &fLinePath));
caryclark5cb00a92015-08-26 09:04:55 -070097
98 for (int i = 0; i < 3; ++i) {
99 fRefPath[0].addCircle(i * 10.f, 0, 5);
100 fRefPath[1].addCircle(i * 10.f, 0, 10);
101 fRefPath[2].addRect(i * 10.f - 4, -2, i * 10.f + 4, 6);
102 fRefPath[3].addRect(i * 10.f - 10, -10, i * 10.f + 10, 10);
103 }
104 }
105
106 SkString onShortName() override {
107 return SkString("zeroPath");
108 }
109
110 SkISize onISize() override {
111 return SkISize::Make(W, H*2);
112 }
113
114 void onDraw(SkCanvas* canvas) override {
115 SkPaint fillPaint, strokePaint, dashPaint;
116 fillPaint.setAntiAlias(true);
117 strokePaint = fillPaint;
118 strokePaint.setStyle(SkPaint::kStroke_Style);
119 for (int i = 0; i < 2; ++i) {
120 fillPaint.setAlpha(255);
121 strokePaint.setAlpha(255);
122 strokePaint.setStrokeWidth(i ? 8.f : 10.f);
123 strokePaint.setStrokeCap(i ? SkPaint::kSquare_Cap : SkPaint::kRound_Cap);
124 canvas->save();
125 canvas->translate(10 + i * 100.f, 10);
126 canvas->drawPath(fMoveHfPath, strokePaint);
127 canvas->translate(0, 20);
128 canvas->drawPath(fMoveZfPath, strokePaint);
129 dashPaint = strokePaint;
130 const SkScalar intervals[] = { 0, 10 };
131 dashPaint.setPathEffect(SkDashPathEffect::Create(intervals, 2, 0))->unref();
132 SkPath fillPath;
133 dashPaint.getFillPath(fDashedfPath, &fillPath);
134 canvas->translate(0, 20);
135 canvas->drawPath(fDashedfPath, dashPaint);
136 canvas->translate(0, 20);
137 canvas->drawPath(fRefPath[i * 2], fillPaint);
138 strokePaint.setStrokeWidth(20);
139 strokePaint.setAlpha(127);
140 canvas->translate(0, 50);
141 canvas->drawPath(fMoveHfPath, strokePaint);
142 canvas->translate(0, 30);
143 canvas->drawPath(fMoveZfPath, strokePaint);
144 canvas->translate(0, 30);
145 fillPaint.setAlpha(127);
146 canvas->drawPath(fRefPath[1 + i * 2], fillPaint);
caryclark6651a322015-09-09 13:20:49 -0700147 canvas->translate(0, 30);
148 canvas->drawPath(fCubicPath, strokePaint);
149 canvas->translate(0, 30);
150 canvas->drawPath(fQuadPath, strokePaint);
151 canvas->translate(0, 30);
152 canvas->drawPath(fLinePath, strokePaint);
caryclark5cb00a92015-08-26 09:04:55 -0700153 canvas->restore();
154 }
155 }
156
157private:
158 typedef skiagm::GM INHERITED;
159};
160
caryclark950305e2015-10-26 08:17:04 -0700161class TeenyStrokesGM : public skiagm::GM {
162
163 SkString onShortName() override {
164 return SkString("teenyStrokes");
165 }
166
167 SkISize onISize() override {
168 return SkISize::Make(W, H*2);
169 }
170
171 static void line(SkScalar scale, SkCanvas* canvas, SkColor color) {
172 SkPaint p;
173 p.setAntiAlias(true);
174 p.setStyle(SkPaint::kStroke_Style);
175 p.setColor(color);
176 canvas->translate(50, 0);
177 canvas->save();
178 p.setStrokeWidth(scale * 5);
179 canvas->scale(1 / scale, 1 / scale);
180 canvas->drawLine(20 * scale, 20 * scale, 20 * scale, 100 * scale, p);
181 canvas->drawLine(20 * scale, 20 * scale, 100 * scale, 100 * scale, p);
182 canvas->restore();
183 }
184
185 void onDraw(SkCanvas* canvas) override {
186 line(0.00005f, canvas, SK_ColorBLACK);
187 line(0.000045f, canvas, SK_ColorRED);
188 line(0.0000035f, canvas, SK_ColorGREEN);
189 line(0.000003f, canvas, SK_ColorBLUE);
190 line(0.000002f, canvas, SK_ColorBLACK);
191 }
192private:
193 typedef skiagm::GM INHERITED;
194};
195
caryclarkb775e912015-11-30 13:47:11 -0800196DEF_SIMPLE_GM(CubicStroke, canvas, 384, 384) {
197 SkPaint p;
198 p.setAntiAlias(true);
199 p.setStyle(SkPaint::kStroke_Style);
200 p.setStrokeWidth(1.0720f);
201 SkPath path;
202 path.moveTo(-6000,-6000);
203 path.cubicTo(-3500,5500,-500,5500,2500,-6500);
204 canvas->drawPath(path, p);
205 p.setStrokeWidth(1.0721f);
206 canvas->translate(10, 10);
207 canvas->drawPath(path, p);
208 p.setStrokeWidth(1.0722f);
209 canvas->translate(10, 10);
210 canvas->drawPath(path, p);
211}
caryclark950305e2015-10-26 08:17:04 -0700212
caryclark57eecc12015-12-08 04:29:45 -0800213DEF_SIMPLE_GM(zerolinestroke, canvas, 90, 120) {
214 SkPaint paint;
215 paint.setStyle(SkPaint::kStroke_Style);
216 paint.setStrokeWidth(20);
217 paint.setAntiAlias(true);
218 paint.setStrokeCap(SkPaint::kRound_Cap);
219
220 SkPath path;
221 path.moveTo(30, 90);
222 path.lineTo(30, 90);
223 path.lineTo(60, 90);
224 path.lineTo(60, 90);
225 canvas->drawPath(path, paint);
226
227 path.reset();
228 path.moveTo(30, 30);
229 path.lineTo(60, 30);
230 canvas->drawPath(path, paint);
231
232 path.reset();
233 path.moveTo(30, 60);
234 path.lineTo(30, 60);
235 path.lineTo(60, 60);
236 canvas->drawPath(path, paint);
237}
238
reed@google.com4384fab2012-06-05 16:14:23 +0000239class Strokes2GM : public skiagm::GM {
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +0000240 SkPath fPath;
caryclark63c684a2015-02-25 09:04:04 -0800241protected:
mtklein36352bf2015-03-25 18:17:31 -0700242 void onOnceBeforeDraw() override {
scroggof9d61012014-12-15 12:54:51 -0800243 SkRandom rand;
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +0000244 fPath.moveTo(0, 0);
245 for (int i = 0; i < 13; i++) {
246 SkScalar x = rand.nextUScalar1() * (W >> 1);
247 SkScalar y = rand.nextUScalar1() * (H >> 1);
248 fPath.lineTo(x, y);
249 }
250 }
rmistry@google.comae933ce2012-08-23 18:19:56 +0000251
commit-bot@chromium.orga90c6802014-04-30 13:20:45 +0000252
mtklein36352bf2015-03-25 18:17:31 -0700253 SkString onShortName() override {
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +0000254 return SkString("strokes_poly");
255 }
rmistry@google.comae933ce2012-08-23 18:19:56 +0000256
mtklein36352bf2015-03-25 18:17:31 -0700257 SkISize onISize() override {
reed@google.com4384fab2012-06-05 16:14:23 +0000258 return SkISize::Make(W, H*2);
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +0000259 }
rmistry@google.comae933ce2012-08-23 18:19:56 +0000260
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +0000261 static void rotate(SkScalar angle, SkScalar px, SkScalar py, SkCanvas* canvas) {
262 SkMatrix matrix;
263 matrix.setRotate(angle, px, py);
264 canvas->concat(matrix);
265 }
266
mtklein36352bf2015-03-25 18:17:31 -0700267 void onDraw(SkCanvas* canvas) override {
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +0000268 canvas->drawColor(SK_ColorWHITE);
rmistry@google.comae933ce2012-08-23 18:19:56 +0000269
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +0000270 SkPaint paint;
271 paint.setStyle(SkPaint::kStroke_Style);
272 paint.setStrokeWidth(SkIntToScalar(9)/2);
rmistry@google.comae933ce2012-08-23 18:19:56 +0000273
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +0000274 for (int y = 0; y < 2; y++) {
275 paint.setAntiAlias(!!y);
276 SkAutoCanvasRestore acr(canvas, true);
277 canvas->translate(0, SH * y);
278 canvas->clipRect(SkRect::MakeLTRB(SkIntToScalar(2),
279 SkIntToScalar(2),
280 SW - SkIntToScalar(2),
281 SH - SkIntToScalar(2)));
rmistry@google.comae933ce2012-08-23 18:19:56 +0000282
scroggof9d61012014-12-15 12:54:51 -0800283 SkRandom rand;
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +0000284 for (int i = 0; i < N/2; i++) {
285 SkRect r;
286 rnd_rect(&r, &paint, rand);
287 rotate(SkIntToScalar(15), SW/2, SH/2, canvas);
288 canvas->drawPath(fPath, paint);
289 }
290 }
291 }
rmistry@google.comae933ce2012-08-23 18:19:56 +0000292
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +0000293private:
reed@google.com4384fab2012-06-05 16:14:23 +0000294 typedef skiagm::GM INHERITED;
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +0000295};
296
297//////////////////////////////////////////////////////////////////////////////
298
reed@google.com4384fab2012-06-05 16:14:23 +0000299static SkRect inset(const SkRect& r) {
300 SkRect rr(r);
301 rr.inset(r.width()/10, r.height()/10);
302 return rr;
mike@reedtribe.orgf2c21cd2011-06-18 00:15:04 +0000303}
304
reed@google.com4384fab2012-06-05 16:14:23 +0000305class Strokes3GM : public skiagm::GM {
306 static void make0(SkPath* path, const SkRect& bounds, SkString* title) {
307 path->addRect(bounds, SkPath::kCW_Direction);
308 path->addRect(inset(bounds), SkPath::kCW_Direction);
309 title->set("CW CW");
310 }
rmistry@google.comae933ce2012-08-23 18:19:56 +0000311
reed@google.com4384fab2012-06-05 16:14:23 +0000312 static void make1(SkPath* path, const SkRect& bounds, SkString* title) {
313 path->addRect(bounds, SkPath::kCW_Direction);
314 path->addRect(inset(bounds), SkPath::kCCW_Direction);
315 title->set("CW CCW");
316 }
rmistry@google.comae933ce2012-08-23 18:19:56 +0000317
reed@google.com4384fab2012-06-05 16:14:23 +0000318 static void make2(SkPath* path, const SkRect& bounds, SkString* title) {
319 path->addOval(bounds, SkPath::kCW_Direction);
320 path->addOval(inset(bounds), SkPath::kCW_Direction);
321 title->set("CW CW");
322 }
rmistry@google.comae933ce2012-08-23 18:19:56 +0000323
reed@google.com4384fab2012-06-05 16:14:23 +0000324 static void make3(SkPath* path, const SkRect& bounds, SkString* title) {
325 path->addOval(bounds, SkPath::kCW_Direction);
326 path->addOval(inset(bounds), SkPath::kCCW_Direction);
327 title->set("CW CCW");
328 }
rmistry@google.comae933ce2012-08-23 18:19:56 +0000329
reed@google.com4384fab2012-06-05 16:14:23 +0000330 static void make4(SkPath* path, const SkRect& bounds, SkString* title) {
331 path->addRect(bounds, SkPath::kCW_Direction);
332 SkRect r = bounds;
333 r.inset(bounds.width() / 10, -bounds.height() / 10);
334 path->addOval(r, SkPath::kCW_Direction);
335 title->set("CW CW");
336 }
rmistry@google.comae933ce2012-08-23 18:19:56 +0000337
reed@google.com4384fab2012-06-05 16:14:23 +0000338 static void make5(SkPath* path, const SkRect& bounds, SkString* title) {
339 path->addRect(bounds, SkPath::kCW_Direction);
340 SkRect r = bounds;
341 r.inset(bounds.width() / 10, -bounds.height() / 10);
342 path->addOval(r, SkPath::kCCW_Direction);
343 title->set("CW CCW");
344 }
345
346public:
347 Strokes3GM() {}
rmistry@google.comae933ce2012-08-23 18:19:56 +0000348
reed@google.com4384fab2012-06-05 16:14:23 +0000349protected:
commit-bot@chromium.orga90c6802014-04-30 13:20:45 +0000350
mtklein36352bf2015-03-25 18:17:31 -0700351 SkString onShortName() override {
reed@google.com4384fab2012-06-05 16:14:23 +0000352 return SkString("strokes3");
353 }
rmistry@google.comae933ce2012-08-23 18:19:56 +0000354
mtklein36352bf2015-03-25 18:17:31 -0700355 SkISize onISize() override {
caryclark37604572015-02-23 06:51:04 -0800356 return SkISize::Make(1500, 1500);
reed@google.com4384fab2012-06-05 16:14:23 +0000357 }
rmistry@google.comae933ce2012-08-23 18:19:56 +0000358
mtklein36352bf2015-03-25 18:17:31 -0700359 void onDraw(SkCanvas* canvas) override {
reed@google.com4384fab2012-06-05 16:14:23 +0000360 SkPaint origPaint;
361 origPaint.setAntiAlias(true);
362 origPaint.setStyle(SkPaint::kStroke_Style);
363 SkPaint fillPaint(origPaint);
364 fillPaint.setColor(SK_ColorRED);
365 SkPaint strokePaint(origPaint);
caryclark12596012015-07-29 05:27:47 -0700366 strokePaint.setColor(sk_tool_utils::color_to_565(0xFF4444FF));
reed@google.com4384fab2012-06-05 16:14:23 +0000367
368 void (*procs[])(SkPath*, const SkRect&, SkString*) = {
369 make0, make1, make2, make3, make4, make5
370 };
371
caryclark37604572015-02-23 06:51:04 -0800372 canvas->translate(SkIntToScalar(20), SkIntToScalar(80));
reed@google.com4384fab2012-06-05 16:14:23 +0000373
374 SkRect bounds = SkRect::MakeWH(SkIntToScalar(50), SkIntToScalar(50));
375 SkScalar dx = bounds.width() * 4/3;
376 SkScalar dy = bounds.height() * 5;
377
378 for (size_t i = 0; i < SK_ARRAY_COUNT(procs); ++i) {
379 SkPath orig;
380 SkString str;
381 procs[i](&orig, bounds, &str);
rmistry@google.comae933ce2012-08-23 18:19:56 +0000382
reed@google.com4384fab2012-06-05 16:14:23 +0000383 canvas->save();
384 for (int j = 0; j < 13; ++j) {
385 strokePaint.setStrokeWidth(SK_Scalar1 * j * j);
386 canvas->drawPath(orig, strokePaint);
387 canvas->drawPath(orig, origPaint);
388 SkPath fill;
389 strokePaint.getFillPath(orig, &fill);
390 canvas->drawPath(fill, fillPaint);
391 canvas->translate(dx + strokePaint.getStrokeWidth(), 0);
392 }
393 canvas->restore();
394 canvas->translate(0, dy);
395 }
396 }
rmistry@google.comae933ce2012-08-23 18:19:56 +0000397
reed@google.com4384fab2012-06-05 16:14:23 +0000398private:
399 typedef skiagm::GM INHERITED;
400};
401
caryclark612f70d2015-05-19 11:05:37 -0700402class Strokes4GM : public skiagm::GM {
403public:
404 Strokes4GM() {}
405
406protected:
407
408 SkString onShortName() override {
409 return SkString("strokes_zoomed");
410 }
411
412 SkISize onISize() override {
413 return SkISize::Make(W, H*2);
414 }
415
416 void onDraw(SkCanvas* canvas) override {
417 SkPaint paint;
418 paint.setStyle(SkPaint::kStroke_Style);
419 paint.setStrokeWidth(0.055f);
420
421 canvas->scale(1000, 1000);
422 canvas->drawCircle(0, 2, 1.97f, paint);
423 }
424
425private:
426 typedef skiagm::GM INHERITED;
427};
428
caryclark45398df2015-08-25 13:19:06 -0700429// Test stroking for curves that produce degenerate tangents when t is 0 or 1 (see bug 4191)
430class Strokes5GM : public skiagm::GM {
431public:
432 Strokes5GM() {}
433
434protected:
435
436 SkString onShortName() override {
437 return SkString("zero_control_stroke");
438 }
439
440 SkISize onISize() override {
441 return SkISize::Make(W, H*2);
442 }
443
444 void onDraw(SkCanvas* canvas) override {
445 SkPaint p;
446 p.setColor(SK_ColorRED);
447 p.setAntiAlias(true);
448 p.setStyle(SkPaint::kStroke_Style);
449 p.setStrokeWidth(40);
450 p.setStrokeCap(SkPaint::kButt_Cap);
451
452 SkPath path;
453 path.moveTo(157.474f,111.753f);
454 path.cubicTo(128.5f,111.5f,35.5f,29.5f,35.5f,29.5f);
455 canvas->drawPath(path, p);
456 path.reset();
457 path.moveTo(250, 50);
458 path.quadTo(280, 80, 280, 80);
459 canvas->drawPath(path, p);
460 path.reset();
461 path.moveTo(150, 50);
462 path.conicTo(180, 80, 180, 80, 0.707f);
463 canvas->drawPath(path, p);
464
465 path.reset();
466 path.moveTo(157.474f,311.753f);
467 path.cubicTo(157.474f,311.753f,85.5f,229.5f,35.5f,229.5f);
468 canvas->drawPath(path, p);
469 path.reset();
470 path.moveTo(280, 250);
471 path.quadTo(280, 250, 310, 280);
472 canvas->drawPath(path, p);
473 path.reset();
474 path.moveTo(180, 250);
475 path.conicTo(180, 250, 210, 280, 0.707f);
476 canvas->drawPath(path, p);
477 }
478
479private:
480 typedef skiagm::GM INHERITED;
481};
482
caryclark612f70d2015-05-19 11:05:37 -0700483
reed@google.com4384fab2012-06-05 16:14:23 +0000484//////////////////////////////////////////////////////////////////////////////
485
486static skiagm::GM* F0(void*) { return new StrokesGM; }
487static skiagm::GM* F1(void*) { return new Strokes2GM; }
488static skiagm::GM* F2(void*) { return new Strokes3GM; }
caryclark612f70d2015-05-19 11:05:37 -0700489static skiagm::GM* F3(void*) { return new Strokes4GM; }
caryclark45398df2015-08-25 13:19:06 -0700490static skiagm::GM* F4(void*) { return new Strokes5GM; }
reed@google.com4384fab2012-06-05 16:14:23 +0000491
492static skiagm::GMRegistry R0(F0);
493static skiagm::GMRegistry R1(F1);
494static skiagm::GMRegistry R2(F2);
caryclark612f70d2015-05-19 11:05:37 -0700495static skiagm::GMRegistry R3(F3);
caryclark45398df2015-08-25 13:19:06 -0700496static skiagm::GMRegistry R4(F4);
caryclark5cb00a92015-08-26 09:04:55 -0700497
halcanary385fe4d2015-08-26 13:07:48 -0700498DEF_GM( return new ZeroLenStrokesGM; )
caryclark950305e2015-10-26 08:17:04 -0700499DEF_GM( return new TeenyStrokesGM; )