aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/texteffects.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/texteffects.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/texteffects.cpp')
-rw-r--r--gm/texteffects.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/gm/texteffects.cpp b/gm/texteffects.cpp
index 094fe7b8a1..cf9ec5accc 100644
--- a/gm/texteffects.cpp
+++ b/gm/texteffects.cpp
@@ -77,7 +77,7 @@ static void r4(SkLayerRasterizer* rast, SkPaint& p) {
static void r5(SkLayerRasterizer* rast, SkPaint& p) {
rast->addLayer(p);
- p.setPathEffect(new SkDiscretePathEffect(SK_Scalar1*4, SK_Scalar1*3))->unref();
+ p.setPathEffect(SkDiscretePathEffect::Create(SK_Scalar1*4, SK_Scalar1*3))->unref();
p.setXfermodeMode(SkXfermode::kSrcOut_Mode);
rast->addLayer(p);
}
@@ -98,7 +98,7 @@ static void r6(SkLayerRasterizer* rast, SkPaint& p) {
static SkPathEffect* MakeDotEffect(SkScalar radius, const SkMatrix& matrix) {
SkPath path;
path.addCircle(0, 0, radius);
- return new SkPath2DPathEffect(matrix, path);
+ return SkPath2DPathEffect::Create(matrix, path);
}
static void r7(SkLayerRasterizer* rast, SkPaint& p) {
@@ -132,7 +132,7 @@ static void r9(SkLayerRasterizer* rast, SkPaint& p) {
SkMatrix lattice;
lattice.setScale(SK_Scalar1, SK_Scalar1*6, 0, 0);
lattice.postRotate(SkIntToScalar(30), 0, 0);
- p.setPathEffect(new SkLine2DPathEffect(SK_Scalar1*2, lattice))->unref();
+ p.setPathEffect(SkLine2DPathEffect::Create(SK_Scalar1*2, lattice))->unref();
p.setXfermodeMode(SkXfermode::kClear_Mode);
rast->addLayer(p);