blob: a08964570eb4c9e963105f6903217ba2c13e1611 [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=eb5fa5bea23059ce538e883502f828f5
Hal Canarya7181e7c2019-03-18 16:06:34 -04005REG_FIDDLE(Path_RawIter_peek, 256, 256, true, 0) {
Hal Canary87515122019-03-15 14:22:51 -04006void 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