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

Unified Diff: src/lazy/SkLazyPixelRef.cpp

Issue 68973005: Expand pixelref to return SkImageInfo and rowbytes (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 1 month 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
« src/image/SkDataPixelRef.cpp ('K') | « src/lazy/SkLazyPixelRef.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« src/image/SkDataPixelRef.cpp ('K') | « src/lazy/SkLazyPixelRef.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698