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

Unified Diff: src/core/SkColorFilter.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/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 59a625d0b6d4b0b7f54a3b0354d3f5992fe2d4e1..dab4ccf7b55d09f8aa791804c3bb5e1bb176cf33 100644
--- a/src/core/SkColorFilter.cpp
+++ b/src/core/SkColorFilter.cpp
@@ -114,15 +114,14 @@
protected:
void flatten(SkWriteBuffer& buffer) const override {
- buffer.writeFlattenable(fOuter.get());
- buffer.writeFlattenable(fInner.get());
+ buffer.writeFlattenable(fOuter);
+ buffer.writeFlattenable(fInner);
}
private:
- SkComposeColorFilter(sk_sp<SkColorFilter> outer, sk_sp<SkColorFilter> inner,
- int composedFilterCount)
- : fOuter(std::move(outer))
- , fInner(std::move(inner))
+ SkComposeColorFilter(SkColorFilter* outer, SkColorFilter* inner, int composedFilterCount)
+ : fOuter(SkRef(outer))
+ , fInner(SkRef(inner))
, fComposedFilterCount(composedFilterCount)
{
SkASSERT(composedFilterCount >= 2);
@@ -133,9 +132,9 @@
return fComposedFilterCount;
}
- sk_sp<SkColorFilter> fOuter;
- sk_sp<SkColorFilter> fInner;
- const int fComposedFilterCount;
+ SkAutoTUnref<SkColorFilter> fOuter;
+ SkAutoTUnref<SkColorFilter> fInner;
+ const int fComposedFilterCount;
friend class SkColorFilter;
@@ -143,24 +142,23 @@
};
SkFlattenable* SkComposeColorFilter::CreateProc(SkReadBuffer& buffer) {
- sk_sp<SkColorFilter> outer(buffer.readColorFilter());
- sk_sp<SkColorFilter> inner(buffer.readColorFilter());
- return MakeComposeFilter(std::move(outer), std::move(inner)).release();
+ SkAutoTUnref<SkColorFilter> outer(buffer.readColorFilter());
+ SkAutoTUnref<SkColorFilter> inner(buffer.readColorFilter());
+ return CreateComposeFilter(outer, inner);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
-sk_sp<SkColorFilter> SkColorFilter::MakeComposeFilter(sk_sp<SkColorFilter> outer,
- sk_sp<SkColorFilter> inner) {
+SkColorFilter* SkColorFilter::CreateComposeFilter(SkColorFilter* outer, SkColorFilter* inner) {
if (!outer) {
- return inner;
+ return SkSafeRef(inner);
}
if (!inner) {
- return outer;
+ return SkSafeRef(outer);
}
// Give the subclass a shot at a more optimal composition...
- auto composition = outer->makeComposed(inner);
+ SkColorFilter* composition = outer->newComposed(inner);
if (composition) {
return composition;
}
@@ -169,7 +167,7 @@
if (count > SK_MAX_COMPOSE_COLORFILTER_COUNT) {
return nullptr;
}
- return sk_sp<SkColorFilter>(new SkComposeColorFilter(std::move(outer), std::move(inner),count));
+ return new SkComposeColorFilter(outer, 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