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

Unified Diff: include/core/SkImageFilter.h

Issue 982933002: Use ComposColorFilter to collaps hierarchy (when possible). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix unused parameter warning Created 5 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 | « no previous file | include/effects/SkColorFilterImageFilter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkImageFilter.h
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h
index a65a24c3ee45b5cbc098869ac6c5d4269ebb5633..cb18f7c615c5dff04208a9f9ff5acd425f2a9f66 100644
--- a/include/core/SkImageFilter.h
+++ b/include/core/SkImageFilter.h
@@ -142,7 +142,25 @@ public:
* If this returns true, then if filterPtr is not null, it must be set to a ref'd colorfitler
* (i.e. it may not be set to NULL).
*/
- virtual bool asColorFilter(SkColorFilter** filterPtr) const;
+ bool isColorFilterNode(SkColorFilter** filterPtr) const {
+ return this->onIsColorFilterNode(filterPtr);
+ }
+
+ // DEPRECATED : use isColorFilterNode() instead
+ bool asColorFilter(SkColorFilter** filterPtr) const {
+ return this->isColorFilterNode(filterPtr);
+ }
+
+ /**
+ * Returns true (and optionally returns a ref'd filter) if this imagefilter can be completely
+ * replaced by the returned colorfilter. i.e. the two effects will affect drawing in the
+ * same way.
+ */
+ bool asAColorFilter(SkColorFilter** filterPtr) const {
+ return this->countInputs() > 0 &&
+ NULL == this->getInput(0) &&
+ this->isColorFilterNode(filterPtr);
+ }
/**
* Returns the number of inputs this filter will accept (some inputs can
@@ -271,6 +289,14 @@ protected:
// no inputs.
virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*) const;
+ /**
+ * Return true (and return a ref'd colorfilter) if this node in the DAG is just a
+ * colorfilter w/o CropRect constraints.
+ */
+ virtual bool onIsColorFilterNode(SkColorFilter** /*filterPtr*/) const {
+ return false;
+ }
+
/** Computes source bounds as the src bitmap bounds offset by srcOffset.
* Apply the transformed crop rect to the bounds if any of the
* corresponding edge flags are set. Intersects the result against the
« no previous file with comments | « no previous file | include/effects/SkColorFilterImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698