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

Unified Diff: src/pipe/SkGPipeRead.cpp

Issue 14437012: Fixes for piping bitmaps with encoded data. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Do not use bitmap storage when adding bitmaps to SkGPipeState. Created 7 years, 8 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
« no previous file with comments | « src/core/SkOrderedReadBuffer.h ('k') | src/pipe/SkGPipeWrite.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pipe/SkGPipeRead.cpp
diff --git a/src/pipe/SkGPipeRead.cpp b/src/pipe/SkGPipeRead.cpp
index f47f3bfe657875d8fb8d16ada4294f06c3cf7162..090168aff19c921b49c0109804682eeabfd275e3 100644
--- a/src/pipe/SkGPipeRead.cpp
+++ b/src/pipe/SkGPipeRead.cpp
@@ -132,7 +132,16 @@ public:
} else {
bm = fBitmaps[index];
}
- bm->unflatten(*fReader);
+ // When adding bitmaps, never use the bitmap storage. Bitmaps will always
+ // be either unflattened or decoded. Since bitmap storage takes priority in
+ // readBitmap, remove the bitmap storage and set it back afterwards.
+ SkBitmapHeapReader* storage = fReader->getBitmapStorage();
+ // The storage must be either this or the fSharedHeap, depending on fFlags.
+ SkASSERT((shouldFlattenBitmaps(fFlags) && this == storage)
+ || (!shouldFlattenBitmaps(fFlags) && fSharedHeap == storage && storage != NULL));
+ fReader->setBitmapStorage(NULL);
+ fReader->readBitmap(bm);
+ fReader->setBitmapStorage(storage);
}
/**
@@ -772,12 +781,14 @@ SkGPipeState::~SkGPipeState() {
SkGPipeReader::SkGPipeReader() {
fCanvas = NULL;
fState = NULL;
+ fProc = NULL;
}
SkGPipeReader::SkGPipeReader(SkCanvas* target) {
fCanvas = NULL;
this->setCanvas(target);
fState = NULL;
+ fProc = NULL;
}
void SkGPipeReader::setCanvas(SkCanvas *target) {
@@ -805,6 +816,7 @@ SkGPipeReader::Status SkGPipeReader::playback(const void* data, size_t length,
const ReadProc* table = gReadTable;
SkOrderedReadBuffer reader(data, length);
+ reader.setBitmapDecoder(fProc);
SkCanvas* canvas = fCanvas;
Status status = kEOF_Status;
« no previous file with comments | « src/core/SkOrderedReadBuffer.h ('k') | src/pipe/SkGPipeWrite.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698