1 // Copyright 2020 Google LLC.
2 // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3 #include "tools/fiddle/examples.h"
4 REG_FIDDLE(cubics_are_horrible, 256, 256, false, 0) {
draw(SkCanvas * canvas)5 void draw(SkCanvas* canvas) {
6 canvas->scale(0.4, 0.4);
7 canvas->translate(175, 175);
8
9 SkPaint p;
10 p.setColor(SK_ColorBLACK);
11 p.setAntiAlias(true);
12 p.setStyle(SkPaint::kStroke_Style);
13 p.setStrokeWidth(400);
14
15 SkPoint p1 = SkPoint::Make(60, -40);
16 SkPoint p2 = SkPoint::Make(120, 150);
17 SkPoint p3 = SkPoint::Make(180, 60);
18
19 SkPath path;
20 path.moveTo(20, 60);
21 path.cubicTo(p1, p2, p3);
22 // path.close();
23
24 SkPath fillpath;
25 p.getFillPath(path, &fillpath);
26 SkPaint fillp;
27 fillp.setColor(SK_ColorMAGENTA);
28 fillp.setAntiAlias(true);
29 fillp.setStyle(SkPaint::kStroke_Style);
30 fillp.setStrokeWidth(0);
31
32 canvas->drawPath(path, p);
33 canvas->drawPath(fillpath, fillp);
34 }
35 } // END FIDDLE
36