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

Unified Diff: include/core/SkImageFilter.h

Issue 189913021: Implement support for a Context parameter in image filters (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Revert all but the Context changes. Created 6 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/SkDevice.h ('k') | include/effects/SkBicubicImageFilter.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 91b98f4a8d442ec7de3ecc07d83b00b1943cfc44..4f33f54b6d03a83542811ed1382d2f43a6a2c04d 100644
--- a/include/core/SkImageFilter.h
+++ b/include/core/SkImageFilter.h
@@ -9,12 +9,12 @@
#define SkImageFilter_DEFINED
#include "SkFlattenable.h"
+#include "SkMatrix.h"
#include "SkRect.h"
class SkBitmap;
class SkColorFilter;
class SkBaseDevice;
-class SkMatrix;
struct SkIPoint;
class SkShader;
class GrEffectRef;
@@ -49,6 +49,18 @@ public:
uint32_t fFlags;
};
+ class Context {
+ public:
+ Context(const SkMatrix& ctm, const SkIRect& clipBounds) :
+ fCTM(ctm), fClipBounds(clipBounds) {
+ }
+ const SkMatrix& ctm() const { return fCTM; }
+ const SkIRect& clipBounds() const { return fClipBounds; }
+ private:
+ SkMatrix fCTM;
+ SkIRect fClipBounds;
+ };
+
class Proxy {
public:
virtual ~Proxy() {};
@@ -59,7 +71,7 @@ public:
// 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,
- const SkMatrix& ctm,
+ const Context&,
SkBitmap* result, SkIPoint* offset) = 0;
};
@@ -76,7 +88,7 @@ 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 SkMatrix& ctm,
+ bool filterImage(Proxy*, const SkBitmap& src, const Context&,
SkBitmap* result, SkIPoint* offset) const;
/**
@@ -104,7 +116,7 @@ public:
* relative to the src when it is drawn. The default implementation does
* single-pass processing using asNewEffect().
*/
- virtual bool filterImageGPU(Proxy*, const SkBitmap& src, const SkMatrix& ctm,
+ virtual bool filterImageGPU(Proxy*, const SkBitmap& src, const Context&,
SkBitmap* result, SkIPoint* offset) const;
/**
@@ -156,7 +168,7 @@ public:
* 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 SkMatrix& ctm,
+ bool getInputResultGPU(SkImageFilter::Proxy* proxy, const SkBitmap& src, const Context&,
SkBitmap* result, SkIPoint* offset) const;
#endif
@@ -200,7 +212,7 @@ protected:
* case both the result and offset parameters will be ignored by the
* caller.
*/
- virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
+ virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
SkBitmap* result, SkIPoint* offset) const;
// Given the bounds of the destination rect to be filled in device
// coordinates (first parameter), and the CTM, compute (conservatively)
« no previous file with comments | « include/core/SkDevice.h ('k') | include/effects/SkBicubicImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698