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

Unified Diff: src/lazy/SkDiscardablePixelRef.cpp

Issue 1226023003: Remove SkImageGenerator pieces only for SkCodec. (Closed) Base URL: https://skia.googlesource.com/skia.git@severIG
Patch Set: Created 5 years, 5 months 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
Index: src/lazy/SkDiscardablePixelRef.cpp
diff --git a/src/lazy/SkDiscardablePixelRef.cpp b/src/lazy/SkDiscardablePixelRef.cpp
index 73fa4ce84cc2062e29c9dfb67fdd856229f71156..99fe8bfaa94b76c847cb60eed85ebf65ceb33fbe 100644
--- a/src/lazy/SkDiscardablePixelRef.cpp
+++ b/src/lazy/SkDiscardablePixelRef.cpp
@@ -71,6 +71,7 @@ bool SkDiscardablePixelRef::onNewLockPixels(LockRec* rec) {
SkPMColor colors[256];
int colorCount = 0;
+#ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
const SkImageGenerator::Result result = fGenerator->getPixels(info, pixels, fRowBytes, NULL,
colors, &colorCount);
switch (result) {
@@ -78,11 +79,14 @@ bool SkDiscardablePixelRef::onNewLockPixels(LockRec* rec) {
case SkImageGenerator::kIncompleteInput:
break;
default:
- fDiscardableMemory->unlock();
- fDiscardableMemoryIsLocked = false;
- SkDELETE(fDiscardableMemory);
- fDiscardableMemory = NULL;
- return false;
+#else
+ if (!fGenerator->getPixels(info, pixels, fRowBytes, colors, &colorCount)) {
+#endif
+ fDiscardableMemory->unlock();
+ fDiscardableMemoryIsLocked = false;
+ SkDELETE(fDiscardableMemory);
+ fDiscardableMemory = NULL;
+ return false;
}
// Note: our ctable is not purgeable, as it is not stored in the discardablememory block.

Powered by Google App Engine
This is Rietveld 408576698