Index: include/core/SkDevice.h |
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h |
index 2377b57dfb7482f0ec40dd781245bd77dfb05b04..c15aeccf82dc52786b6899cfcdbfabc885fe9e36 100644 |
--- a/include/core/SkDevice.h |
+++ b/include/core/SkDevice.h |
@@ -280,6 +280,28 @@ |
*/ |
virtual const SkBitmap& onAccessBitmap() = 0; |
+ /** |
+ * Override and return true for filters that the device can handle |
+ * intrinsically. Doing so means that SkCanvas will pass-through this |
+ * filter to drawSprite and drawDevice (and potentially filterImage). |
+ * Returning false means the SkCanvas will have apply the filter itself, |
+ * and just pass the resulting image to the device. |
+ */ |
+ virtual bool canHandleImageFilter(const SkImageFilter*) { return false; } |
+ |
+ /** |
+ * Related (but not required) to canHandleImageFilter, this method returns |
+ * true if the device could apply the filter to the src bitmap and return |
+ * the result (and updates offset as needed). |
+ * If the device does not recognize or support this filter, |
+ * it just returns false and leaves result and offset unchanged. |
+ */ |
+ virtual bool filterImage(const SkImageFilter*, const SkBitmap&, |
+ const SkImageFilter::Context&, |
+ SkBitmap* /*result*/, SkIPoint* /*offset*/) { |
+ return false; |
+ } |
+ |
protected: |
virtual sk_sp<SkSurface> makeSurface(const SkImageInfo&, const SkSurfaceProps&); |
virtual bool onPeekPixels(SkPixmap*) { return false; } |