blob: 0f203c8b7331465be75b202b9d3a3f674f17d349 [file] [log] [blame]
// Copyright 2019 Google LLC.
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
#include "tools/fiddle/examples.h"
REG_FIDDLE(Path_Iter_const_SkPath, 256, 256, true, 0) {
void draw(SkCanvas* canvas) {
auto debugster = [](const char* prefix, SkPath::Iter& iter) -> void {
SkDebugf("%s:\n", prefix);
const char* verbStr[] = { "Move", "Line", "Quad", "Conic", "Cubic", "Close", "Done" };
while (auto rec = iter.next()) {
SkDebugf("k%s_Verb ", verbStr[(int)rec->fVerb]);
for (SkPoint p : rec->fPoints) {
SkDebugf("{%g, %g}, ", p.fX, p.fY);
}
if (SkPathVerb::kConic == rec->fVerb) {
SkDebugf("weight = %g", rec->conicWeight());
}
SkDebugf("\n");
}
SkDebugf("\n");
};
SkPath path;
path.quadTo(10, 20, 30, 40);
SkPath::Iter openIter(path, false);
debugster("open", openIter);
SkPath::Iter closedIter(path, true);
debugster("closed", closedIter);
}
} // END FIDDLE