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

Unified Diff: src/core/SkImageFilter.cpp

Issue 137423005: Implement a computeFastBounds() traversal for SkImageFilter. This allows for correct culling of pri… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix Win build; update to ToT Created 6 years, 11 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/effects/SkOffsetImageFilter.h ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkImageFilter.cpp
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index d62685a17c4e26322326c24ae2d465bac2584c82..cb1d9fb57129cd1925699197956df5e73879718a 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -111,6 +111,28 @@ bool SkImageFilter::filterBounds(const SkIRect& src, const SkMatrix& ctm,
return this->onFilterBounds(src, ctm, dst);
}
+void SkImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) const {
+ if (0 == fInputCount) {
+ *dst = src;
+ return;
+ }
+ if (this->getInput(0)) {
+ this->getInput(0)->computeFastBounds(src, dst);
+ } else {
+ *dst = src;
+ }
+ for (int i = 1; i < fInputCount; i++) {
+ SkImageFilter* input = this->getInput(i);
+ if (input) {
+ SkRect bounds;
+ input->computeFastBounds(src, &bounds);
+ dst->join(bounds);
+ } else {
+ dst->join(src);
+ }
+ }
+}
+
bool SkImageFilter::onFilterImage(Proxy*, const SkBitmap&, const SkMatrix&,
SkBitmap*, SkIPoint*) {
return false;
« no previous file with comments | « include/effects/SkOffsetImageFilter.h ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698