Chromium Code Reviews| Index: include/core/SkImageFilter.h |
| diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h |
| index a65a24c3ee45b5cbc098869ac6c5d4269ebb5633..c055f56f2e0abf03bed153a51bd0b99914d5b9c8 100644 |
| --- a/include/core/SkImageFilter.h |
| +++ b/include/core/SkImageFilter.h |
| @@ -13,14 +13,14 @@ |
| #include "SkRect.h" |
| #include "SkTemplates.h" |
| -class SkBitmap; |
| class SkColorFilter; |
| class SkBaseDevice; |
| 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 |
| @@ -58,8 +58,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<SkImage>& result, SkIPoint* offset) const = 0; |
|
reed1
2015/02/12 14:21:53
I understand the idea, but this parameter passing
|
| + virtual void set(const Key& key, SkImage& result, const SkIPoint& offset) = 0; |
|
reed1
2015/02/12 14:21:53
Skia convention is to pass this by (const) pointer
|
| }; |
| class Context { |
| @@ -80,14 +80,14 @@ public: |
| public: |
| virtual ~Proxy() {}; |
| - virtual SkBaseDevice* createDevice(int width, int height) = 0; |
| + virtual SkSurface* createSurface(int width, int height) = 0; |
| // returns true if the proxy can handle this filter natively |
| 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*, SkImage& src, |
| const Context&, |
| - SkBitmap* result, SkIPoint* offset) = 0; |
| + SkAutoTUnref<SkImage>& result, SkIPoint* offset) = 0; |
| virtual const SkSurfaceProps* surfaceProps() const = 0; |
| }; |
| @@ -104,8 +104,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*, SkImage& src, const Context&, |
| + SkAutoTUnref<SkImage>& result, SkIPoint* offset) const; |
| /** |
| * Given the src bounds of an image, this returns the bounds of the result |
| @@ -132,8 +132,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*, SkImage& src, const Context&, |
| + SkAutoTUnref<SkImage>& result, SkIPoint* offset) const; |
| /** |
| * Returns whether this image filter is a color filter and puts the color filter into the |
| @@ -176,16 +176,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<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, SkImage& src, const Context&, |
| + SkAutoTUnref<SkImage>& result, SkIPoint* offset) const; |
| #endif |
| SK_TO_STRING_PUREVIRT() |
| @@ -260,8 +260,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*, SkImage& src, const Context&, |
| + SkAutoTUnref<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). |
| @@ -277,7 +277,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&, SkImage& src, const SkIPoint& srcOffset, |
| SkIRect* bounds) const; |
| /** Same as the above call, except that if the resulting crop rect is not |
| @@ -288,8 +288,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, SkImage& src, SkIPoint* srcOffset, |
| + SkIRect* bounds, SkAutoTUnref<SkImage>& result) const; |
| /** |
| * Returns true if the filter can be expressed a single-pass |