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

Unified Diff: src/effects/SkColorFilterImageFilter.cpp

Issue 1858813002: Update SkColorFilterImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 4 years, 8 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 | « samplecode/SampleFilterFuzz.cpp ('k') | tests/ImageFilterTest.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 1fdc668f9b42ae6a446452c6a7a5b23ec5baf53f..8d412cc2f5579967e9d304c443183f5b5855ae7b 100644
--- a/src/effects/SkColorFilterImageFilter.cpp
+++ b/src/effects/SkColorFilterImageFilter.cpp
@@ -14,8 +14,9 @@
#include "SkSpecialSurface.h"
#include "SkWriteBuffer.h"
-SkImageFilter* SkColorFilterImageFilter::Create(SkColorFilter* cf, SkImageFilter* input,
- const CropRect* cropRect) {
+sk_sp<SkImageFilter> SkColorFilterImageFilter::Make(sk_sp<SkColorFilter> cf,
+ sk_sp<SkImageFilter> input,
+ const CropRect* cropRect) {
if (!cf) {
return nullptr;
}
@@ -24,27 +25,31 @@ 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.
- sk_sp<SkColorFilter> newCF(SkColorFilter::MakeComposeFilter(sk_ref_sp(cf),
+ sk_sp<SkColorFilter> newCF(SkColorFilter::MakeComposeFilter(cf,// can't move bc of fallthru
sk_sp<SkColorFilter>(inputCF)));
if (newCF) {
- return new SkColorFilterImageFilter(newCF.get(), input->getInput(0), cropRect);
+ return sk_sp<SkImageFilter>(new SkColorFilterImageFilter(std::move(newCF),
+ sk_ref_sp(input->getInput(0)),
+ cropRect));
}
}
- return new SkColorFilterImageFilter(cf, input, cropRect);
+ return sk_sp<SkImageFilter>(new SkColorFilterImageFilter(std::move(cf),
+ std::move(input),
+ cropRect));
}
-SkColorFilterImageFilter::SkColorFilterImageFilter(SkColorFilter* cf,
- SkImageFilter* input,
+SkColorFilterImageFilter::SkColorFilterImageFilter(sk_sp<SkColorFilter> cf,
+ sk_sp<SkImageFilter> input,
const CropRect* cropRect)
- : INHERITED(1, &input, cropRect)
- , fColorFilter(SkRef(cf)) {
+ : INHERITED(&input, 1, cropRect)
+ , fColorFilter(std::move(cf)) {
}
sk_sp<SkFlattenable> SkColorFilterImageFilter::CreateProc(SkReadBuffer& buffer) {
SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1);
sk_sp<SkColorFilter> cf(buffer.readColorFilter());
- return sk_sp<SkFlattenable>(Create(cf.get(), common.getInput(0).get(), &common.cropRect()));
+ return Make(std::move(cf), common.getInput(0), &common.cropRect());
}
void SkColorFilterImageFilter::flatten(SkWriteBuffer& buffer) const {
« no previous file with comments | « samplecode/SampleFilterFuzz.cpp ('k') | tests/ImageFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698