Index: src/lazy/SkDiscardablePixelRef.cpp |
diff --git a/src/lazy/SkDiscardablePixelRef.cpp b/src/lazy/SkDiscardablePixelRef.cpp |
index 2886156102937faeb734f2891b74daaff47dba61..abd80f2e0ac0fb10234a958cfa746e37bb00a249 100644 |
--- a/src/lazy/SkDiscardablePixelRef.cpp |
+++ b/src/lazy/SkDiscardablePixelRef.cpp |
@@ -36,10 +36,13 @@ SkDiscardablePixelRef::~SkDiscardablePixelRef() { |
SkDELETE(fGenerator); |
} |
-void* SkDiscardablePixelRef::onLockPixels(SkColorTable**) { |
+bool SkDiscardablePixelRef::onNewLockPixels(LockRec* rec) { |
if (fDiscardableMemory != NULL) { |
if (fDiscardableMemory->lock()) { |
- return fDiscardableMemory->data(); |
+ rec->fPixels = fDiscardableMemory->data(); |
+ rec->fColorTable = NULL; |
+ rec->fRowBytes = fRowBytes; |
+ return true; |
} |
SkDELETE(fDiscardableMemory); |
fDiscardableMemory = NULL; |
@@ -53,17 +56,23 @@ void* SkDiscardablePixelRef::onLockPixels(SkColorTable**) { |
fDiscardableMemory = SkDiscardableMemory::Create(size); |
} |
if (NULL == fDiscardableMemory) { |
- return NULL; // Memory allocation failed. |
+ return false; // Memory allocation failed. |
} |
+ |
void* pixels = fDiscardableMemory->data(); |
if (!fGenerator->getPixels(this->info(), pixels, fRowBytes)) { |
fDiscardableMemory->unlock(); |
SkDELETE(fDiscardableMemory); |
fDiscardableMemory = NULL; |
- return NULL; |
+ return false; |
} |
- return pixels; |
+ |
+ rec->fPixels = pixels; |
+ rec->fColorTable = NULL; |
+ rec->fRowBytes = fRowBytes; |
+ return true; |
} |
+ |
void SkDiscardablePixelRef::onUnlockPixels() { |
fDiscardableMemory->unlock(); |
} |