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

Unified Diff: src/effects/SkColorFilterImageFilter.cpp

Issue 1820303002: Revert of switch colorfilters to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 6eb66533d90a96846610a9c7674d784b19e34a3e..96ce5d9690588867945886330a4dc723b4450fd9 100644
--- a/src/effects/SkColorFilterImageFilter.cpp
+++ b/src/effects/SkColorFilterImageFilter.cpp
@@ -25,10 +25,10 @@
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.
- sk_sp<SkColorFilter> newCF(SkColorFilter::MakeComposeFilter(sk_ref_sp(cf),
- sk_sp<SkColorFilter>(inputCF)));
+ SkAutoUnref autoUnref(inputCF);
+ SkAutoTUnref<SkColorFilter> newCF(SkColorFilter::CreateComposeFilter(cf, inputCF));
if (newCF) {
- return new SkColorFilterImageFilter(newCF.get(), input->getInput(0), cropRect);
+ return new SkColorFilterImageFilter(newCF, input->getInput(0), cropRect);
}
}
@@ -42,13 +42,17 @@
SkFlattenable* SkColorFilterImageFilter::CreateProc(SkReadBuffer& buffer) {
SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1);
- sk_sp<SkColorFilter> cf(buffer.readColorFilter());
- return Create(cf.get(), common.getInput(0), &common.cropRect());
+ SkAutoTUnref<SkColorFilter> cf(buffer.readColorFilter());
+ return Create(cf, common.getInput(0), &common.cropRect());
}
void SkColorFilterImageFilter::flatten(SkWriteBuffer& buffer) const {
this->INHERITED::flatten(buffer);
- buffer.writeFlattenable(fColorFilter.get());
+ buffer.writeFlattenable(fColorFilter);
+}
+
+SkColorFilterImageFilter::~SkColorFilterImageFilter() {
+ fColorFilter->unref();
}
bool SkColorFilterImageFilter::onFilterImageDeprecated(Proxy* proxy, const SkBitmap& source,
@@ -90,7 +94,7 @@
SkASSERT(1 == this->countInputs());
if (!this->cropRectIsSet()) {
if (filter) {
- *filter = SkRef(fColorFilter.get());
+ *filter = SkRef(fColorFilter);
}
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