retool image cache to be generic cache, allowing the client to subclass "Rec", so they can provide a custom Key and arbitrary Value.
Follow-on CLs
- rename ScaledimageCache to something like GeneralCache
- explore if we can use call-backs or some mechanism to completely hide "lock/unlock", by forcing all clients to support "copying" their value out of the cache as the result of a Find.
R=mtklein@google.com, senorblanco@google.com, bsalomon@google.com, qiankun.miao@intel.com, senorblanco@chromium.org
Author: reed@google.com
Review URL: https://codereview.chromium.org/507483002
diff --git a/src/lazy/SkCachingPixelRef.h b/src/lazy/SkCachingPixelRef.h
index 1e87874..306f714 100644
--- a/src/lazy/SkCachingPixelRef.h
+++ b/src/lazy/SkCachingPixelRef.h
@@ -8,6 +8,7 @@
#ifndef SkCachingPixelRef_DEFINED
#define SkCachingPixelRef_DEFINED
+#include "SkBitmapCache.h"
#include "SkImageInfo.h"
#include "SkImageGenerator.h"
#include "SkPixelRef.h"
@@ -52,9 +53,10 @@
private:
SkImageGenerator* const fImageGenerator;
bool fErrorInDecoding;
- void* fScaledCacheId;
const size_t fRowBytes;
+ SkBitmap fLockedBitmap;
+
SkCachingPixelRef(const SkImageInfo&, SkImageGenerator*, size_t rowBytes);
typedef SkPixelRef INHERITED;