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

Unified Diff: src/core/SkImageFilter.cpp

Issue 1842793002: Switch SkLocalMatrixImageFilter and SkPaintImageFilter over to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Ooops 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/SkLocalMatrixImageFilter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkImageFilter.cpp
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 06076c6891101e4f6c4cd71b94fb40ab61f0e3c8..e999d3aebb3ef885b0ea82926a11eb7319c76190 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -158,6 +158,22 @@ bool SkImageFilter::Common::unflatten(SkReadBuffer& buffer, int expectedCount) {
///////////////////////////////////////////////////////////////////////////////////////////////////
+SkImageFilter::SkImageFilter(sk_sp<SkImageFilter>* inputs,
+ int inputCount,
+ const CropRect* cropRect)
+ : fInputCount(inputCount),
+ fInputs(new SkImageFilter*[inputCount]),
+ fUsesSrcInput(false),
+ fCropRect(cropRect ? *cropRect : CropRect(SkRect(), 0x0)),
+ fUniqueID(next_image_filter_unique_id()) {
+ for (int i = 0; i < inputCount; ++i) {
+ if (nullptr == inputs[i] || inputs[i]->usesSrcInput()) {
+ fUsesSrcInput = true;
+ }
+ fInputs[i] = SkSafeRef(inputs[i].get());
+ }
+}
+
SkImageFilter::SkImageFilter(int inputCount, SkImageFilter** inputs, const CropRect* cropRect)
: fInputCount(inputCount),
fInputs(new SkImageFilter*[inputCount]),
@@ -168,8 +184,7 @@ SkImageFilter::SkImageFilter(int inputCount, SkImageFilter** inputs, const CropR
if (nullptr == inputs[i] || inputs[i]->usesSrcInput()) {
fUsesSrcInput = true;
}
- fInputs[i] = inputs[i];
- SkSafeRef(fInputs[i]);
+ fInputs[i] = SkSafeRef(inputs[i]);
}
}
@@ -556,11 +571,12 @@ SkImageFilter* SkImageFilter::CreateMatrixFilter(const SkMatrix& matrix,
return SkMatrixImageFilter::Create(matrix, filterQuality, input);
}
-SkImageFilter* SkImageFilter::newWithLocalMatrix(const SkMatrix& matrix) const {
+sk_sp<SkImageFilter> SkImageFilter::makeWithLocalMatrix(const SkMatrix& matrix) const {
// SkLocalMatrixImageFilter takes SkImage* in its factory, but logically that parameter
// is *always* treated as a const ptr. Hence the const-cast here.
//
- return SkLocalMatrixImageFilter::Create(matrix, const_cast<SkImageFilter*>(this));
+ SkImageFilter* nonConstThis = const_cast<SkImageFilter*>(this);
+ return SkLocalMatrixImageFilter::Make(matrix, sk_ref_sp<SkImageFilter>(nonConstThis));
}
sk_sp<SkSpecialImage> SkImageFilter::filterInput(int index,
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkLocalMatrixImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698