Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(481)

Unified Diff: src/effects/SkXfermodeImageFilter.cpp

Issue 1832223002: switch xfermodes over to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/effects/SkXfermodeImageFilter.cpp
diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp
index 8f7fdc70e3224db77b29d4bdf3cfcad46091f859..8cd75127baadfa21d3fd57bcc58bca8c9dfdc23e 100644
--- a/src/effects/SkXfermodeImageFilter.cpp
+++ b/src/effects/SkXfermodeImageFilter.cpp
@@ -23,22 +23,30 @@
///////////////////////////////////////////////////////////////////////////////
-SkXfermodeImageFilter::SkXfermodeImageFilter(SkXfermode* mode,
+sk_sp<SkImageFilter> SkXfermodeImageFilter::Make(sk_sp<SkXfermode> mode, SkImageFilter* background,
+ SkImageFilter* foreground,
+ const CropRect* cropRect) {
+ SkImageFilter* inputs[2] = { background, foreground };
+ return sk_sp<SkImageFilter>(new SkXfermodeImageFilter(mode, inputs, cropRect));
+}
+
+SkXfermodeImageFilter::SkXfermodeImageFilter(sk_sp<SkXfermode> mode,
SkImageFilter* inputs[2],
const CropRect* cropRect)
: INHERITED(2, inputs, cropRect)
- , fMode(SkSafeRef(mode)) {
-}
+ , fMode(std::move(mode))
+{}
SkFlattenable* SkXfermodeImageFilter::CreateProc(SkReadBuffer& buffer) {
SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 2);
- SkAutoTUnref<SkXfermode> mode(buffer.readXfermode());
- return Create(mode, common.getInput(0), common.getInput(1), &common.cropRect());
+ sk_sp<SkXfermode> mode(buffer.readXfermode());
+ return Make(std::move(mode), common.getInput(0),
+ common.getInput(1), &common.cropRect()).release();
}
void SkXfermodeImageFilter::flatten(SkWriteBuffer& buffer) const {
this->INHERITED::flatten(buffer);
- buffer.writeFlattenable(fMode);
+ buffer.writeFlattenable(fMode.get());
}
bool SkXfermodeImageFilter::onFilterImageDeprecated(Proxy* proxy,

Powered by Google App Engine
This is Rietveld 408576698