aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/lazy/SkCachingPixelRef.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-06 13:34:39 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-06 13:34:39 +0000
commitba82bd11e2c055f885b2327aa230d2dac8b53f03 (patch)
tree8e838e01d55b7a6d9ac811d00826d9a38e290f12 /src/lazy/SkCachingPixelRef.cpp
parent452eecb4436f27e057d4d2df26e3a70020a817b6 (diff)
Revert "Revert "Revert of https://codereview.chromium.org/110593003/""
Diffstat (limited to 'src/lazy/SkCachingPixelRef.cpp')
-rw-r--r--src/lazy/SkCachingPixelRef.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/lazy/SkCachingPixelRef.cpp b/src/lazy/SkCachingPixelRef.cpp
index f1510fb67c..452ea4ed03 100644
--- a/src/lazy/SkCachingPixelRef.cpp
+++ b/src/lazy/SkCachingPixelRef.cpp
@@ -8,6 +8,7 @@
#include "SkCachingPixelRef.h"
#include "SkScaledImageCache.h"
+
bool SkCachingPixelRef::Install(SkImageGenerator* generator,
SkBitmap* dst) {
SkImageInfo info;
@@ -40,12 +41,13 @@ SkCachingPixelRef::~SkCachingPixelRef() {
// Assert always unlock before unref.
}
-bool SkCachingPixelRef::onNewLockPixels(LockRec* rec) {
+void* SkCachingPixelRef::onLockPixels(SkColorTable**) {
if (fErrorInDecoding) {
- return false; // don't try again.
+ return NULL; // don't try again.
}
-
+
const SkImageInfo& info = this->info();
+
SkBitmap bitmap;
SkASSERT(NULL == fScaledCacheId);
fScaledCacheId = SkScaledImageCache::FindAndLock(this->getGenerationID(),
@@ -56,12 +58,12 @@ bool SkCachingPixelRef::onNewLockPixels(LockRec* rec) {
// Cache has been purged, must re-decode.
if ((!bitmap.setConfig(info, fRowBytes)) || !bitmap.allocPixels()) {
fErrorInDecoding = true;
- return false;
+ return NULL;
}
SkAutoLockPixels autoLockPixels(bitmap);
if (!fImageGenerator->getPixels(info, bitmap.getPixels(), fRowBytes)) {
fErrorInDecoding = true;
- return false;
+ return NULL;
}
fScaledCacheId = SkScaledImageCache::AddAndLock(this->getGenerationID(),
info.fWidth,
@@ -84,10 +86,7 @@ bool SkCachingPixelRef::onNewLockPixels(LockRec* rec) {
// bitmap (SkScaledImageCache::Rec.fBitmap) that holds a
// reference to the concrete PixelRef while this record is
// locked.
- rec->fPixels = pixels;
- rec->fColorTable = NULL;
- rec->fRowBytes = bitmap.rowBytes();
- return true;
+ return pixels;
}
void SkCachingPixelRef::onUnlockPixels() {