Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: gm/circulararcs.cpp

Issue 2261233002: Add stroke-and-fill circular arc test, test near 180deg arc in all circular_arc_tests (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698