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

Unified Diff: src/core/SkLocalMatrixImageFilter.cpp

Issue 1837293003: Revert of Switch SkLocalMatrixImageFilter and SkPaintImageFilter over 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/SkLocalMatrixImageFilter.h ('k') | src/effects/SkPaintImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkLocalMatrixImageFilter.cpp
diff --git a/src/core/SkLocalMatrixImageFilter.cpp b/src/core/SkLocalMatrixImageFilter.cpp
index d1b5715b7fe19c541aaad6e04bbe5f21ce80827d..15f2f0ef007cbc91ce713897b1f013e97d523cd8 100644
--- a/src/core/SkLocalMatrixImageFilter.cpp
+++ b/src/core/SkLocalMatrixImageFilter.cpp
@@ -10,9 +10,21 @@
#include "SkSpecialImage.h"
#include "SkString.h"
-SkLocalMatrixImageFilter::SkLocalMatrixImageFilter(const SkMatrix& localM,
- sk_sp<SkImageFilter> input)
- : INHERITED(&input, 1, nullptr)
+SkImageFilter* SkLocalMatrixImageFilter::Create(const SkMatrix& localM, SkImageFilter* input) {
+ if (!input) {
+ return nullptr;
+ }
+ if (localM.getType() & (SkMatrix::kAffine_Mask | SkMatrix::kPerspective_Mask)) {
+ return nullptr;
+ }
+ if (localM.isIdentity()) {
+ return SkRef(input);
+ }
+ return new SkLocalMatrixImageFilter(localM, input);
+}
+
+SkLocalMatrixImageFilter::SkLocalMatrixImageFilter(const SkMatrix& localM, SkImageFilter* input)
+ : INHERITED(1, &input)
, fLocalM(localM) {
}
@@ -20,8 +32,7 @@
SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1);
SkMatrix lm;
buffer.readMatrix(&lm);
- return SkLocalMatrixImageFilter::Make(lm,
- sk_ref_sp<SkImageFilter>(common.getInput(0))).release();
+ return SkLocalMatrixImageFilter::Create(lm, common.getInput(0));
}
void SkLocalMatrixImageFilter::flatten(SkWriteBuffer& buffer) const {
« no previous file with comments | « src/core/SkLocalMatrixImageFilter.h ('k') | src/effects/SkPaintImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698