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

Unified Diff: gm/dashing.cpp

Issue 1813123003: Reland of "switch patheffects over to sk_sp (patchset #5 id:80001 of https://codereview.chromium.or… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: move flag into sktypes, so it is visible to both paint and other patheffect clients 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/dashcubics.cpp ('k') | gm/pathcontourstart.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/dashing.cpp
diff --git a/gm/dashing.cpp b/gm/dashing.cpp
index c728d15a1a36a72429dcef2e55334e4ad6eff3b8..6cb1dea66cc62246920f0f398e6efabac9fec858 100644
--- a/gm/dashing.cpp
+++ b/gm/dashing.cpp
@@ -21,8 +21,7 @@ static void drawline(SkCanvas* canvas, int on, int off, const SkPaint& paint,
SkIntToScalar(off),
};
- SkAutoTUnref<SkPathEffect> effect(SkDashPathEffect::Create(intervals, 2, phase));
- p.setPathEffect(effect);
+ p.setPathEffect(SkDashPathEffect::Make(intervals, 2, phase));
canvas->drawLine(startX, startY, finalX, finalY, p);
}
@@ -175,7 +174,7 @@ protected:
vals[i] = SkIntToScalar(*intervals++);
}
SkScalar phase = vals[0] / 2;
- paint.setPathEffect(SkDashPathEffect::Create(vals, count, phase))->unref();
+ paint.setPathEffect(SkDashPathEffect::Make(vals, count, phase));
for (size_t x = 0; x < SK_ARRAY_COUNT(gProc); ++x) {
SkPath path;
@@ -223,7 +222,7 @@ protected:
SkScalar intervals[2] = { dashLength, dashLength };
- p.setPathEffect(SkDashPathEffect::Create(intervals, 2, phase))->unref();
+ p.setPathEffect(SkDashPathEffect::Make(intervals, 2, phase));
SkPoint pts[2];
@@ -499,7 +498,7 @@ DEF_SIMPLE_GM(longpathdash, canvas, 512, 512) {
p.setStyle(SkPaint::kStroke_Style);
p.setStrokeWidth(1);
const SkScalar intervals[] = { 1, 1 };
- p.setPathEffect(SkDashPathEffect::Create(intervals, SK_ARRAY_COUNT(intervals), 0))->unref();
+ p.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 0));
canvas->drawPath(lines, p);
}
@@ -510,7 +509,7 @@ DEF_SIMPLE_GM(longlinedash, canvas, 512, 512) {
p.setStrokeWidth(80);
const SkScalar intervals[] = { 2, 2 };
- p.setPathEffect(SkDashPathEffect::Create(intervals, SK_ARRAY_COUNT(intervals), 0))->unref();
+ p.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 0));
canvas->drawRect(SkRect::MakeXYWH(-10000, 100, 20000, 20), p);
}
@@ -540,7 +539,7 @@ DEF_SIMPLE_GM(dashtextcaps, canvas, 512, 512) {
p.setARGB(0xff, 0xbb, 0x00, 0x00);
sk_tool_utils::set_portable_typeface(&p);
const SkScalar intervals[] = { 12, 12 };
- p.setPathEffect(SkDashPathEffect::Create(intervals, SK_ARRAY_COUNT(intervals), 0))->unref();
+ p.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 0));
canvas->drawText("Sausages", 8, 10, 90, p);
canvas->drawLine(8, 120, 456, 120, p);
}
« no previous file with comments | « gm/dashcubics.cpp ('k') | gm/pathcontourstart.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698