1 // 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.
3 #include "tools/fiddle/examples.h"
4 // HASH=eb5fa5bea23059ce538e883502f828f5
5 REG_FIDDLE(Path_RawIter_peek, 256, 256, true, 0) {
draw(SkCanvas * canvas)6 void draw(SkCanvas* canvas) {
7 SkPath path;
8 path.quadTo(10, 20, 30, 40);
9 path.conicTo(1, 2, 3, 4, .5f);
10 path.cubicTo(1, 2, 3, 4, .5, 6);
11 SkPath::RawIter iter(path);
12 SkPath::Verb verb, peek = iter.peek();
13 const char* verbStr[] = { "Move", "Line", "Quad", "Conic", "Cubic", "Close", "Done" };
14 do {
15 SkPoint points[4];
16 verb = iter.next(points);
17 SkDebugf("peek %s %c= verb %s\n", verbStr[peek], peek == verb ? '=' : '!', verbStr[verb]);
18 peek = iter.peek();
19 } while (SkPath::kDone_Verb != verb);
20 SkDebugf("peek %s %c= verb %s\n", verbStr[peek], peek == verb ? '=' : '!', verbStr[verb]);
21 }
22 } // END FIDDLE
23