From d729b3e504ae547ee0978e8f7156bd8dd8124172 Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Fri, 9 Nov 2012 14:30:48 +0000 Subject: add entry-point to SkMaskFilter to fast-path rectangles. have blurmaskfilter override this new method. #define SK_IGNORE_FAST_BLURRECT if you want to disable this (not sure if we'll need this) Review URL: https://codereview.appspot.com/6815087 git-svn-id: http://skia.googlecode.com/svn/trunk@6363 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/core/SkMaskFilter.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'include') diff --git a/include/core/SkMaskFilter.h b/include/core/SkMaskFilter.h index 8dc7a6ab69..6bdc5335e8 100644 --- a/include/core/SkMaskFilter.h +++ b/include/core/SkMaskFilter.h @@ -105,6 +105,32 @@ protected: // empty for now, but lets get our subclass to remember to init us for the future SkMaskFilter(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} + enum FilterReturn { + kFalse_FilterReturn, + kTrue_FilterReturn, + kUnimplemented_FilterReturn + }; + + /** + * Override if your subclass can filter a rect, and return the answer as + * a ninepatch mask to be stretched over the returned outerRect. On success + * return kTrue_FilterReturn. On failure (e.g. out of memory) return + * kFalse_FilterReturn. If the normal filterMask() entry-point should be + * called (the default) return kUnimplemented_FilterReturn. + * + * By convention, the caller will take the center rol/col from the returned + * mask as the slice it can replicate horizontally and vertically as we + * stretch the mask to fit inside outerRect. It is an error for outerRect + * to be smaller than the mask's bounds. This would imply that the width + * and height of the mask should be odd. This is not required, just that + * the caller will call mask.fBounds.centerX() and centerY() to find the + * strips that will be replicated. + */ + virtual FilterReturn filterRectToNine(const SkRect&, const SkMatrix&, + const SkIRect& clipBounds, + SkMask* ninePatchMask, + SkIRect* outerRect); + private: friend class SkDraw; -- cgit v1.2.3