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

Unified Diff: src/core/SkReadBuffer.cpp

Issue 1938033002: Remove SkBitmapHeap and SkBitmapHeapReader. They're unused. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Restore ability to partially read old SKPs Created 4 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/SkReadBuffer.h ('k') | src/core/SkValidatingReadBuffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkReadBuffer.cpp
diff --git a/src/core/SkReadBuffer.cpp b/src/core/SkReadBuffer.cpp
index ce87d513661dace26852094b9fb6910e01ced112..f55a5b043b3f44b554929205e35f1c97152a1e67 100644
--- a/src/core/SkReadBuffer.cpp
+++ b/src/core/SkReadBuffer.cpp
@@ -27,7 +27,6 @@ SkReadBuffer::SkReadBuffer() {
fVersion = 0;
fMemoryPtr = nullptr;
- fBitmapStorage = nullptr;
fTFArray = nullptr;
fTFCount = 0;
@@ -45,7 +44,6 @@ SkReadBuffer::SkReadBuffer(const void* data, size_t size) {
fReader.setMemory(data, size);
fMemoryPtr = nullptr;
- fBitmapStorage = nullptr;
fTFArray = nullptr;
fTFCount = 0;
@@ -65,7 +63,6 @@ SkReadBuffer::SkReadBuffer(SkStream* stream) {
stream->read(fMemoryPtr, length);
fReader.setMemory(fMemoryPtr, length);
- fBitmapStorage = nullptr;
fTFArray = nullptr;
fTFCount = 0;
@@ -79,7 +76,6 @@ SkReadBuffer::SkReadBuffer(SkStream* stream) {
SkReadBuffer::~SkReadBuffer() {
sk_free(fMemoryPtr);
- SkSafeUnref(fBitmapStorage);
}
bool SkReadBuffer::readBool() {
@@ -186,25 +182,15 @@ uint32_t SkReadBuffer::getArrayCount() {
bool SkReadBuffer::readBitmap(SkBitmap* bitmap) {
const int width = this->readInt();
const int height = this->readInt();
+
// The writer stored a boolean value to determine whether an SkBitmapHeap was used during
- // writing.
+ // writing. That feature is deprecated.
if (this->readBool()) {
- // An SkBitmapHeap was used for writing. Read the index from the stream and find the
- // corresponding SkBitmap in fBitmapStorage.
- const uint32_t index = this->readUInt();
- this->readUInt(); // bitmap generation ID (see SkWriteBuffer::writeBitmap)
- if (fBitmapStorage) {
- *bitmap = *fBitmapStorage->getBitmap(index);
- fBitmapStorage->releaseRef(index);
- return true;
- } else {
- // The bitmap was stored in a heap, but there is no way to access it. Set an error and
- // fall through to use a place holder bitmap.
- SkErrorInternals::SetError(kParseError_SkError, "SkWriteBuffer::writeBitmap "
- "stored the SkBitmap in an SkBitmapHeap, but "
- "SkReadBuffer has no SkBitmapHeapReader to "
- "retrieve the SkBitmap.");
- }
+ this->readUInt(); // Bitmap index
+ this->readUInt(); // Bitmap generation ID
+ SkErrorInternals::SetError(kParseError_SkError, "SkWriteBuffer::writeBitmap "
+ "stored the SkBitmap in an SkBitmapHeap, but "
+ "that feature is no longer supported.");
} else {
// The writer stored false, meaning the SkBitmap was not stored in an SkBitmapHeap.
const size_t length = this->readUInt();
« no previous file with comments | « src/core/SkReadBuffer.h ('k') | src/core/SkValidatingReadBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698