aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/dashing.cpp
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-20 20:40:19 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-20 20:40:19 +0000
commit0a2bf90dccba3bde188e0386a7f0c60e6dde1ae9 (patch)
treeaa5c4198b4a200d6efe87d1a81964c8c219c1091 /gm/dashing.cpp
parent4012ba51a218883daef6c9be142f970b8ef5d0d2 (diff)
Factory methods for heap-allocated SkPathEffect and SkXfermode objects.
This is part of an effort to ensure that all SkPaint effects can only be allocated on the heap. This patch makes the constructors of SkPathEffect, SkXfermode and their subclasses non-public and instead provides factory methods for creating these objects on the heap. We temporarily keep the constructors of the following classes public to not break Chrome/Blink: SkXfermode SkCornerPathEffect SkDashPathEffect BUG=skia:2187 R=scroggo@google.com, reed@google.com, mtklein@google.com, bungeman@google.com Author: dominikg@chromium.org Review URL: https://codereview.chromium.org/166583002 git-svn-id: http://skia.googlecode.com/svn/trunk@13519 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm/dashing.cpp')
-rw-r--r--gm/dashing.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/gm/dashing.cpp b/gm/dashing.cpp
index fa88e9e0ab..f690852fbd 100644
--- a/gm/dashing.cpp
+++ b/gm/dashing.cpp
@@ -19,7 +19,7 @@ static void drawline(SkCanvas* canvas, int on, int off, const SkPaint& paint,
SkIntToScalar(off),
};
- p.setPathEffect(new SkDashPathEffect(intervals, 2, 0))->unref();
+ p.setPathEffect(SkDashPathEffect::Create(intervals, 2, 0))->unref();
canvas->drawLine(0, 0, finalX, 0, p);
}
@@ -155,7 +155,7 @@ protected:
vals[i] = SkIntToScalar(*intervals++);
}
SkScalar phase = vals[0] / 2;
- paint.setPathEffect(new SkDashPathEffect(vals, count, phase))->unref();
+ paint.setPathEffect(SkDashPathEffect::Create(vals, count, phase))->unref();
for (size_t x = 0; x < SK_ARRAY_COUNT(gProc); ++x) {
SkPath path;
@@ -202,7 +202,7 @@ protected:
SkScalar intervals[2] = { dashLength, dashLength };
- p.setPathEffect(new SkDashPathEffect(intervals, 2, phase, false))->unref();
+ p.setPathEffect(SkDashPathEffect::Create(intervals, 2, phase, false))->unref();
SkPoint pts[2];