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

Unified Diff: include/core/SkImageFilter.h

Issue 1308703007: Fix filter primitive bounds computations. (Closed) Base URL: https://skia.googlesource.com/skia.git@saveLayer-bounds-not-transformed
Patch Set: 100-col fixes 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 | « no previous file | include/effects/SkBlurImageFilter.h » ('j') | include/effects/SkBlurImageFilter.h » ('J')
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..08ebaf2696a2eed1f73f40326dfa538077700b17 100644
--- a/include/core/SkImageFilter.h
+++ b/include/core/SkImageFilter.h
@@ -346,6 +346,24 @@ protected:
// implementation recursively unions all input bounds, or returns false if
// no inputs.
virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*) const;
+ enum MapDirection {
+ kForward_MapDirection,
+ kReverse_MapDirection
+ };
+
+ // Performs a forwards or reverse mapping of the given rect to accommodate
reed1 2015/12/09 16:11:41 nit: can we use /** comment style here? Partly for
Stephen White 2015/12/09 17:02:57 Done.
+ // this filter's margin requirements. kForward_MapDirection is used to
+ // determine the destination pixels which would be touched by filtering
+ // the given given source rect (e.g., given source bitmap bounds,
+ // determine the optimal bounds of the filtered offscreen bitmap).
+ // kReverse_MapDirection is used to determine which pixels of the
+ // input(s) would be required to fill the given destination rect
+ // (e.g., clip bounds). NOTE: these operations may not be the
+ // inverse of the other. For example, blurring expands the given rect
+ // in both forward and reverse directions. Unlike
+ // onFilterBounds(), this function is non-recursive.
+ virtual void onFilterNodeBounds(const SkIRect&, const SkMatrix&, SkIRect*,
+ MapDirection direction) const;
// Helper function which invokes filter processing on the input at the
// specified "index". If the input is null, it leaves "result" and
@@ -405,6 +423,14 @@ protected:
virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const SkMatrix&,
const SkIRect& bounds) const;
+ /**
+ * Creates a modified Context for use when recursing up the image filter DAG.
+ * The clip bounds are adjusted to accommodate any margins that this
+ * filter requires by calling this node's
+ * onFilterNodeBounds(..., kReverse_MapDirection).
+ */
+ Context mapContext(const Context& ctx) const;
+
private:
friend class SkGraphics;
static void PurgeCache();
« no previous file with comments | « no previous file | include/effects/SkBlurImageFilter.h » ('j') | include/effects/SkBlurImageFilter.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698