Index: include/core/SkImageFilter.h |
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h |
index 909a2f82840e93c2c6842a3407ef3b67ec3eb893..d90df29c8bfeaabfba887417c17b6e7f8447e83b 100644 |
--- a/include/core/SkImageFilter.h |
+++ b/include/core/SkImageFilter.h |
@@ -199,7 +199,12 @@ |
* replaced by the returned colorfilter. i.e. the two effects will affect drawing in the |
* same way. |
*/ |
- bool asAColorFilter(SkColorFilter** filterPtr) const; |
+ bool asAColorFilter(SkColorFilter** filterPtr) const { |
+ return this->countInputs() > 0 && |
+ NULL == this->getInput(0) && |
+ !this->affectsTransparentBlack() && |
+ this->isColorFilterNode(filterPtr); |
+ } |
/** |
* Returns the number of inputs this filter will accept (some inputs can |
@@ -235,7 +240,7 @@ |
virtual void computeFastBounds(const SkRect&, SkRect*) const; |
// Can this filter DAG compute the resulting bounds of an object-space rectangle? |
- virtual bool canComputeFastBounds() const; |
+ bool canComputeFastBounds() const; |
/** |
* If this filter can be represented by another filter + a localMatrix, return that filter, |
@@ -405,6 +410,14 @@ |
virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const SkMatrix&, |
const SkIRect& bounds) const; |
+ /** |
+ * Returns true if this filter can cause transparent black pixels to become |
+ * visible (ie., alpha > 0). The default implementation returns false. This |
+ * function is non-recursive, i.e., only queries this filter and not its |
+ * inputs. |
+ */ |
+ virtual bool affectsTransparentBlack() const; |
+ |
private: |
friend class SkGraphics; |
static void PurgeCache(); |