blob: b45a8cd8a23564e98fb42261516247a395472923 [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.
3#include "fiddle/examples.h"
4// HASH=875e32b4b1cb48d739325705fc0fa42c
Hal Canarya7181e7c2019-03-18 16:06:34 -04005REG_FIDDLE(Path_setConvexity, 256, 256, true, 0) {
Hal Canary87515122019-03-15 14:22:51 -04006void 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