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

Unified Diff: include/core/SkImageFilter.h

Issue 1919063002: Image filters: de-nest SkImageFilter::Cache and Cache::Key. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix copyright Created 4 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
« no previous file with comments | « include/core/SkDevice.h ('k') | src/core/SkBitmapDevice.cpp » ('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 32a52d97fdca740547284eb10d12ac4a0277697b..aa9648eb3c2b633396e7b49dd6ebea2b89e894c1 100644
--- a/include/core/SkImageFilter.h
+++ b/include/core/SkImageFilter.h
@@ -21,6 +21,8 @@ class GrFragmentProcessor;
class SkColorFilter;
struct SkIPoint;
class SkSpecialImage;
+class SkImageFilterCache;
+struct SkImageFilterCacheKey;
/**
* Base class for image filters. If one is installed in the paint, then
@@ -31,24 +33,9 @@ class SkSpecialImage;
*/
class SK_API SkImageFilter : public SkFlattenable {
public:
- // This cache maps from (filter's unique ID + CTM + clipBounds + src bitmap generation ID) to
- // (result, offset).
- class Cache : public SkRefCnt {
- public:
- struct Key;
- virtual ~Cache() {}
- static Cache* Create(size_t maxBytes);
- static Cache* Get();
- virtual SkSpecialImage* get(const Key& key, SkIPoint* offset) const = 0;
- virtual void set(const Key& key, SkSpecialImage* image, const SkIPoint& offset) = 0;
- virtual void purge() = 0;
- virtual void purgeByKeys(const Key[], int) = 0;
- SkDEBUGCODE(virtual int count() const = 0;)
- };
-
class Context {
public:
- Context(const SkMatrix& ctm, const SkIRect& clipBounds, Cache* cache)
+ Context(const SkMatrix& ctm, const SkIRect& clipBounds, SkImageFilterCache* cache)
: fCTM(ctm)
, fClipBounds(clipBounds)
, fCache(cache)
@@ -56,12 +43,12 @@ public:
const SkMatrix& ctm() const { return fCTM; }
const SkIRect& clipBounds() const { return fClipBounds; }
- Cache* cache() const { return fCache; }
+ SkImageFilterCache* cache() const { return fCache; }
private:
- SkMatrix fCTM;
- SkIRect fClipBounds;
- Cache* fCache;
+ SkMatrix fCTM;
+ SkIRect fClipBounds;
+ SkImageFilterCache* fCache;
};
class CropRect {
@@ -399,7 +386,7 @@ private:
bool fUsesSrcInput;
CropRect fCropRect;
uint32_t fUniqueID; // Globally unique
- mutable SkTArray<Cache::Key> fCacheKeys;
+ mutable SkTArray<SkImageFilterCacheKey> fCacheKeys;
mutable SkMutex fMutex;
typedef SkFlattenable INHERITED;
};
« no previous file with comments | « include/core/SkDevice.h ('k') | src/core/SkBitmapDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698