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

Unified Diff: include/core/SkImageFilter.h

Issue 1497083005: Revert of Matrix convolution bounds fix; affectsTransparentBlack fixes. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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 | « gm/matrixconvolution.cpp ('k') | 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 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();
« no previous file with comments | « gm/matrixconvolution.cpp ('k') | include/effects/SkColorFilterImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698