OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include <functional> | 8 #include <functional> |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "gm.h" | 10 #include "gm.h" |
11 | 11 |
12 static constexpr SkScalar kStarts[] = {0.f, 10.f, 30.f, 45.f, 90.f, 165.f, 180.f
, 270.f}; | 12 static constexpr SkScalar kStarts[] = {0.f, 10.f, 30.f, 45.f, 90.f, 165.f, 180.f
, 270.f}; |
13 static constexpr SkScalar kSweeps[] = {1.f, 45.f, 90.f, 130.f, 180.f, 270.f, 300
.f, 355.f}; | 13 static constexpr SkScalar kSweeps[] = {1.f, 45.f, 90.f, 130.f, 180.f, 184.f, 300
.f, 355.f}; |
14 static constexpr SkScalar kDiameter = 40.f; | 14 static constexpr SkScalar kDiameter = 40.f; |
15 static constexpr SkRect kRect = {0.f, 0.f, kDiameter, kDiameter}; | 15 static constexpr SkRect kRect = {0.f, 0.f, kDiameter, kDiameter}; |
16 static constexpr int kW = 1000; | 16 static constexpr int kW = 1000; |
17 static constexpr int kH = 1000; | 17 static constexpr int kH = 1000; |
18 static constexpr SkScalar kPad = 20.f; | 18 static constexpr SkScalar kPad = 20.f; |
19 | 19 |
20 void draw_arcs(SkCanvas* canvas, std::function<void(SkPaint*)> configureStyle) { | 20 void draw_arcs(SkCanvas* canvas, std::function<void(SkPaint*)> configureStyle) { |
21 // Draws grid of arcs with different start/sweep angles in red and their com
plement arcs in | 21 // Draws grid of arcs with different start/sweep angles in red and their com
plement arcs in |
22 // blue. | 22 // blue. |
23 auto drawGrid = [canvas, &configureStyle] (SkScalar x, SkScalar y, bool useC
enter, bool aa) { | 23 auto drawGrid = [canvas, &configureStyle] (SkScalar x, SkScalar y, bool useC
enter, bool aa) { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 draw_arcs(canvas, setStroke); | 94 draw_arcs(canvas, setStroke); |
95 } | 95 } |
96 | 96 |
97 DEF_ARC_GM(stroke_round) { | 97 DEF_ARC_GM(stroke_round) { |
98 auto setStroke = [] (SkPaint* p) { | 98 auto setStroke = [] (SkPaint* p) { |
99 p->setStyle(SkPaint::kStroke_Style); | 99 p->setStyle(SkPaint::kStroke_Style); |
100 p->setStrokeCap(SkPaint::kRound_Cap); | 100 p->setStrokeCap(SkPaint::kRound_Cap); |
101 }; | 101 }; |
102 draw_arcs(canvas, setStroke); | 102 draw_arcs(canvas, setStroke); |
103 } | 103 } |
| 104 |
| 105 DEF_ARC_GM(fill_and_Stroke) { |
| 106 auto setStroke = [] (SkPaint* p) { |
| 107 p->setStyle(SkPaint::kStrokeAndFill_Style); |
| 108 p->setStrokeCap(SkPaint::kRound_Cap); |
| 109 }; |
| 110 draw_arcs(canvas, setStroke); |
| 111 } |
OLD | NEW |