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

Side by Side Diff: gm/pathcontourstart.cpp

Issue 1817543002: Revert of switch patheffects over to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | « gm/dashing.cpp ('k') | gm/patheffects.cpp » ('j') | 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 2015 Google Inc. 2 * Copyright 2015 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 "gm.h" 8 #include "gm.h"
9 9
10 #include "SkDashPathEffect.h" 10 #include "SkDashPathEffect.h"
11 #include "SkPaint.h" 11 #include "SkPaint.h"
12 #include "SkPath.h" 12 #include "SkPath.h"
13 #include "SkRRect.h" 13 #include "SkRRect.h"
14 14
15 namespace skiagm { 15 namespace skiagm {
16 16
17 class ContourStartGM : public GM { 17 class ContourStartGM : public GM {
18 public: 18 public:
19 ContourStartGM() { 19 ContourStartGM() {
20 const SkScalar kMaxDashLen = 100; 20 const SkScalar kMaxDashLen = 100;
21 const SkScalar kDashGrowth = 1.2f; 21 const SkScalar kDashGrowth = 1.2f;
22 22
23 SkSTArray<100, SkScalar> intervals; 23 SkSTArray<100, SkScalar> intervals;
24 for (SkScalar len = 1; len < kMaxDashLen; len *= kDashGrowth) { 24 for (SkScalar len = 1; len < kMaxDashLen; len *= kDashGrowth) {
25 intervals.push_back(len); 25 intervals.push_back(len);
26 intervals.push_back(len); 26 intervals.push_back(len);
27 } 27 }
28 28
29 SkAutoTUnref<SkPathEffect> effect(
30 SkDashPathEffect::Create(intervals.begin(), intervals.count(), 0));
31
29 fDashPaint.setAntiAlias(true); 32 fDashPaint.setAntiAlias(true);
30 fDashPaint.setStyle(SkPaint::kStroke_Style); 33 fDashPaint.setStyle(SkPaint::kStroke_Style);
31 fDashPaint.setStrokeWidth(6); 34 fDashPaint.setStrokeWidth(6);
32 fDashPaint.setColor(0xff008000); 35 fDashPaint.setColor(0xff008000);
33 fDashPaint.setPathEffect(SkDashPathEffect::Make(intervals.begin(), inter vals.count(), 0)); 36 fDashPaint.setPathEffect(effect);
34 37
35 fPointsPaint.setColor(0xff800000); 38 fPointsPaint.setColor(0xff800000);
36 fPointsPaint.setStrokeWidth(3); 39 fPointsPaint.setStrokeWidth(3);
37 40
38 fRect = SkRect::MakeLTRB(10, 10, 100, 70); 41 fRect = SkRect::MakeLTRB(10, 10, 100, 70);
39 } 42 }
40 43
41 protected: 44 protected:
42 SkString onShortName() override { 45 SkString onShortName() override {
43 return SkString("contour_start"); 46 return SkString("contour_start");
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } 124 }
122 } 125 }
123 126
124 typedef GM INHERITED; 127 typedef GM INHERITED;
125 }; 128 };
126 129
127 DEF_GM( return new ContourStartGM(); ) 130 DEF_GM( return new ContourStartGM(); )
128 131
129 } // namespace skiagm 132 } // namespace skiagm
130 133
OLDNEW
« no previous file with comments | « gm/dashing.cpp ('k') | gm/patheffects.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698