Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 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. |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 3 | #include "tools/fiddle/examples.h" |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 4 | // HASH=875e32b4b1cb48d739325705fc0fa42c |
Hal Canary | a7181e7c | 2019-03-18 16:06:34 -0400 | [diff] [blame] | 5 | REG_FIDDLE(Path_setConvexity, 256, 256, true, 0) { |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 6 | void draw(SkCanvas* canvas) { |
| 7 | auto debugster = [](const char* prefix, const SkPath& path) -> void { |
| 8 | SkDebugf("%s path convexity is %s\n", prefix, |
Mike Reed | 1792b19 | 2019-11-21 17:13:54 -0500 | [diff] [blame] | 9 | SkPathConvexityType::kUnknown == path.getConvexityTypeOrUnknown() ? "unknown" : |
| 10 | SkPathConvexityType::kConvex == path.getConvexityTypeOrUnknown() ? "convex" : "concave"); }; |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 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); |
Mike Reed | 1792b19 | 2019-11-21 17:13:54 -0500 | [diff] [blame] | 15 | path.setConvexityType(SkPathConvexityType::kConcave); |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 16 | debugster("after forcing concave", path); |
Mike Reed | 1792b19 | 2019-11-21 17:13:54 -0500 | [diff] [blame] | 17 | path.setConvexityType(SkPathConvexityType::kUnknown); |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 18 | debugster("after forcing unknown", path); |
| 19 | } |
| 20 | } // END FIDDLE |