From 725d9dbfa59d6804b157f876a7e5d4c0553c6455 Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Tue, 28 Nov 2017 15:23:45 -0500 Subject: remove unused readBitmapAsImage from readbuffer Bug: skia: Change-Id: Ic200ec39999a06f407de29e15b646baddb9e341d Reviewed-on: https://skia-review.googlesource.com/76982 Reviewed-by: Mike Reed Commit-Queue: Mike Reed --- src/core/SkPictureData.cpp | 10 ---------- src/core/SkPictureData.h | 1 - src/core/SkReadBuffer.cpp | 46 ---------------------------------------------- src/core/SkReadBuffer.h | 1 - 4 files changed, 58 deletions(-) (limited to 'src/core') diff --git a/src/core/SkPictureData.cpp b/src/core/SkPictureData.cpp index e3501f9015..a5a644fe69 100644 --- a/src/core/SkPictureData.cpp +++ b/src/core/SkPictureData.cpp @@ -492,10 +492,6 @@ static sk_sp create_vertices_from_buffer(SkReadBuffer& buffer) { return data ? SkVertices::Decode(data->data(), data->size()) : nullptr; } -static sk_sp create_bitmap_image_from_buffer(SkReadBuffer& buffer) { - return buffer.readBitmapAsImage(); -} - static sk_sp create_drawable_from_buffer(SkReadBuffer& buffer) { return sk_sp((SkDrawable*)buffer.readFlattenable(SkFlattenable::kSkDrawable_Type)); } @@ -540,12 +536,6 @@ bool new_array_from_buffer(SkReadBuffer& buffer, uint32_t inCount, bool SkPictureData::parseBufferTag(SkReadBuffer& buffer, uint32_t tag, uint32_t size) { switch (tag) { - case SK_PICT_BITMAP_BUFFER_TAG: - if (!new_array_from_buffer(buffer, size, &fBitmapImageRefs, &fBitmapImageCount, - create_bitmap_image_from_buffer)) { - return false; - } - break; case SK_PICT_PAINT_BUFFER_TAG: { if (!buffer.validate(SkTFitsIn(size))) { return false; diff --git a/src/core/SkPictureData.h b/src/core/SkPictureData.h index 37a02373be..b95f428807 100644 --- a/src/core/SkPictureData.h +++ b/src/core/SkPictureData.h @@ -64,7 +64,6 @@ public: // This tag specifies the size of the ReadBuffer, needed for the following tags #define SK_PICT_BUFFER_SIZE_TAG SkSetFourByteTag('a', 'r', 'a', 'y') // these are all inside the ARRAYS tag -#define SK_PICT_BITMAP_BUFFER_TAG SkSetFourByteTag('b', 't', 'm', 'p') #define SK_PICT_PAINT_BUFFER_TAG SkSetFourByteTag('p', 'n', 't', ' ') #define SK_PICT_PATH_BUFFER_TAG SkSetFourByteTag('p', 't', 'h', ' ') #define SK_PICT_TEXTBLOB_BUFFER_TAG SkSetFourByteTag('b', 'l', 'o', 'b') diff --git a/src/core/SkReadBuffer.cpp b/src/core/SkReadBuffer.cpp index b9bcdd4550..318785b479 100644 --- a/src/core/SkReadBuffer.cpp +++ b/src/core/SkReadBuffer.cpp @@ -222,52 +222,6 @@ uint32_t SkReadBuffer::getArrayCount() { return *(uint32_t*)fReader.peek(); } -sk_sp SkReadBuffer::readBitmapAsImage() { - 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. That feature is deprecated. - if (this->readBool()) { - this->readUInt(); // Bitmap index - this->readUInt(); // Bitmap generation ID - // Old unsupported SkBitmapHeap format. No longer supported. - } else { - // The writer stored false, meaning the SkBitmap was not stored in an SkBitmapHeap. - const size_t length = this->readUInt(); - if (length > 0) { -#ifdef DEBUG_NON_DETERMINISTIC_ASSERT - fDecodedBitmapIndex++; -#endif // DEBUG_NON_DETERMINISTIC_ASSERT - // A non-zero size means the SkBitmap was encoded. Read the data and pixel - // offset. - const void* data = this->skip(length); - const int32_t xOffset = this->readInt(); - const int32_t yOffset = this->readInt(); - SkIRect subset = SkIRect::MakeXYWH(xOffset, yOffset, width, height); - sk_sp image = fImageDeserializer->makeFromMemory(data, length, &subset); - if (image) { - return image; - } - - // This bitmap was encoded when written, but we are unable to - // decode, possibly due to not having a decoder. Even though we - // weren't able to decode the pixels, the readbuffer should still - // be intact, so we return true with an empty bitmap, so we don't - // force an abort of the larger deserialize. - return MakeEmptyImage(width, height); - } else { - SkBitmap bitmap; - if (SkBitmap::ReadRawPixels(this, &bitmap)) { - bitmap.setImmutable(); - return SkImage::MakeFromBitmap(bitmap); - } - } - } - // Could not read the SkBitmap. Use a placeholder bitmap. - return nullptr; -} - sk_sp SkReadBuffer::readImage() { if (fInflator) { SkImage* img = fInflator->getImage(this->read32()); diff --git a/src/core/SkReadBuffer.h b/src/core/SkReadBuffer.h index a92049dee8..b7c54c4c72 100644 --- a/src/core/SkReadBuffer.h +++ b/src/core/SkReadBuffer.h @@ -178,7 +178,6 @@ public: // helpers to get info about arrays and binary data virtual uint32_t getArrayCount(); - sk_sp readBitmapAsImage(); sk_sp readImage(); virtual sk_sp readTypeface(); -- cgit v1.2.3