diff options
| author | reed <reed@google.com> | 2016-03-18 10:17:27 -0700 |
|---|---|---|
| committer | Commit bot <commit-bot@chromium.org> | 2016-03-18 10:17:27 -0700 |
| commit | f28ad894272018fd2855e3f77ea1236ea0cce1c0 (patch) | |
| tree | 25dfb6f13e3bbbde1c9d7af7b41ea39b2df78dd4 /samplecode/SampleSlides.cpp | |
| parent | 9fbee18f691a0afed1e38a851048ce06063505ed (diff) | |
Revert of switch patheffects over to sk_sp (patchset #5 id:80001 of https://codereview.chromium.org/1813553005/ )
Reason for revert:
some build breaks, possibly related to paint having to know what a patheffect is
Original issue's description:
> switch patheffects over to sk_sp
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1813553005
>
> Committed: https://skia.googlesource.com/skia/+/9fbee18f691a0afed1e38a851048ce06063505ed
TBR=caryclark@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/1817543002
Diffstat (limited to 'samplecode/SampleSlides.cpp')
| -rw-r--r-- | samplecode/SampleSlides.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/samplecode/SampleSlides.cpp b/samplecode/SampleSlides.cpp index 38fd7402c7..c3cc2bbd6f 100644 --- a/samplecode/SampleSlides.cpp +++ b/samplecode/SampleSlides.cpp @@ -31,14 +31,15 @@ typedef void (*SlideProc)(SkCanvas*); static void compose_pe(SkPaint* paint) { SkPathEffect* pe = paint->getPathEffect(); - sk_sp<SkPathEffect> corner = SkCornerPathEffect::Make(25); - sk_sp<SkPathEffect> compose; + SkPathEffect* corner = SkCornerPathEffect::Create(25); + SkPathEffect* compose; if (pe) { - compose = SkComposePathEffect::Make(sk_ref_sp(pe), corner); + compose = SkComposePathEffect::Create(pe, corner); + corner->unref(); } else { compose = corner; } - paint->setPathEffect(compose); + paint->setPathEffect(compose)->unref(); } static void hair_pe(SkPaint* paint) { @@ -58,7 +59,8 @@ static void stroke_pe(SkPaint* paint) { static void dash_pe(SkPaint* paint) { SkScalar inter[] = { 20, 10, 10, 10 }; paint->setStrokeWidth(12); - paint->setPathEffect(SkDashPathEffect::Make(inter, SK_ARRAY_COUNT(inter), 0)); + paint->setPathEffect(SkDashPathEffect::Create(inter, SK_ARRAY_COUNT(inter), + 0))->unref(); compose_pe(paint); } @@ -81,8 +83,8 @@ static void one_d_pe(SkPaint* paint) { path.offset(SkIntToScalar(-6), 0); scale(&path, 1.5f); - paint->setPathEffect(SkPath1DPathEffect::Make(path, SkIntToScalar(21), 0, - SkPath1DPathEffect::kRotate_Style)); + paint->setPathEffect(SkPath1DPathEffect::Create(path, SkIntToScalar(21), 0, + SkPath1DPathEffect::kRotate_Style))->unref(); compose_pe(paint); } @@ -95,21 +97,21 @@ static void fill_pe(SkPaint* paint) { } static void discrete_pe(SkPaint* paint) { - paint->setPathEffect(SkDiscretePathEffect::Make(10, 4)); + paint->setPathEffect(SkDiscretePathEffect::Create(10, 4))->unref(); } -static sk_sp<SkPathEffect> MakeTileEffect() { +static SkPathEffect* MakeTileEffect() { SkMatrix m; m.setScale(SkIntToScalar(12), SkIntToScalar(12)); SkPath path; path.addCircle(0, 0, SkIntToScalar(5)); - return SkPath2DPathEffect::Make(m, path); + return SkPath2DPathEffect::Create(m, path); } static void tile_pe(SkPaint* paint) { - paint->setPathEffect(MakeTileEffect()); + paint->setPathEffect(MakeTileEffect())->unref(); } static const PE_Proc gPE2[] = { fill_pe, discrete_pe, tile_pe }; @@ -532,7 +534,7 @@ static void r5(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) { rastBuilder->addLayer(p); - p.setPathEffect(SkDiscretePathEffect::Make(SK_Scalar1*4, SK_Scalar1*3)); + p.setPathEffect(SkDiscretePathEffect::Create(SK_Scalar1*4, SK_Scalar1*3))->unref(); p.setXfermodeMode(SkXfermode::kSrcOut_Mode); rastBuilder->addLayer(p); } @@ -551,10 +553,10 @@ static void r6(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) #include "Sk2DPathEffect.h" -static sk_sp<SkPathEffect> MakeDotEffect(SkScalar radius, const SkMatrix& matrix) { +static SkPathEffect* MakeDotEffect(SkScalar radius, const SkMatrix& matrix) { SkPath path; path.addCircle(0, 0, radius); - return SkPath2DPathEffect::Make(matrix, path); + return SkPath2DPathEffect::Create(matrix, path); } static void r7(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) @@ -562,7 +564,7 @@ static void r7(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) SkMatrix lattice; lattice.setScale(SK_Scalar1*6, SK_Scalar1*6, 0, 0); lattice.postSkew(SK_Scalar1/3, 0, 0, 0); - p.setPathEffect(MakeDotEffect(SK_Scalar1*4, lattice)); + p.setPathEffect(MakeDotEffect(SK_Scalar1*4, lattice))->unref(); rastBuilder->addLayer(p); } @@ -573,7 +575,7 @@ static void r8(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) SkMatrix lattice; lattice.setScale(SK_Scalar1*6, SK_Scalar1*6, 0, 0); lattice.postSkew(SK_Scalar1/3, 0, 0, 0); - p.setPathEffect(MakeDotEffect(SK_Scalar1*2, lattice)); + p.setPathEffect(MakeDotEffect(SK_Scalar1*2, lattice))->unref(); p.setXfermodeMode(SkXfermode::kClear_Mode); rastBuilder->addLayer(p); @@ -591,7 +593,7 @@ static void r9(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) SkMatrix lattice; lattice.setScale(SK_Scalar1, SK_Scalar1*6, 0, 0); lattice.postRotate(SkIntToScalar(30), 0, 0); - p.setPathEffect(SkLine2DPathEffect::Make(SK_Scalar1*2, lattice)); + p.setPathEffect(SkLine2DPathEffect::Create(SK_Scalar1*2, lattice))->unref(); p.setXfermodeMode(SkXfermode::kClear_Mode); rastBuilder->addLayer(p); |
