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

Unified Diff: src/effects/SkColorFilterImageFilter.cpp

Issue 1822623002: switch colorfilters 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
« no previous file with comments | « src/effects/SkColorCubeFilter.cpp ('k') | src/effects/SkColorMatrixFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkColorFilterImageFilter.cpp
diff --git a/src/effects/SkColorFilterImageFilter.cpp b/src/effects/SkColorFilterImageFilter.cpp
index 96ce5d9690588867945886330a4dc723b4450fd9..6eb66533d90a96846610a9c7674d784b19e34a3e 100644
--- a/src/effects/SkColorFilterImageFilter.cpp
+++ b/src/effects/SkColorFilterImageFilter.cpp
@@ -25,10 +25,10 @@ SkImageFilter* SkColorFilterImageFilter::Create(SkColorFilter* cf, SkImageFilter
if (input && input->isColorFilterNode(&inputCF)) {
// This is an optimization, as it collapses the hierarchy by just combining the two
// colorfilters into a single one, which the new imagefilter will wrap.
- SkAutoUnref autoUnref(inputCF);
- SkAutoTUnref<SkColorFilter> newCF(SkColorFilter::CreateComposeFilter(cf, inputCF));
+ sk_sp<SkColorFilter> newCF(SkColorFilter::MakeComposeFilter(sk_ref_sp(cf),
+ sk_sp<SkColorFilter>(inputCF)));
if (newCF) {
- return new SkColorFilterImageFilter(newCF, input->getInput(0), cropRect);
+ return new SkColorFilterImageFilter(newCF.get(), input->getInput(0), cropRect);
}
}
@@ -42,17 +42,13 @@ SkColorFilterImageFilter::SkColorFilterImageFilter(SkColorFilter* cf,
SkFlattenable* SkColorFilterImageFilter::CreateProc(SkReadBuffer& buffer) {
SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1);
- SkAutoTUnref<SkColorFilter> cf(buffer.readColorFilter());
- return Create(cf, common.getInput(0), &common.cropRect());
+ sk_sp<SkColorFilter> cf(buffer.readColorFilter());
+ return Create(cf.get(), common.getInput(0), &common.cropRect());
}
void SkColorFilterImageFilter::flatten(SkWriteBuffer& buffer) const {
this->INHERITED::flatten(buffer);
- buffer.writeFlattenable(fColorFilter);
-}
-
-SkColorFilterImageFilter::~SkColorFilterImageFilter() {
- fColorFilter->unref();
+ buffer.writeFlattenable(fColorFilter.get());
}
bool SkColorFilterImageFilter::onFilterImageDeprecated(Proxy* proxy, const SkBitmap& source,
@@ -94,7 +90,7 @@ bool SkColorFilterImageFilter::onIsColorFilterNode(SkColorFilter** filter) const
SkASSERT(1 == this->countInputs());
if (!this->cropRectIsSet()) {
if (filter) {
- *filter = SkRef(fColorFilter);
+ *filter = SkRef(fColorFilter.get());
}
return true;
}
« no previous file with comments | « src/effects/SkColorCubeFilter.cpp ('k') | src/effects/SkColorMatrixFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698