diff options
author | senorblanco <senorblanco@chromium.org> | 2014-08-08 07:14:35 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-08-08 07:14:35 -0700 |
commit | be129b26f13d575fd6b396c6ae759838ecc9bd1a (patch) | |
tree | 9c41cac3782eed519004f9926add995aeb35fd8d /include/core | |
parent | dfe4e57b1c57c6857141a9a132addf29fc8481ff (diff) |
Remove external SkImageFilter cache, and rename UniqueIDCache -> Cache.
There Can Only Be One.... Cache for SkImageFilter.
R=bsalomon@google.com
BUG=skia:
Author: senorblanco@chromium.org
Review URL: https://codereview.chromium.org/452923002
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkBitmapDevice.h | 2 | ||||
-rw-r--r-- | include/core/SkDevice.h | 2 | ||||
-rw-r--r-- | include/core/SkImageFilter.h | 26 |
3 files changed, 9 insertions, 21 deletions
diff --git a/include/core/SkBitmapDevice.h b/include/core/SkBitmapDevice.h index 5dde9e068b..f8ce93a927 100644 --- a/include/core/SkBitmapDevice.h +++ b/include/core/SkBitmapDevice.h @@ -156,7 +156,7 @@ private: virtual SkSurface* newSurface(const SkImageInfo&) SK_OVERRIDE; virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes) SK_OVERRIDE; - virtual SkImageFilter::UniqueIDCache* getImageFilterCache() SK_OVERRIDE; + virtual SkImageFilter::Cache* getImageFilterCache() SK_OVERRIDE; SkBitmap fBitmap; diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h index 3e5e42b48f..a5682c29ec 100644 --- a/include/core/SkDevice.h +++ b/include/core/SkDevice.h @@ -380,7 +380,7 @@ private: */ virtual void flush() {} - virtual SkImageFilter::UniqueIDCache* getImageFilterCache() { return NULL; } + virtual SkImageFilter::Cache* getImageFilterCache() { return NULL; } SkIPoint fOrigin; SkMetaData* fMetaData; diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h index d2a4d3e3d9..d4930c4975 100644 --- a/include/core/SkImageFilter.h +++ b/include/core/SkImageFilter.h @@ -49,42 +49,30 @@ public: uint32_t fFlags; }; - class SK_API Cache : public SkRefCnt { - public: - // By default, we cache only image filters with 2 or more children. - // Values less than 2 mean always cache; values greater than 2 are not supported. - 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; - virtual void remove(const SkImageFilter* key) = 0; - }; - // This cache maps from (filter's unique ID + CTM + clipBounds + src bitmap generation ID) to // (result, offset). - class UniqueIDCache : public SkRefCnt { + class Cache : public SkRefCnt { public: struct Key; - virtual ~UniqueIDCache() {} - static UniqueIDCache* Create(size_t maxBytes); - static UniqueIDCache* Get(); + 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; }; class Context { public: - Context(const SkMatrix& ctm, const SkIRect& clipBounds, UniqueIDCache* cache) : + 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; } - UniqueIDCache* cache() const { return fCache; } + Cache* cache() const { return fCache; } private: SkMatrix fCTM; SkIRect fClipBounds; - UniqueIDCache* fCache; + Cache* fCache; }; class Proxy { |