aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-06 14:43:09 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-06 14:43:09 +0000
commitb55deeb1c7c692023603639a9b29c0e3de124eac (patch)
tree700cd48c2047c233ab2a8ed27331b48eff2e517f /include
parent3c10a0871b1a664441ff53df9a8c57005e247116 (diff)
add allowImageFilter() so a device can allow/disallow filters
(esp. for printing) git-svn-id: http://skia.googlecode.com/svn/trunk@2981 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkDevice.h11
-rw-r--r--include/device/xps/SkXPSDevice.h2
-rw-r--r--include/pdf/SkPDFDevice.h2
3 files changed, 14 insertions, 1 deletions
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h
index 8c351f9e51..c026a4b493 100644
--- a/include/core/SkDevice.h
+++ b/include/core/SkDevice.h
@@ -310,9 +310,18 @@ protected:
virtual void unlockPixels();
/**
+ * Returns true if the device allows processing of this imagefilter. If
+ * false is returned, then the filter is ignored. This may happen for
+ * some subclasses that do not support pixel manipulations after drawing
+ * has occurred (e.g. printing). The default implementation returns true.
+ */
+ virtual bool allowImageFilter(SkImageFilter*);
+
+ /**
* Override and return true for filters that the device handles
* intrinsically. Returning false means call the filter.
- * Default impl returns false.
+ * Default impl returns false. This will only be called if allowImageFilter()
+ * returned true.
*/
virtual bool filterImage(SkImageFilter*, const SkBitmap& src,
const SkMatrix& ctm,
diff --git a/include/device/xps/SkXPSDevice.h b/include/device/xps/SkXPSDevice.h
index c948a902fb..686e1687ec 100644
--- a/include/device/xps/SkXPSDevice.h
+++ b/include/device/xps/SkXPSDevice.h
@@ -144,6 +144,8 @@ protected:
int y,
SkCanvas::Config8888) SK_OVERRIDE;
+ virtual bool allowImageFilter(SkImageFilter*) SK_OVERRIDE;
+
private:
class TypefaceUse : ::SkNoncopyable {
public:
diff --git a/include/pdf/SkPDFDevice.h b/include/pdf/SkPDFDevice.h
index 006994e304..45511495c4 100644
--- a/include/pdf/SkPDFDevice.h
+++ b/include/pdf/SkPDFDevice.h
@@ -161,6 +161,8 @@ protected:
virtual bool onReadPixels(const SkBitmap& bitmap, int x, int y,
SkCanvas::Config8888) SK_OVERRIDE;
+ virtual bool allowImageFilter(SkImageFilter*) SK_OVERRIDE;
+
private:
// TODO(vandebo): push most of SkPDFDevice's state into a core object in
// order to get the right access levels without using friend.