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

Unified Diff: include/core/SkImageFilter.h

Issue 230653005: Implement intra-frame cacheing in image filters. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Set minChildren to 2 by default; comment it. Created 6 years, 8 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
Index: include/core/SkImageFilter.h
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h
index 0f52b69b84ba458772ad816c105f3953df6f8397..7a65f53788d34a9d6caf967e55596fbd25fb4430 100644
--- a/include/core/SkImageFilter.h
+++ b/include/core/SkImageFilter.h
@@ -16,7 +16,6 @@ class SkBitmap;
class SkColorFilter;
class SkBaseDevice;
struct SkIPoint;
-class SkShader;
class GrEffectRef;
class GrTexture;
@@ -49,16 +48,28 @@ public:
uint32_t fFlags;
};
+ class Cache : public SkRefCnt {
+ public:
+ // By default, we cache only image filters with 2 or more children.
+ static Cache* Create(int minChildren = 2);
+ virtual ~Cache() {}
+ virtual bool get(const SkImageFilter* key, SkBitmap* result, SkIPoint* offset) = 0;
+ virtual void set(const SkImageFilter* key,
+ const SkBitmap& result, const SkIPoint& offset) = 0;
+ };
+
class Context {
public:
- Context(const SkMatrix& ctm, const SkIRect& clipBounds) :
- fCTM(ctm), fClipBounds(clipBounds) {
+ Context(const SkMatrix& ctm, const SkIRect& clipBounds, Cache* cache) :
+ fCTM(ctm), fClipBounds(clipBounds), fCache(cache) {
}
const SkMatrix& ctm() const { return fCTM; }
const SkIRect& clipBounds() const { return fClipBounds; }
+ Cache* cache() const { return fCache; }
private:
SkMatrix fCTM;
SkIRect fClipBounds;
+ Cache* fCache;
};
class Proxy {
« no previous file with comments | « gm/imagefiltersbase.cpp ('k') | src/core/SkCanvas.cpp » ('j') | src/core/SkImageFilter.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698