Hal Canary | 6c8422c | 2020-01-10 15:22:09 -0500 | [diff] [blame] | 1 | // Copyright 2020 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 | REG_FIDDLE(issue640176, 256, 256, false, 0) { |
| 5 | void draw(SkCanvas* canvas) { |
| 6 | SkPaint p; |
| 7 | p.setColor(SK_ColorRED); |
| 8 | p.setAntiAlias(true); |
| 9 | float startAngle = -0.5235985, endAngle = -2.439e-4, radius = 120; |
| 10 | |
| 11 | canvas->translate(radius, radius); |
| 12 | SkPath path; |
| 13 | path.moveTo(0, 0); |
| 14 | path.lineTo(radius * cos(startAngle), radius * sin(startAngle)); |
| 15 | SkRect oval = {-radius, -radius, radius, radius}; |
| 16 | path.arcTo(oval, startAngle * 180 / 3.14159265359, |
| 17 | (endAngle - startAngle) * 180 / 3.14159265359, false); |
| 18 | canvas->drawPath(path, p); |
| 19 | |
| 20 | p.setStyle(SkPaint::kStroke_Style); |
| 21 | p.setColor(SK_ColorGREEN); |
| 22 | canvas->drawPath(path, p); |
| 23 | } |
| 24 | } // END FIDDLE |