Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: include/lazy/SkBitmapFactory.h

Issue 12433020: Improvements/additions to SkImageCache/SkLazyPixelRef. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Respond to comments. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gyp/tools.gyp ('k') | include/lazy/SkImageCache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/lazy/SkBitmapFactory.h
diff --git a/include/lazy/SkBitmapFactory.h b/include/lazy/SkBitmapFactory.h
index bebd3a7ceea5c1f777a3617b5123233524d18dcc..eb427ee390c8a776db7c652699a69ea682f8a7e0 100644
--- a/include/lazy/SkBitmapFactory.h
+++ b/include/lazy/SkBitmapFactory.h
@@ -67,20 +67,29 @@ public:
bool installPixelRef(SkData*, SkBitmap*);
/**
- * A function for selecting an SkImageCache to use based on an SkImage::Info.
+ * An object for selecting an SkImageCache to use based on an SkImage::Info.
*/
- typedef SkImageCache* (*CacheSelector)(const SkImage::Info&);
+ class CacheSelector : public SkRefCnt {
+
+ public:
+ /**
+ * Return an SkImageCache to use based on the provided SkImage::Info. If the caller decides
+ * to hang on to the result, it will call ref, so the implementation should not add a ref
+ * as a result of this call.
+ */
+ virtual SkImageCache* selectCache(const SkImage::Info&) = 0;
+ };
/**
* Set the function to be used to select which SkImageCache to use. Mutually exclusive with
* fImageCache.
*/
- void setCacheSelector(CacheSelector);
+ void setCacheSelector(CacheSelector*);
private:
- DecodeProc fDecodeProc;
- SkImageCache* fImageCache;
- CacheSelector fCacheSelector;
+ DecodeProc fDecodeProc;
+ SkImageCache* fImageCache;
+ CacheSelector* fCacheSelector;
};
#endif // SkBitmapFactory_DEFINED
« no previous file with comments | « gyp/tools.gyp ('k') | include/lazy/SkImageCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698