Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: include/core/SkImageFilter.h

Issue 920513003: Make filters use SkImage instead of SkBitmap Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkImage.h ('k') | include/core/SkMatrixImageFilter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « include/core/SkImage.h ('k') | include/core/SkMatrixImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698