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

Unified Diff: include/core/SkImageFilter.h

Issue 23011012: Implement correct clipping for image filters. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Add morphology to the list of ignored tests Created 6 years, 10 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/SkCanvas.h ('k') | include/effects/SkBitmapSource.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 37993c0ea3e2a527eafb2709061341c3e8fe86f3..6b539878916f98192b57cb0b643112512b177a63 100644
--- a/include/core/SkImageFilter.h
+++ b/include/core/SkImageFilter.h
@@ -83,7 +83,7 @@ public:
* Given the src bounds of an image, this returns the bounds of the result
* image after the filter has been applied.
*/
- bool filterBounds(const SkIRect& src, const SkMatrix& ctm, SkIRect* dst);
+ bool filterBounds(const SkIRect& src, const SkMatrix& ctm, SkIRect* dst) const;
/**
* Returns true if the filter can be processed on the GPU. This is most
@@ -188,8 +188,14 @@ protected:
*/
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset);
- // Default impl copies src into dst and returns true
- virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*);
+ // Given the bounds of the destination rect to be filled in device
+ // coordinates (first parameter), and the CTM, compute (conservatively)
+ // which rect of the source image would be required (third parameter).
+ // Used for clipping and temp-buffer allocations, so the result need not
+ // be exact, but should never be smaller than the real answer. The default
+ // implementation recursively unions all input bounds, or returns false if
+ // no inputs.
+ virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*) const;
// Applies "matrix" to the crop rect, and sets "rect" to the intersection of
// "rect" and the transformed crop rect. If there is no overlap, returns
« no previous file with comments | « include/core/SkCanvas.h ('k') | include/effects/SkBitmapSource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698