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

Unified Diff: src/core/SkColorFilter.cpp

Issue 1825073002: Revert[2] of "switch colorfilters to sk_sp (patchset #11 id:200001 of https://codereview.chromium.o… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove flag 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/core/SkCanvas.cpp ('k') | src/core/SkColorFilterShader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkColorFilter.cpp
diff --git a/src/core/SkColorFilter.cpp b/src/core/SkColorFilter.cpp
index dab4ccf7b55d09f8aa791804c3bb5e1bb176cf33..59a625d0b6d4b0b7f54a3b0354d3f5992fe2d4e1 100644
--- a/src/core/SkColorFilter.cpp
+++ b/src/core/SkColorFilter.cpp
@@ -114,14 +114,15 @@ public:
protected:
void flatten(SkWriteBuffer& buffer) const override {
- buffer.writeFlattenable(fOuter);
- buffer.writeFlattenable(fInner);
+ buffer.writeFlattenable(fOuter.get());
+ buffer.writeFlattenable(fInner.get());
}
private:
- SkComposeColorFilter(SkColorFilter* outer, SkColorFilter* inner, int composedFilterCount)
- : fOuter(SkRef(outer))
- , fInner(SkRef(inner))
+ SkComposeColorFilter(sk_sp<SkColorFilter> outer, sk_sp<SkColorFilter> inner,
+ int composedFilterCount)
+ : fOuter(std::move(outer))
+ , fInner(std::move(inner))
, fComposedFilterCount(composedFilterCount)
{
SkASSERT(composedFilterCount >= 2);
@@ -132,9 +133,9 @@ private:
return fComposedFilterCount;
}
- SkAutoTUnref<SkColorFilter> fOuter;
- SkAutoTUnref<SkColorFilter> fInner;
- const int fComposedFilterCount;
+ sk_sp<SkColorFilter> fOuter;
+ sk_sp<SkColorFilter> fInner;
+ const int fComposedFilterCount;
friend class SkColorFilter;
@@ -142,23 +143,24 @@ private:
};
SkFlattenable* SkComposeColorFilter::CreateProc(SkReadBuffer& buffer) {
- SkAutoTUnref<SkColorFilter> outer(buffer.readColorFilter());
- SkAutoTUnref<SkColorFilter> inner(buffer.readColorFilter());
- return CreateComposeFilter(outer, inner);
+ sk_sp<SkColorFilter> outer(buffer.readColorFilter());
+ sk_sp<SkColorFilter> inner(buffer.readColorFilter());
+ return MakeComposeFilter(std::move(outer), std::move(inner)).release();
}
///////////////////////////////////////////////////////////////////////////////////////////////////
-SkColorFilter* SkColorFilter::CreateComposeFilter(SkColorFilter* outer, SkColorFilter* inner) {
+sk_sp<SkColorFilter> SkColorFilter::MakeComposeFilter(sk_sp<SkColorFilter> outer,
+ sk_sp<SkColorFilter> inner) {
if (!outer) {
- return SkSafeRef(inner);
+ return inner;
}
if (!inner) {
- return SkSafeRef(outer);
+ return outer;
}
// Give the subclass a shot at a more optimal composition...
- SkColorFilter* composition = outer->newComposed(inner);
+ auto composition = outer->makeComposed(inner);
if (composition) {
return composition;
}
@@ -167,7 +169,7 @@ SkColorFilter* SkColorFilter::CreateComposeFilter(SkColorFilter* outer, SkColorF
if (count > SK_MAX_COMPOSE_COLORFILTER_COUNT) {
return nullptr;
}
- return new SkComposeColorFilter(outer, inner, count);
+ return sk_sp<SkColorFilter>(new SkComposeColorFilter(std::move(outer), std::move(inner),count));
}
#include "SkModeColorFilter.h"
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkColorFilterShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698