aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkLocalMatrixImageFilter.cpp
diff options
context:
space:
mode:
authorGravatar djsollen <djsollen@google.com>2016-03-29 19:07:07 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-29 19:07:07 -0700
commit890579051d4096a8f769eadb9cde3f931d7abd7c (patch)
tree3c683bc8f4fc81d6b48fbf763c50540c39a64098 /src/core/SkLocalMatrixImageFilter.cpp
parent308d988cba909ffbb456d4f327820a57df0d1d51 (diff)
Revert of Switch SkLocalMatrixImageFilter and SkPaintImageFilter over to sk_sp (patchset #6 id:100001 of https://codereview.chromium.org/1842793002/ )
Reason for revert: This CL is causing the autoroll into Chromium & google3 to fail. Original issue's description: > Switch SkLocalMatrixImageFilter and SkPaintImageFilter over to sk_sp > > TBR=reed@google.com > > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1842793002 > > Committed: https://skia.googlesource.com/skia/+/a33cf07a2273315363c0b6fb5d3ce811742f5a85 TBR=fmalita@chromium.org,reed@google.com,robertphillips@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/1837293003
Diffstat (limited to 'src/core/SkLocalMatrixImageFilter.cpp')
-rw-r--r--src/core/SkLocalMatrixImageFilter.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/core/SkLocalMatrixImageFilter.cpp b/src/core/SkLocalMatrixImageFilter.cpp
index d1b5715b7f..15f2f0ef00 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 @@ SkFlattenable* SkLocalMatrixImageFilter::CreateProc(SkReadBuffer& buffer) {
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 {