diff options
author | reed <reed@google.com> | 2016-03-22 10:17:23 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-22 10:17:23 -0700 |
commit | d053ce9c54d4e5937a142278359e5a4cde18095e (patch) | |
tree | e85d4b9d8b23f4fc3c04e6a72173d363ba5f69d5 /gm/color4f.cpp | |
parent | d25d06bf5f109c429e59a41d11854d2a3835abe9 (diff) |
Reland of [2] of "switch colorfilters to sk_sp (patchset #11 id:200001 of https://codereview.chromium.o… (patchset #1 id:1 of https://codereview.chromium.org/1821103004/ )
Reason for revert:
guard has now landed in chrome
Original issue's description:
> Revert of Revert[2] of "switch colorfilters to sk_sp (patchset #11 id:200001 of https://codereview.chromium.o… (patchset #3 id:40001 of https://codereview.chromium.org/1825073002/ )
>
> Reason for revert:
> CreateModeFilter not compiling
>
> Original issue's description:
> > Revert[2] of "switch colorfilters to sk_sp (patchset #11 id:200001 of https://codereview.chromium.org/1822623002/ )"
> >
> > Fixed legacy withColorFilter to call new(er) make method
> >
> > This reverts commit 1eb81db650d31f50be67b12d60c4f9e7dd08432f.
> >
> > BUG=skia:
> > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1825073002
> >
> > TBR=
> >
> > Committed: https://skia.googlesource.com/skia/+/4c9776b046dd5e9e46e2d1ce35154855c8fcb381
>
> TBR=
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/d6889293dd0942f27f9593f679722c956831f2c4
TBR=
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=skia:
Review URL: https://codereview.chromium.org/1827433002
Diffstat (limited to 'gm/color4f.cpp')
-rw-r--r-- | gm/color4f.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/gm/color4f.cpp b/gm/color4f.cpp index 2d5b7d2c1a..ec9bbcbfba 100644 --- a/gm/color4f.cpp +++ b/gm/color4f.cpp @@ -22,43 +22,43 @@ static sk_sp<SkShader> make_alpha_color() { return SkShader::MakeColorShader(0x80FF0000); } -static SkColorFilter* make_cf_null() { +static sk_sp<SkColorFilter> make_cf_null() { return nullptr; } -static SkColorFilter* make_cf0() { +static sk_sp<SkColorFilter> make_cf0() { SkColorMatrix cm; cm.setSaturation(0.75f); - return SkColorMatrixFilter::Create(cm); + return SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat); } -static SkColorFilter* make_cf1() { +static sk_sp<SkColorFilter> make_cf1() { SkColorMatrix cm; cm.setSaturation(0.75f); - SkAutoTUnref<SkColorFilter> a(SkColorMatrixFilter::Create(cm)); + auto a(SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat)); // CreateComposedFilter will try to concat these two matrices, resulting in a single // filter (which is good for speed). For this test, we want to force a real compose of // these two, so our inner filter has a scale-up, which disables the optimization of // combining the two matrices. cm.setScale(1.1f, 0.9f, 1); - SkAutoTUnref<SkColorFilter> b(SkColorMatrixFilter::Create(cm)); - return SkColorFilter::CreateComposeFilter(a, b); + auto b(SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat)); + return SkColorFilter::MakeComposeFilter(a, b); } -static SkColorFilter* make_cf2() { - return SkColorFilter::CreateModeFilter(0x8044CC88, SkXfermode::kSrcATop_Mode); +static sk_sp<SkColorFilter> make_cf2() { + return SkColorFilter::MakeModeFilter(0x8044CC88, SkXfermode::kSrcATop_Mode); } static void draw_into_canvas(SkCanvas* canvas) { const SkRect r = SkRect::MakeWH(50, 100); sk_sp<SkShader> (*shaders[])() { make_opaque_color, make_alpha_color }; - SkColorFilter* (*filters[])() { make_cf_null, make_cf0, make_cf1, make_cf2 }; + sk_sp<SkColorFilter> (*filters[])() { make_cf_null, make_cf0, make_cf1, make_cf2 }; SkPaint paint; for (auto shProc : shaders) { paint.setShader(shProc()); for (auto cfProc : filters) { - SkSafeUnref(paint.setColorFilter(cfProc())); + paint.setColorFilter(cfProc()); canvas->drawRect(r, paint); canvas->translate(60, 0); } |