Index: src/core/SkImageFilter.cpp |
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp |
index 8d0c22de285a51ac5de63483233507d8533725a1..05f559b02d251acb8ca80adcc5cc456b56cb9915 100644 |
--- a/src/core/SkImageFilter.cpp |
+++ b/src/core/SkImageFilter.cpp |
@@ -20,6 +20,8 @@ |
#include "SkGr.h" |
#endif |
+SkImageFilter::Cache* gExternalCache; |
+ |
SkImageFilter::SkImageFilter(int inputCount, SkImageFilter** inputs, const CropRect* cropRect) |
: fInputCount(inputCount), |
fInputs(new SkImageFilter*[inputCount]), |
@@ -295,6 +297,14 @@ bool SkImageFilter::asColorFilter(SkColorFilter**) const { |
return false; |
} |
+void SkImageFilter::SetExternalCache(Cache* cache) { |
+ SkRefCnt_SafeAssign(gExternalCache, cache); |
+} |
+ |
+SkImageFilter::Cache* SkImageFilter::GetExternalCache() { |
+ return gExternalCache; |
+} |
+ |
#if SK_SUPPORT_GPU |
void SkImageFilter::WrapTexture(GrTexture* texture, int width, int height, SkBitmap* result) { |
@@ -363,6 +373,7 @@ public: |
virtual ~CacheImpl(); |
bool get(const SkImageFilter* key, SkBitmap* result, SkIPoint* offset) SK_OVERRIDE; |
void set(const SkImageFilter* key, const SkBitmap& result, const SkIPoint& offset) SK_OVERRIDE; |
+ void remove(const SkImageFilter* key) SK_OVERRIDE; |
private: |
typedef const SkImageFilter* Key; |
struct Value { |
@@ -392,6 +403,14 @@ bool CacheImpl::get(const SkImageFilter* key, SkBitmap* result, SkIPoint* offset |
return false; |
} |
+void CacheImpl::remove(const SkImageFilter* key) { |
+ Value* v = fData.find(key); |
+ if (v) { |
+ fData.remove(key); |
+ delete v; |
+ } |
+} |
+ |
void CacheImpl::set(const SkImageFilter* key, const SkBitmap& result, const SkIPoint& offset) { |
if (key->getRefCnt() >= fMinChildren) { |
fData.add(new Value(key, result, offset)); |