Index: include/core/SkImageFilter.h |
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h |
index 40bd38a949130a0f780330d17bbd960897f426d2..975c2d41675e32678f3efe4fca9c0110e2fe6526 100644 |
--- a/include/core/SkImageFilter.h |
+++ b/include/core/SkImageFilter.h |
@@ -14,14 +14,15 @@ |
#include "SkRect.h" |
#include "SkTemplates.h" |
-class SkBitmap; |
class SkColorFilter; |
class SkBaseDevice; |
+class SkBitmap; |
class SkSurfaceProps; |
+class SkImage; |
struct SkIPoint; |
class GrFragmentProcessor; |
class GrTexture; |
- |
+class SkSurface; |
/** |
* Base class for image filters. If one is installed in the paint, then |
* all drawing occurs as usual, but it is as if the drawing happened into an |
@@ -59,8 +60,8 @@ public: |
virtual ~Cache() {} |
static Cache* Create(size_t maxBytes); |
static Cache* Get(); |
- virtual bool get(const Key& key, SkBitmap* result, SkIPoint* offset) const = 0; |
- virtual void set(const Key& key, const SkBitmap& result, const SkIPoint& offset) = 0; |
+ virtual bool get(const Key& key, SkAutoTUnref<const SkImage>& result, SkIPoint* offset) const = 0; |
+ virtual void set(const Key& key, const SkImage* value, const SkIPoint& offset) = 0; |
}; |
class Context { |
@@ -86,9 +87,9 @@ public: |
virtual bool canHandleImageFilter(const 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(const SkImageFilter*, const SkBitmap& src, |
+ virtual bool filterImage(const SkImageFilter*, const SkImage* src, |
const Context&, |
- SkBitmap* result, SkIPoint* offset) = 0; |
+ SkAutoTUnref<const SkImage>& result, SkIPoint* offset) = 0; |
virtual const SkSurfaceProps* surfaceProps() const = 0; |
}; |
@@ -105,8 +106,8 @@ public: |
* If the result image cannot be created, return false, in which case both |
* the result and offset parameters will be ignored by the caller. |
*/ |
- bool filterImage(Proxy*, const SkBitmap& src, const Context&, |
- SkBitmap* result, SkIPoint* offset) const; |
+ bool filterImage(Proxy*, const SkImage* src, const Context&, |
+ SkAutoTUnref<const SkImage>& result, SkIPoint* offset) const; |
/** |
* Given the src bounds of an image, this returns the bounds of the result |
@@ -133,8 +134,8 @@ public: |
* relative to the src when it is drawn. The default implementation does |
* single-pass processing using asFragmentProcessor(). |
*/ |
- virtual bool filterImageGPU(Proxy*, const SkBitmap& src, const Context&, |
- SkBitmap* result, SkIPoint* offset) const; |
+ virtual bool filterImageGPU(Proxy*, const SkImage* src, const Context&, |
+ SkAutoTUnref<const SkImage>& result, SkIPoint* offset) const; |
/** |
* Returns whether this image filter is a color filter and puts the color filter into the |
@@ -202,16 +203,16 @@ public: |
#if SK_SUPPORT_GPU |
/** |
- * Wrap the given texture in a texture-backed SkBitmap. |
+ * Wrap the given texture in a texture-backed SkImage. |
*/ |
- static void WrapTexture(GrTexture* texture, int width, int height, SkBitmap* result); |
+ static bool WrapTexture(GrTexture* texture, int width, int height, SkAutoTUnref<const SkImage>& result); |
/** |
* Recursively evaluate this filter on the GPU. If the filter has no GPU |
* implementation, it will be processed in software and uploaded to the GPU. |
*/ |
- bool getInputResultGPU(SkImageFilter::Proxy* proxy, const SkBitmap& src, const Context&, |
- SkBitmap* result, SkIPoint* offset) const; |
+ bool getInputResultGPU(SkImageFilter::Proxy* proxy, const SkImage* src, const Context&, |
+ SkAutoTUnref<const SkImage>& result, SkIPoint* offset) const; |
#endif |
SK_TO_STRING_PUREVIRT() |
@@ -284,8 +285,8 @@ protected: |
* case both the result and offset parameters will be ignored by the |
* caller. |
*/ |
- virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, |
- SkBitmap* result, SkIPoint* offset) const; |
+ virtual bool onFilterImage(Proxy*, const SkImage* src, const Context&, |
+ SkAutoTUnref<const SkImage>& result, SkIPoint* offset) const; |
// Given the bounds of the destination rect to be filled in device |
// coordinates (first parameter), and the CTM, compute (conservatively) |
// which rect of the source image would be required (third parameter). |
@@ -309,7 +310,7 @@ protected: |
* context's clipBounds, and returns the result in "bounds". If there is |
* no intersection, returns false and leaves "bounds" unchanged. |
*/ |
- bool applyCropRect(const Context&, const SkBitmap& src, const SkIPoint& srcOffset, |
+ bool applyCropRect(const Context&, const SkImage* src, const SkIPoint& srcOffset, |
SkIRect* bounds) const; |
/** Same as the above call, except that if the resulting crop rect is not |
@@ -320,8 +321,8 @@ protected: |
* be used by filters which are not capable of processing a smaller |
* source bitmap into a larger destination. |
*/ |
- bool applyCropRect(const Context&, Proxy* proxy, const SkBitmap& src, SkIPoint* srcOffset, |
- SkIRect* bounds, SkBitmap* result) const; |
+ bool applyCropRect(const Context&, Proxy* proxy, const SkImage* src, SkIPoint* srcOffset, |
+ SkIRect* bounds, SkAutoTUnref<const SkImage>& result) const; |
/** |
* Returns true if the filter can be expressed a single-pass |