blob: 7fe5cee172625f95740aa42c8a84d88e140696ec [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=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,
Mike Reed1792b192019-11-21 17:13:54 -05009 SkPathConvexityType::kUnknown == path.getConvexityTypeOrUnknown() ? "unknown" :
10 SkPathConvexityType::kConvex == path.getConvexityTypeOrUnknown() ? "convex" : "concave"); };
Hal Canary87515122019-03-15 14:22:51 -040011 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);
Mike Reed1792b192019-11-21 17:13:54 -050015 path.setConvexityType(SkPathConvexityType::kConcave);
Hal Canary87515122019-03-15 14:22:51 -040016 debugster("after forcing concave", path);
Mike Reed1792b192019-11-21 17:13:54 -050017 path.setConvexityType(SkPathConvexityType::kUnknown);
Hal Canary87515122019-03-15 14:22:51 -040018 debugster("after forcing unknown", path);
19}
20} // END FIDDLE