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

Unified Diff: src/core/SkImageFilter.cpp

Issue 1908173006: allow imagefilter to manage CTM decomposition (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: switch to simple canHandleAffine pattern 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
Index: src/core/SkImageFilter.cpp
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 4128ba6cc20199f4489debfeb11a09add85609bc..6c73be29b59ff7bb0c5f7550b874854474c34853 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -330,6 +330,24 @@ bool SkImageFilter::asAColorFilter(SkColorFilter** filterPtr) const {
return true;
}
+bool SkImageFilter::onCanHandleAffine() const {
Stephen White 2016/04/25 14:09:34 Wouldn't it be simpler to have (non-virtual) canHa
reed1 2016/04/25 14:13:35 Good idea! See follow-on CL https://codereview.chr
+ bool hasInputs = false;
+
+ const int count = this->countInputs();
+ for (int i = 0; i < count; ++i) {
+ SkImageFilter* input = this->getInput(i);
+ if (input) {
+ if (!input->canHandleAffine()) {
+ return false;
+ }
+ hasInputs = true;
+ }
+ }
+ // We return true iff we had 1 or more inputs, and all of them can handle affine.
+ // If we have no inputs, or 1 or more of them do not handle affine, then we return false.
Stephen White 2016/04/25 14:09:34 Why would a null input imply we can't handle affin
+ return hasInputs;
+}
+
bool SkImageFilter::applyCropRect(const Context& ctx, const SkIRect& srcBounds,
SkIRect* dstBounds) const {
SkIRect temp = this->onFilterNodeBounds(srcBounds, ctx.ctm(), kForward_MapDirection);

Powered by Google App Engine
This is Rietveld 408576698