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=2aadded3d20dfef34d1c8abe28c7bc8d |
Hal Canary | a7181e7c | 2019-03-18 16:06:34 -0400 | [diff] [blame] | 5 | REG_FIDDLE(Conic_Weight_a, 256, 256, true, 0) { |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 6 | void draw(SkCanvas* canvas) { |
| 7 | const char* verbNames[] = { "move", "line", "quad", "conic", "cubic", "close", "done" }; |
| 8 | const int pointCount[] = { 1 , 2 , 3 , 3 , 4 , 1 , 0 }; |
| 9 | SkPath path; |
| 10 | path.conicTo(20, 30, 50, 60, 1); |
| 11 | SkPath::Iter iter(path, false); |
| 12 | SkPath::Verb verb; |
| 13 | do { |
| 14 | SkPoint points[4]; |
| 15 | verb = iter.next(points); |
| 16 | SkDebugf("%s ", verbNames[(int) verb]); |
| 17 | for (int i = 0; i < pointCount[(int) verb]; ++i) { |
| 18 | SkDebugf("{%g, %g}, ", points[i].fX, points[i].fY); |
| 19 | } |
| 20 | if (SkPath::kConic_Verb == verb) { |
| 21 | SkDebugf("weight = %g", iter.conicWeight()); |
| 22 | } |
| 23 | SkDebugf("\n"); |
| 24 | } while (SkPath::kDone_Verb != verb); |
| 25 | } |
| 26 | } // END FIDDLE |