Chromium Code Reviews| Index: src/lazy/SkLazyPixelRef.cpp |
| diff --git a/src/lazy/SkLazyPixelRef.cpp b/src/lazy/SkLazyPixelRef.cpp |
| index c2ca041b41da71e372be13cbc9c0cc4591440046..6dd5470227f096c155077da877a6e3f7636f1ba4 100644 |
| --- a/src/lazy/SkLazyPixelRef.cpp |
| +++ b/src/lazy/SkLazyPixelRef.cpp |
| @@ -118,14 +118,17 @@ static void* decode_into_bitmap(SkImageInfo* info, |
| return target.fAddr; |
| } |
| -void* SkLazyPixelRef::lockScaledImageCachePixels() { |
| +void* SkLazyPixelRef::lockScaledImageCachePixels(SkImageInfo* info, |
| + size_t* rowBytes) { |
| SkASSERT(!fErrorInDecoding); |
| SkASSERT(NULL == fImageCache); |
| SkBitmap bitmap; |
| - const SkImageInfo* info = this->getCachedInfo(); |
| - if (info == NULL) { |
| + const SkImageInfo* cachedInfo = this->getCachedInfo(); |
| + if (cachedInfo == NULL) { |
| return NULL; |
| } |
| + *info = *cachedInfo; |
| + |
| // If this is the first time though, this is guaranteed to fail. |
| // Maybe we should have a flag that says "don't even bother looking" |
| fScaledCacheId = SkScaledImageCache::FindAndLock(this->getGenerationID(), |
| @@ -144,6 +147,7 @@ void* SkLazyPixelRef::lockScaledImageCachePixels() { |
| // bitmap (SkScaledImageCache::Rec.fBitmap) that holds a |
| // reference to the concrete PixelRef while this record is |
| // locked. |
| + *rowBytes = bitmap.rowBytes(); |
| return pixels; |
|
scroggo
2013/11/19 18:17:09
I thought we had merged these two return cases (si
reed1
2013/11/20 20:56:56
sgtm
|
| } else { |
| // Cache has been purged, must re-decode. |
| @@ -159,22 +163,24 @@ void* SkLazyPixelRef::lockScaledImageCachePixels() { |
| info->fHeight, |
| bitmap); |
| SkASSERT(fScaledCacheId != NULL); |
| + *rowBytes = bitmap.rowBytes(); |
| return pixels; |
| } |
| } |
| -void* SkLazyPixelRef::onLockPixels(SkColorTable**) { |
| +void* SkLazyPixelRef::onLockPixels(SkImageInfo* info, size_t* rowBytes, |
| + SkColorTable**) { |
| if (fErrorInDecoding) { |
| return NULL; |
| } |
| if (NULL == fImageCache) { |
| - return this->lockScaledImageCachePixels(); |
| + return this->lockScaledImageCachePixels(info, rowBytes); |
| } else { |
| - return this->lockImageCachePixels(); |
| + return this->lockImageCachePixels(info, rowBytes); |
| } |
| } |
| -void* SkLazyPixelRef::lockImageCachePixels() { |
| +void* SkLazyPixelRef::lockImageCachePixels(SkImageInfo* info, size_t* rowBytes) { |
| SkASSERT(fImageCache != NULL); |
| SkASSERT(!fErrorInDecoding); |
| SkBitmapFactory::Target target; |