Update SkColorFilterImageFilter to sk_sp
TBR=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1858813002
Review URL: https://codereview.chromium.org/1858813002
diff --git a/gm/colorfilterimagefilter.cpp b/gm/colorfilterimagefilter.cpp
index 38ff0dd..6031ba7 100644
--- a/gm/colorfilterimagefilter.cpp
+++ b/gm/colorfilterimagefilter.cpp
@@ -92,30 +92,27 @@
}
static sk_sp<SkImageFilter> make_brightness(float amount, sk_sp<SkImageFilter> input) {
- return sk_sp<SkImageFilter>(SkColorFilterImageFilter::Create(cf_make_brightness(amount).get(),
- input.get()));
+ return SkColorFilterImageFilter::Make(cf_make_brightness(amount), std::move(input));
}
static sk_sp<SkImageFilter> make_grayscale(sk_sp<SkImageFilter> input) {
- return sk_sp<SkImageFilter>(SkColorFilterImageFilter::Create(cf_make_grayscale().get(),
- input.get()));
+ return SkColorFilterImageFilter::Make(cf_make_grayscale(), std::move(input));
}
static sk_sp<SkImageFilter> make_mode_blue(sk_sp<SkImageFilter> input) {
- return sk_sp<SkImageFilter>(SkColorFilterImageFilter::Create(cf_make_colorize(SK_ColorBLUE).get(),
- input.get()));
+ return SkColorFilterImageFilter::Make(cf_make_colorize(SK_ColorBLUE), std::move(input));
}
static void draw_clipped_rect(SkCanvas* canvas,
const SkRect& r,
const SkPaint& paint,
float outset = 0.0f) {
- canvas->save();
- SkRect clip(r);
- clip.outset(outset, outset);
- canvas->clipRect(clip);
- canvas->drawRect(r, paint);
- canvas->restore();
+ canvas->save();
+ SkRect clip(r);
+ clip.outset(outset, outset);
+ canvas->clipRect(clip);
+ canvas->drawRect(r, paint);
+ canvas->restore();
}
DEF_SIMPLE_GM(colorfilterimagefilter, canvas, 400, 100){
@@ -179,10 +176,9 @@
SkAutoCanvasRestore autoCanvasRestore(canvas, false);
SkColorMatrix cm;
cm.setSaturation(0.0f);
- auto cf(SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat));
- sk_sp<SkImageFilter> imf(SkColorFilterImageFilter::Create(cf.get()));
+ sk_sp<SkColorFilter> cf(SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat));
SkPaint p;
- p.setImageFilter(std::move(imf));
+ p.setImageFilter(SkColorFilterImageFilter::Make(std::move(cf), nullptr));
canvas->saveLayer(NULL, &p);
canvas->clear(SK_ColorRED);
}