aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-03-23 15:36:36 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-03-23 15:36:36 +0000
commit8926b169f6a0dfa4c2129a98ec2aee205f0c8527 (patch)
tree2a62dcf51d6ea24f395aab732db6c174cb152485 /include/core
parentc3a0d2e4c5e512443f7d37e8025d81fd94132e7a (diff)
apply imagefilter to all draw calls
Review URL: https://codereview.appspot.com/5856048 git-svn-id: http://skia.googlecode.com/svn/trunk@3476 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkCanvas.h6
-rw-r--r--include/core/SkDevice.h21
-rw-r--r--include/core/SkImageFilter.h6
3 files changed, 23 insertions, 10 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 7ad88f64cc..5224217fdc 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -977,6 +977,7 @@ private:
void updateDeviceCMCache();
friend class SkDrawIter; // needs setupDrawForLayerDevice()
+ friend class AutoDrawLooper;
SkDevice* createLayerDevice(SkBitmap::Config, int width, int height,
bool isOpaque);
@@ -992,9 +993,10 @@ private:
void internalDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
const SkRect& dst, const SkPaint* paint);
void internalDrawPaint(const SkPaint& paint);
+ int internalSaveLayer(const SkRect* bounds, const SkPaint* paint,
+ SaveFlags, bool justForImageFilter);
+ void internalDrawDevice(SkDevice*, int x, int y, const SkPaint*);
-
- void drawDevice(SkDevice*, int x, int y, const SkPaint*);
// shared by save() and saveLayer()
int internalSave(SaveFlags flags);
void internalRestore();
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h
index 3303981c74..db9c542ada 100644
--- a/include/core/SkDevice.h
+++ b/include/core/SkDevice.h
@@ -321,13 +321,22 @@ protected:
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. This will only be called if allowImageFilter()
- * returned true.
+ * 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 filterImage(SkImageFilter*, const SkBitmap& src,
- const SkMatrix& ctm,
+ virtual bool canHandleImageFilter(SkImageFilter*);
+
+ /**
+ * 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(SkImageFilter*, const SkBitmap&, const SkMatrix&,
SkBitmap* result, SkIPoint* offset);
// This is equal kBGRA_Premul_Config8888 or kRGBA_Premul_Config8888 if
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h
index 7d7c1404f1..1b282d2e32 100644
--- a/include/core/SkImageFilter.h
+++ b/include/core/SkImageFilter.h
@@ -40,14 +40,16 @@ class SK_API SkImageFilter : public SkFlattenable {
public:
class Proxy {
public:
+ virtual ~Proxy() {};
+
virtual SkDevice* createDevice(int width, int height) = 0;
-
+ // returns true if the proxy can handle this filter natively
+ virtual bool canHandleImageFilter(SkImageFilter*) = 0;
// returns true if the proxy handled the filter itself. if this returns
// false then the filter's code will be called.
virtual bool filterImage(SkImageFilter*, const SkBitmap& src,
const SkMatrix& ctm,
SkBitmap* result, SkIPoint* offset) = 0;
- virtual ~Proxy() {};
};
/**