aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/patheffects.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-03-18 11:22:57 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-18 11:22:57 -0700
commita439334b6e758d38501e225e2e5d0ab73e2fb6eb (patch)
tree8f2919ed2f6dcae5c4d5dbaaf608b5c6d248f2fc /gm/patheffects.cpp
parent0be9e806af72b3e029e691eef5c891c90d3fd320 (diff)
Reland of "switch patheffects over to sk_sp (patchset #5 id:80001 of https://codereview.chromium.org/1813553005/ )"
Diffstat (limited to 'gm/patheffects.cpp')
-rw-r--r--gm/patheffects.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/gm/patheffects.cpp b/gm/patheffects.cpp
index 517d02e547..9821b3a35d 100644
--- a/gm/patheffects.cpp
+++ b/gm/patheffects.cpp
@@ -17,15 +17,14 @@ namespace skiagm {
static void compose_pe(SkPaint* paint) {
SkPathEffect* pe = paint->getPathEffect();
- SkPathEffect* corner = SkCornerPathEffect::Create(25);
- SkPathEffect* compose;
+ sk_sp<SkPathEffect> corner = SkCornerPathEffect::Make(25);
+ sk_sp<SkPathEffect> compose;
if (pe) {
- compose = SkComposePathEffect::Create(pe, corner);
- corner->unref();
+ compose = SkComposePathEffect::Make(sk_ref_sp(pe), corner);
} else {
compose = corner;
}
- paint->setPathEffect(compose)->unref();
+ paint->setPathEffect(compose);
}
static void hair_pe(SkPaint* paint) {
@@ -45,8 +44,7 @@ static void stroke_pe(SkPaint* paint) {
static void dash_pe(SkPaint* paint) {
SkScalar inter[] = { 20, 10, 10, 10 };
paint->setStrokeWidth(12);
- paint->setPathEffect(SkDashPathEffect::Create(inter, SK_ARRAY_COUNT(inter),
- 0))->unref();
+ paint->setPathEffect(SkDashPathEffect::Make(inter, SK_ARRAY_COUNT(inter), 0));
compose_pe(paint);
}
@@ -69,8 +67,8 @@ static void one_d_pe(SkPaint* paint) {
path.offset(SkIntToScalar(-6), 0);
scale(&path, 1.5f);
- paint->setPathEffect(SkPath1DPathEffect::Create(path, SkIntToScalar(21), 0,
- SkPath1DPathEffect::kRotate_Style))->unref();
+ paint->setPathEffect(SkPath1DPathEffect::Make(path, SkIntToScalar(21), 0,
+ SkPath1DPathEffect::kRotate_Style));
compose_pe(paint);
}
@@ -83,21 +81,21 @@ static void fill_pe(SkPaint* paint) {
}
static void discrete_pe(SkPaint* paint) {
- paint->setPathEffect(SkDiscretePathEffect::Create(10, 4))->unref();
+ paint->setPathEffect(SkDiscretePathEffect::Make(10, 4));
}
-static SkPathEffect* MakeTileEffect() {
+static sk_sp<SkPathEffect> MakeTileEffect() {
SkMatrix m;
m.setScale(SkIntToScalar(12), SkIntToScalar(12));
SkPath path;
path.addCircle(0, 0, SkIntToScalar(5));
- return SkPath2DPathEffect::Create(m, path);
+ return SkPath2DPathEffect::Make(m, path);
}
static void tile_pe(SkPaint* paint) {
- paint->setPathEffect(MakeTileEffect())->unref();
+ paint->setPathEffect(MakeTileEffect());
}
static const PE_Proc gPE2[] = { fill_pe, discrete_pe, tile_pe };