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

Unified Diff: include/core/SkImageFilter.h

Issue 1301823005: Reland of Implement canComputeFastBounds() for image filters. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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 | « include/core/SkColorFilter.h ('k') | include/core/SkPaint.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 dce6b133b46b79d32bfcbf7dad13223fb61af148..5870f7f2d66c95fef304c06da68a4a7e6bbca969 100644
--- a/include/core/SkImageFilter.h
+++ b/include/core/SkImageFilter.h
@@ -178,6 +178,7 @@
bool asAColorFilter(SkColorFilter** filterPtr) const {
return this->countInputs() > 0 &&
NULL == this->getInput(0) &&
+ !this->affectsTransparentBlack() &&
this->isColorFilterNode(filterPtr);
}
@@ -213,6 +214,9 @@
// Default impl returns union of all input bounds.
virtual void computeFastBounds(const SkRect&, SkRect*) const;
+
+ // Can this filter DAG compute the resulting bounds of an object-space rectangle?
+ bool canComputeFastBounds() const;
/**
* Create an SkMatrixImageFilter, which transforms its input by the given matrix.
@@ -362,6 +366,14 @@
virtual bool asFragmentProcessor(GrFragmentProcessor**, GrProcessorDataManager*, 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 | « include/core/SkColorFilter.h ('k') | include/core/SkPaint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698