aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/color4f.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-03-22 07:35:17 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-22 07:35:17 -0700
commit1eb81db650d31f50be67b12d60c4f9e7dd08432f (patch)
tree58a5fd565f06a398192be170009fefa2a12a1ee2 /gm/color4f.cpp
parentee451cf09de31267c93b64e1fdac7c823cee7e85 (diff)
Revert of switch colorfilters to sk_sp (patchset #11 id:200001 of https://codereview.chromium.org/1822623002/ )
Reason for revert: need to fix unguarded makeWithFilter Original issue's description: > switch colorfilters to sk_sp > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1822623002 > > Committed: https://skia.googlesource.com/skia/+/f809d7687a4fb7b88b651b046da2bc0035d6aa09 TBR=fmalita@chromium.org # 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/1820303002
Diffstat (limited to 'gm/color4f.cpp')
-rw-r--r--gm/color4f.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/gm/color4f.cpp b/gm/color4f.cpp
index ec9bbcbfba..2d5b7d2c1a 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 sk_sp<SkColorFilter> make_cf_null() {
+static SkColorFilter* make_cf_null() {
return nullptr;
}
-static sk_sp<SkColorFilter> make_cf0() {
+static SkColorFilter* make_cf0() {
SkColorMatrix cm;
cm.setSaturation(0.75f);
- return SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat);
+ return SkColorMatrixFilter::Create(cm);
}
-static sk_sp<SkColorFilter> make_cf1() {
+static SkColorFilter* make_cf1() {
SkColorMatrix cm;
cm.setSaturation(0.75f);
- auto a(SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat));
+ SkAutoTUnref<SkColorFilter> a(SkColorMatrixFilter::Create(cm));
// 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);
- auto b(SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat));
- return SkColorFilter::MakeComposeFilter(a, b);
+ SkAutoTUnref<SkColorFilter> b(SkColorMatrixFilter::Create(cm));
+ return SkColorFilter::CreateComposeFilter(a, b);
}
-static sk_sp<SkColorFilter> make_cf2() {
- return SkColorFilter::MakeModeFilter(0x8044CC88, SkXfermode::kSrcATop_Mode);
+static SkColorFilter* make_cf2() {
+ return SkColorFilter::CreateModeFilter(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 };
- sk_sp<SkColorFilter> (*filters[])() { make_cf_null, make_cf0, make_cf1, make_cf2 };
+ SkColorFilter* (*filters[])() { make_cf_null, make_cf0, make_cf1, make_cf2 };
SkPaint paint;
for (auto shProc : shaders) {
paint.setShader(shProc());
for (auto cfProc : filters) {
- paint.setColorFilter(cfProc());
+ SkSafeUnref(paint.setColorFilter(cfProc()));
canvas->drawRect(r, paint);
canvas->translate(60, 0);
}