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

Side by Side Diff: gm/bug530095.cpp

Issue 1813553005: switch patheffects over to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: try to fix xpsdevice 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/arcto.cpp ('k') | gm/dashcircle.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 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 "gm.h" 8 #include "gm.h"
9 #include "SkPath.h" 9 #include "SkPath.h"
10 #include "SkDashPathEffect.h" 10 #include "SkDashPathEffect.h"
11 11
12 DEF_SIMPLE_GM(bug530095, canvas, 900, 1200) { 12 DEF_SIMPLE_GM(bug530095, canvas, 900, 1200) {
13 SkPath path1, path2; 13 SkPath path1, path2;
14 path1.addCircle(200, 200, 124); 14 path1.addCircle(200, 200, 124);
15 path2.addCircle(2, 2, 1.24f); 15 path2.addCircle(2, 2, 1.24f);
16 16
17 SkPaint paint; 17 SkPaint paint;
18 paint.setAntiAlias(true); 18 paint.setAntiAlias(true);
19 paint.setStyle(SkPaint::kStroke_Style); 19 paint.setStyle(SkPaint::kStroke_Style);
20 paint.setStrokeWidth(26); 20 paint.setStrokeWidth(26);
21 SkScalar intervals[] = {700, 700 }; 21 SkScalar intervals[] = {700, 700 };
22 int intervalCount = (int) SK_ARRAY_COUNT(intervals); 22 int intervalCount = (int) SK_ARRAY_COUNT(intervals);
23 paint.setPathEffect(SkDashPathEffect::Create(intervals, intervalCount, -40)) ->unref(); 23 paint.setPathEffect(SkDashPathEffect::Make(intervals, intervalCount, -40));
24 canvas->drawPath(path1, paint); 24 canvas->drawPath(path1, paint);
25 25
26 paint.setStrokeWidth(0.26f); 26 paint.setStrokeWidth(0.26f);
27 SkScalar smIntervals[] = {7, 7 }; 27 SkScalar smIntervals[] = {7, 7 };
28 int smIntervalCount = (int) SK_ARRAY_COUNT(smIntervals); 28 int smIntervalCount = (int) SK_ARRAY_COUNT(smIntervals);
29 paint.setPathEffect(SkDashPathEffect::Create(smIntervals, smIntervalCount, - 0.40f))->unref(); 29 paint.setPathEffect(SkDashPathEffect::Make(smIntervals, smIntervalCount, -0. 40f));
30 canvas->save(); 30 canvas->save();
31 canvas->scale(100, 100); 31 canvas->scale(100, 100);
32 canvas->translate(4, 0); 32 canvas->translate(4, 0);
33 canvas->drawPath(path2, paint); 33 canvas->drawPath(path2, paint);
34 canvas->restore(); 34 canvas->restore();
35 35
36 paint.setStrokeWidth(26); 36 paint.setStrokeWidth(26);
37 paint.setPathEffect(SkDashPathEffect::Create(intervals, intervalCount, 0))-> unref(); 37 paint.setPathEffect(SkDashPathEffect::Make(intervals, intervalCount, 0));
38 canvas->save(); 38 canvas->save();
39 canvas->translate(0, 400); 39 canvas->translate(0, 400);
40 canvas->drawPath(path1, paint); 40 canvas->drawPath(path1, paint);
41 canvas->restore(); 41 canvas->restore();
42 42
43 paint.setStrokeWidth(0.26f); 43 paint.setStrokeWidth(0.26f);
44 paint.setPathEffect(SkDashPathEffect::Create(smIntervals, smIntervalCount, 0 ))->unref(); 44 paint.setPathEffect(SkDashPathEffect::Make(smIntervals, smIntervalCount, 0)) ;
45 canvas->scale(100, 100); 45 canvas->scale(100, 100);
46 canvas->translate(4, 4); 46 canvas->translate(4, 4);
47 canvas->drawPath(path2, paint); 47 canvas->drawPath(path2, paint);
48 } 48 }
49 49
50 DEF_SIMPLE_GM(bug591993, canvas, 40, 140) { 50 DEF_SIMPLE_GM(bug591993, canvas, 40, 140) {
51 SkPaint p; 51 SkPaint p;
52 p.setColor(SK_ColorRED); 52 p.setColor(SK_ColorRED);
53 p.setAntiAlias(true); 53 p.setAntiAlias(true);
54 p.setStyle(SkPaint::kStroke_Style); 54 p.setStyle(SkPaint::kStroke_Style);
55 p.setStrokeCap(SkPaint::kRound_Cap); 55 p.setStrokeCap(SkPaint::kRound_Cap);
56 p.setStrokeWidth(10); 56 p.setStrokeWidth(10);
57 SkScalar intervals[] = { 100, 100 }; 57 const SkScalar intervals[] = { 100, 100 };
58 SkPathEffect* dash = SkDashPathEffect::Create(intervals, SK_ARRAY_COUNT(inte rvals), 100); 58 p.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 100));
59 p.setPathEffect(dash)->unref();
60 canvas->drawLine(20, 20, 120, 20, p); 59 canvas->drawLine(20, 20, 120, 20, p);
61 } 60 }
OLDNEW
« no previous file with comments | « gm/arcto.cpp ('k') | gm/dashcircle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698