aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkImageFilter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/SkImageFilter.cpp')
-rw-r--r--src/core/SkImageFilter.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 8d0c22de28..05f559b02d 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));