aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-11-09 14:30:48 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-11-09 14:30:48 +0000
commitd729b3e504ae547ee0978e8f7156bd8dd8124172 (patch)
treea624aa987b6f8282e5adab0d2136d1461faba2ed /include
parentd9f7503e0cb0c4db856f53b4bdeec1332db6f296 (diff)
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
Diffstat (limited to 'include')
-rw-r--r--include/core/SkMaskFilter.h26
1 files changed, 26 insertions, 0 deletions
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;