aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkImageFilter.h
diff options
context:
space:
mode:
authorGravatar senorblanco <senorblanco@chromium.org>2016-04-27 11:31:23 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-27 11:31:23 -0700
commit900c36779610dc65c42a5004ee3693fd70961ba4 (patch)
tree603f3ab0fd1a59077c851a93148ee15064813073 /include/core/SkImageFilter.h
parentf8e8d5ee432448a4ca5b6f22aabd148a6708d0c0 (diff)
Image filters: de-nest SkImageFilter::Cache and Cache::Key.
This reduces the public header, and also allows us to foward- declare them, so we can remove an #include from all the SkDevice subclass headers. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1919063002 Review-Url: https://codereview.chromium.org/1919063002
Diffstat (limited to 'include/core/SkImageFilter.h')
-rw-r--r--include/core/SkImageFilter.h29
1 files changed, 8 insertions, 21 deletions
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h
index 32a52d97fd..aa9648eb3c 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;
};