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

Unified Diff: src/lazy/SkCachingPixelRef.cpp

Issue 100723005: Update all callsites to use info for pixelrefs (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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 | « src/lazy/SkCachingPixelRef.h ('k') | src/lazy/SkDiscardablePixelRef.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lazy/SkCachingPixelRef.cpp
diff --git a/src/lazy/SkCachingPixelRef.cpp b/src/lazy/SkCachingPixelRef.cpp
index b7eaf574aac436223220923d7cd00fab2faa66af..668f57ef302fa97aa7b66da9fbf8bcc28353cdb1 100644
--- a/src/lazy/SkCachingPixelRef.cpp
+++ b/src/lazy/SkCachingPixelRef.cpp
@@ -21,20 +21,18 @@ bool SkCachingPixelRef::Install(SkImageGenerator* generator,
return false;
}
SkAutoTUnref<SkCachingPixelRef> ref(SkNEW_ARGS(SkCachingPixelRef,
- (generator,
- info,
- dst->rowBytes())));
+ (info, generator, dst->rowBytes())));
dst->setPixelRef(ref);
return true;
}
-SkCachingPixelRef::SkCachingPixelRef(SkImageGenerator* generator,
- const SkImageInfo& info,
+SkCachingPixelRef::SkCachingPixelRef(const SkImageInfo& info,
+ SkImageGenerator* generator,
size_t rowBytes)
- : fImageGenerator(generator)
+ : INHERITED(info)
+ , fImageGenerator(generator)
, fErrorInDecoding(false)
, fScaledCacheId(NULL)
- , fInfo(info)
, fRowBytes(rowBytes) {
SkASSERT(fImageGenerator != NULL);
}
@@ -44,31 +42,32 @@ SkCachingPixelRef::~SkCachingPixelRef() {
// Assert always unlock before unref.
}
-void* SkCachingPixelRef::onLockPixels(SkColorTable** colorTable) {
- (void)colorTable;
+void* SkCachingPixelRef::onLockPixels(SkColorTable**) {
+ const SkImageInfo& info = this->info();
+
if (fErrorInDecoding) {
return NULL; // don't try again.
}
SkBitmap bitmap;
SkASSERT(NULL == fScaledCacheId);
fScaledCacheId = SkScaledImageCache::FindAndLock(this->getGenerationID(),
- fInfo.fWidth,
- fInfo.fHeight,
+ info.fWidth,
+ info.fHeight,
&bitmap);
if (NULL == fScaledCacheId) {
// Cache has been purged, must re-decode.
- if ((!bitmap.setConfig(fInfo, fRowBytes)) || !bitmap.allocPixels()) {
+ if ((!bitmap.setConfig(info, fRowBytes)) || !bitmap.allocPixels()) {
fErrorInDecoding = true;
return NULL;
}
SkAutoLockPixels autoLockPixels(bitmap);
- if (!fImageGenerator->getPixels(fInfo, bitmap.getPixels(), fRowBytes)) {
+ if (!fImageGenerator->getPixels(info, bitmap.getPixels(), fRowBytes)) {
fErrorInDecoding = true;
return NULL;
}
fScaledCacheId = SkScaledImageCache::AddAndLock(this->getGenerationID(),
- fInfo.fWidth,
- fInfo.fHeight,
+ info.fWidth,
+ info.fHeight,
bitmap);
SkASSERT(fScaledCacheId != NULL);
}
« no previous file with comments | « src/lazy/SkCachingPixelRef.h ('k') | src/lazy/SkDiscardablePixelRef.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698