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

Unified Diff: src/lazy/SkBitmapFactory.cpp

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 | « include/ports/SkAshmemImageCache.h ('k') | src/lazy/SkLazyPixelRef.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lazy/SkBitmapFactory.cpp
diff --git a/src/lazy/SkBitmapFactory.cpp b/src/lazy/SkBitmapFactory.cpp
index d67e0197554a1188a02012801f55c0071c99c5ca..60c4993e3cf0230982065aa736c6a5cdf2fa964a 100644
--- a/src/lazy/SkBitmapFactory.cpp
+++ b/src/lazy/SkBitmapFactory.cpp
@@ -22,17 +22,19 @@ SkBitmapFactory::SkBitmapFactory(SkBitmapFactory::DecodeProc proc)
SkBitmapFactory::~SkBitmapFactory() {
SkSafeUnref(fImageCache);
+ SkSafeUnref(fCacheSelector);
}
void SkBitmapFactory::setImageCache(SkImageCache *cache) {
SkRefCnt_SafeAssign(fImageCache, cache);
if (cache != NULL) {
+ SkSafeUnref(fCacheSelector);
fCacheSelector = NULL;
}
}
-void SkBitmapFactory::setCacheSelector(CacheSelector selector) {
- fCacheSelector = selector;
+void SkBitmapFactory::setCacheSelector(CacheSelector* selector) {
+ SkRefCnt_SafeAssign(fCacheSelector, selector);
if (selector != NULL) {
SkSafeUnref(fImageCache);
fImageCache = NULL;
@@ -63,7 +65,7 @@ bool SkBitmapFactory::installPixelRef(SkData* data, SkBitmap* dst) {
// fImageCache and fCacheSelector are mutually exclusive.
SkASSERT(NULL == fImageCache || NULL == fCacheSelector);
- SkImageCache* cache = NULL == fCacheSelector ? fImageCache : fCacheSelector(info);
+ SkImageCache* cache = NULL == fCacheSelector ? fImageCache : fCacheSelector->selectCache(info);
if (cache != NULL) {
// Now set a new LazyPixelRef on dst.
« no previous file with comments | « include/ports/SkAshmemImageCache.h ('k') | src/lazy/SkLazyPixelRef.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698