Index: include/core/SkImageFilter.h |
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h |
index 909a2f82840e93c2c6842a3407ef3b67ec3eb893..e9f856be209949f4153aa4436f0e6cba121acae0 100644 |
--- a/include/core/SkImageFilter.h |
+++ b/include/core/SkImageFilter.h |
@@ -156,6 +156,12 @@ public: |
*/ |
bool filterBounds(const SkIRect& src, const SkMatrix& ctm, SkIRect* dst) const; |
+ Context mapContext(const Context& ctx) const { |
+ SkIRect clipBounds; |
+ this->onFilterNodeBounds(ctx.clipBounds(), ctx.ctm(), &clipBounds, MapDirection::kReverse_MapDirection); |
+ return Context(ctx.ctm(), clipBounds, ctx.cache(), ctx.sizeConstraint()); |
+ } |
+ |
/** |
* Returns true if the filter can be processed on the GPU. This is most |
* often used for multi-pass effects, where intermediate results must be |
@@ -346,6 +352,13 @@ 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 |
+ }; |
+ |
+ // Non-recursive version of the above. |
+ 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 |