blob: 73a84b673be7ab33988ee246e6364a64e72e473b [file] [log] [blame]
Hal Canary87515122019-03-15 14:22:51 -04001// Copyright 2019 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Mike Kleinc0bd9f92019-04-23 12:05:21 -05003#include "tools/fiddle/examples.h"
Hal Canary87515122019-03-15 14:22:51 -04004// HASH=00ae8984856486bdb626d0ed6587855a
Hal Canarya7181e7c2019-03-18 16:06:34 -04005REG_FIDDLE(Path_Iter_next, 256, 256, true, 0) {
Hal Canary87515122019-03-15 14:22:51 -04006void draw(SkCanvas* canvas) {
Hal Canary87515122019-03-15 14:22:51 -04007 SkPath path;
8 path.moveTo(10, 10);
9 path.moveTo(20, 20);
10 path.quadTo(10, 20, 30, 40);
11 path.moveTo(1, 1);
12 path.close();
13 path.moveTo(30, 30);
Hal Canary87515122019-03-15 14:22:51 -040014 path.lineTo(30.00001f, 30);
Mike Reedba7e9a62019-08-16 13:30:34 -040015
16 SkPath::Iter iter(path, false);
17 const char* verbStr[] = { "Move", "Line", "Quad", "Conic", "Cubic", "Close", "Done" };
18 const int pointCount[] = { 1 , 2 , 3 , 3 , 4 , 1 , 0 };
19 SkPath::Verb verb;
20 do {
21 SkPoint points[4];
22 verb = iter.next(points);
23 SkDebugf("k%s_Verb ", verbStr[(int) verb]);
24 for (int i = 0; i < pointCount[(int) verb]; ++i) {
25 SkDebugf("{%1.8g, %1.8g}, ", points[i].fX, points[i].fY);
26 }
27 SkDebugf("\n");
28 } while (SkPath::kDone_Verb != verb);
29 SkDebugf("\n");
Hal Canary87515122019-03-15 14:22:51 -040030}
31} // END FIDDLE