aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/dashing.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gm/dashing.cpp')
-rw-r--r--gm/dashing.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/gm/dashing.cpp b/gm/dashing.cpp
index 6cb1dea66c..c728d15a1a 100644
--- a/gm/dashing.cpp
+++ b/gm/dashing.cpp
@@ -21,7 +21,8 @@ static void drawline(SkCanvas* canvas, int on, int off, const SkPaint& paint,
SkIntToScalar(off),
};
- p.setPathEffect(SkDashPathEffect::Make(intervals, 2, phase));
+ SkAutoTUnref<SkPathEffect> effect(SkDashPathEffect::Create(intervals, 2, phase));
+ p.setPathEffect(effect);
canvas->drawLine(startX, startY, finalX, finalY, p);
}
@@ -174,7 +175,7 @@ protected:
vals[i] = SkIntToScalar(*intervals++);
}
SkScalar phase = vals[0] / 2;
- paint.setPathEffect(SkDashPathEffect::Make(vals, count, phase));
+ paint.setPathEffect(SkDashPathEffect::Create(vals, count, phase))->unref();
for (size_t x = 0; x < SK_ARRAY_COUNT(gProc); ++x) {
SkPath path;
@@ -222,7 +223,7 @@ protected:
SkScalar intervals[2] = { dashLength, dashLength };
- p.setPathEffect(SkDashPathEffect::Make(intervals, 2, phase));
+ p.setPathEffect(SkDashPathEffect::Create(intervals, 2, phase))->unref();
SkPoint pts[2];
@@ -498,7 +499,7 @@ DEF_SIMPLE_GM(longpathdash, canvas, 512, 512) {
p.setStyle(SkPaint::kStroke_Style);
p.setStrokeWidth(1);
const SkScalar intervals[] = { 1, 1 };
- p.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 0));
+ p.setPathEffect(SkDashPathEffect::Create(intervals, SK_ARRAY_COUNT(intervals), 0))->unref();
canvas->drawPath(lines, p);
}
@@ -509,7 +510,7 @@ DEF_SIMPLE_GM(longlinedash, canvas, 512, 512) {
p.setStrokeWidth(80);
const SkScalar intervals[] = { 2, 2 };
- p.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 0));
+ p.setPathEffect(SkDashPathEffect::Create(intervals, SK_ARRAY_COUNT(intervals), 0))->unref();
canvas->drawRect(SkRect::MakeXYWH(-10000, 100, 20000, 20), p);
}
@@ -539,7 +540,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::Make(intervals, SK_ARRAY_COUNT(intervals), 0));
+ p.setPathEffect(SkDashPathEffect::Create(intervals, SK_ARRAY_COUNT(intervals), 0))->unref();
canvas->drawText("Sausages", 8, 10, 90, p);
canvas->drawLine(8, 120, 456, 120, p);
}