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=875e32b4b1cb48d739325705fc0fa42c
5 REG_FIDDLE(Path_setConvexity, 256, 256, true, 0) {
draw(SkCanvas * canvas)6 void draw(SkCanvas* canvas) {
7 auto debugster = [](const char* prefix, const SkPath& path) -> void {
8 SkDebugf("%s path convexity is %s\n", prefix,
9 SkPath::kUnknown_Convexity == path.getConvexity() ? "unknown" :
10 SkPath::kConvex_Convexity == path.getConvexity() ? "convex" : "concave"); };
11 SkPoint quad[] = {{70, 70}, {20, 20}, {120, 20}, {120, 120}};
12 SkPath path;
13 path.addPoly(quad, SK_ARRAY_COUNT(quad), true);
14 debugster("initial", path);
15 path.setConvexity(SkPath::kConcave_Convexity);
16 debugster("after forcing concave", path);
17 path.setConvexity(SkPath::kUnknown_Convexity);
18 debugster("after forcing unknown", path);
19 }
20 } // END FIDDLE
21