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

Unified Diff: src/lazy/SkCachingPixelRef.cpp

Issue 112603003: Reverting r12665 & r12666 (Remove duplicate impl for SkImageInfo flattening) due to Chromium/Blink … (Closed) Base URL: http://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
===================================================================
--- src/lazy/SkCachingPixelRef.cpp (revision 12666)
+++ src/lazy/SkCachingPixelRef.cpp (working copy)
@@ -8,6 +8,7 @@
#include "SkCachingPixelRef.h"
#include "SkScaledImageCache.h"
+
bool SkCachingPixelRef::Install(SkImageGenerator* generator,
SkBitmap* dst) {
SkImageInfo info;
@@ -30,10 +31,10 @@
SkCachingPixelRef::SkCachingPixelRef(SkImageGenerator* generator,
const SkImageInfo& info,
size_t rowBytes)
- : INHERITED(info)
- , fImageGenerator(generator)
+ : fImageGenerator(generator)
, fErrorInDecoding(false)
, fScaledCacheId(NULL)
+ , fInfo(info)
, fRowBytes(rowBytes) {
SkASSERT(fImageGenerator != NULL);
}
@@ -43,32 +44,31 @@
// Assert always unlock before unref.
}
-bool SkCachingPixelRef::onNewLockPixels(LockRec* rec) {
+void* SkCachingPixelRef::onLockPixels(SkColorTable** colorTable) {
+ (void)colorTable;
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(),
- info.fWidth,
- info.fHeight,
+ fInfo.fWidth,
+ fInfo.fHeight,
&bitmap);
if (NULL == fScaledCacheId) {
// Cache has been purged, must re-decode.
- if ((!bitmap.setConfig(info, fRowBytes)) || !bitmap.allocPixels()) {
+ if ((!bitmap.setConfig(fInfo, fRowBytes)) || !bitmap.allocPixels()) {
fErrorInDecoding = true;
- return false;
+ return NULL;
}
SkAutoLockPixels autoLockPixels(bitmap);
- if (!fImageGenerator->getPixels(info, bitmap.getPixels(), fRowBytes)) {
+ if (!fImageGenerator->getPixels(fInfo, bitmap.getPixels(), fRowBytes)) {
fErrorInDecoding = true;
- return false;
+ return NULL;
}
fScaledCacheId = SkScaledImageCache::AddAndLock(this->getGenerationID(),
- info.fWidth,
- info.fHeight,
+ fInfo.fWidth,
+ fInfo.fHeight,
bitmap);
SkASSERT(fScaledCacheId != NULL);
}
@@ -78,7 +78,6 @@
SkAutoLockPixels autoLockPixels(bitmap);
void* pixels = bitmap.getPixels();
SkASSERT(pixels != NULL);
-
// At this point, the autoLockPixels will unlockPixels()
// to remove bitmap's lock on the pixels. We will then
// destroy bitmap. The *only* guarantee that this pointer
@@ -87,10 +86,7 @@
// 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() {
« 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