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/SamplePathEffects.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/SamplePathEffects.cpp')
| -rw-r--r-- | samplecode/SamplePathEffects.cpp | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/samplecode/SamplePathEffects.cpp b/samplecode/SamplePathEffects.cpp index 10715f382a..a162cf33ad 100644 --- a/samplecode/SamplePathEffects.cpp +++ b/samplecode/SamplePathEffects.cpp @@ -26,10 +26,9 @@ static const int gXY[] = { 4, 0, 0, -4, 8, -4, 12, 0, 8, 4, 0, 4 }; -static sk_sp<SkPathEffect> make_pe(int flags, SkScalar phase) { - if (flags == 1) { - return SkCornerPathEffect::Make(SkIntToScalar(CORNER_RADIUS)); - } +static SkPathEffect* make_pe(int flags, SkScalar phase) { + if (flags == 1) + return SkCornerPathEffect::Create(SkIntToScalar(CORNER_RADIUS)); SkPath path; path.moveTo(SkIntToScalar(gXY[0]), SkIntToScalar(gXY[1])); @@ -38,30 +37,36 @@ static sk_sp<SkPathEffect> make_pe(int flags, SkScalar phase) { path.close(); path.offset(SkIntToScalar(-6), 0); - auto outer = SkPath1DPathEffect::Make(path, 12, phase, SkPath1DPathEffect::kRotate_Style); + SkPathEffect* outer = SkPath1DPathEffect::Create(path, 12, phase, + SkPath1DPathEffect::kRotate_Style); if (flags == 2) return outer; - auto inner = SkCornerPathEffect::Make(SkIntToScalar(CORNER_RADIUS)); + SkPathEffect* inner = SkCornerPathEffect::Create(SkIntToScalar(CORNER_RADIUS)); - return SkComposePathEffect::Make(outer, inner); + SkPathEffect* pe = SkComposePathEffect::Create(outer, inner); + outer->unref(); + inner->unref(); + return pe; } -static sk_sp<SkPathEffect> make_warp_pe(SkScalar phase) { +static SkPathEffect* make_warp_pe(SkScalar phase) { SkPath path; path.moveTo(SkIntToScalar(gXY[0]), SkIntToScalar(gXY[1])); - for (unsigned i = 2; i < SK_ARRAY_COUNT(gXY); i += 2) { + for (unsigned i = 2; i < SK_ARRAY_COUNT(gXY); i += 2) path.lineTo(SkIntToScalar(gXY[i]), SkIntToScalar(gXY[i+1])); - } path.close(); path.offset(SkIntToScalar(-6), 0); - auto outer = SkPath1DPathEffect::Make( + SkPathEffect* outer = SkPath1DPathEffect::Create( path, 12, phase, SkPath1DPathEffect::kMorph_Style); - auto inner = SkCornerPathEffect::Make(SkIntToScalar(CORNER_RADIUS)); + SkPathEffect* inner = SkCornerPathEffect::Create(SkIntToScalar(CORNER_RADIUS)); - return SkComposePathEffect::Make(outer, inner); + SkPathEffect* pe = SkComposePathEffect::Create(outer, inner); + outer->unref(); + inner->unref(); + return pe; } /////////////////////////////////////////////////////////// @@ -138,19 +143,19 @@ protected: canvas->translate(0, 50); paint.setColor(SK_ColorBLUE); - paint.setPathEffect(make_pe(2, fPhase)); + paint.setPathEffect(make_pe(2, fPhase))->unref(); canvas->drawPath(fPath, paint); canvas->translate(0, 50); paint.setARGB(0xFF, 0, 0xBB, 0); - paint.setPathEffect(make_pe(3, fPhase)); + paint.setPathEffect(make_pe(3, fPhase))->unref(); canvas->drawPath(fPath, paint); canvas->translate(0, 50); paint.setARGB(0xFF, 0, 0, 0); - paint.setPathEffect(make_warp_pe(fPhase)); + paint.setPathEffect(make_warp_pe(fPhase))->unref(); TestRastBuilder testRastBuilder; paint.setRasterizer(testRastBuilder.detachRasterizer())->unref(); canvas->drawPath(fPath, paint); |
