diff options
author | Mike Reed <reed@google.com> | 2017-11-28 15:23:45 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-11-28 20:45:27 +0000 |
commit | 725d9dbfa59d6804b157f876a7e5d4c0553c6455 (patch) | |
tree | 4285b914ab41c91c8abbcfec1235707f13ac2ce0 | |
parent | 9c1c892af7bcdebfa4c2affdd430b5c9482ec86f (diff) |
remove unused readBitmapAsImage from readbuffer
Bug: skia:
Change-Id: Ic200ec39999a06f407de29e15b646baddb9e341d
Reviewed-on: https://skia-review.googlesource.com/76982
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
-rw-r--r-- | src/core/SkPictureData.cpp | 10 | ||||
-rw-r--r-- | src/core/SkPictureData.h | 1 | ||||
-rw-r--r-- | src/core/SkReadBuffer.cpp | 46 | ||||
-rw-r--r-- | src/core/SkReadBuffer.h | 1 | ||||
-rw-r--r-- | src/shaders/SkImageShader.cpp | 11 |
5 files changed, 0 insertions, 69 deletions
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<SkVertices> create_vertices_from_buffer(SkReadBuffer& buffer) { return data ? SkVertices::Decode(data->data(), data->size()) : nullptr; } -static sk_sp<SkImage> create_bitmap_image_from_buffer(SkReadBuffer& buffer) { - return buffer.readBitmapAsImage(); -} - static sk_sp<SkDrawable> create_drawable_from_buffer(SkReadBuffer& buffer) { return sk_sp<SkDrawable>((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<int>(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<SkImage> 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<SkImage> 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<SkImage> 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<SkImage> readBitmapAsImage(); sk_sp<SkImage> readImage(); virtual sk_sp<SkTypeface> readTypeface(); diff --git a/src/shaders/SkImageShader.cpp b/src/shaders/SkImageShader.cpp index 46b20b1de3..fff59c7bc3 100644 --- a/src/shaders/SkImageShader.cpp +++ b/src/shaders/SkImageShader.cpp @@ -249,21 +249,10 @@ sk_sp<SkShader> SkMakeBitmapShader(const SkBitmap& src, SkShader::TileMode tmx, tmx, tmy, localMatrix); } -static sk_sp<SkFlattenable> SkBitmapProcShader_CreateProc(SkReadBuffer& buffer) { - SkMatrix lm; - buffer.readMatrix(&lm); - sk_sp<SkImage> image = buffer.readBitmapAsImage(); - SkShader::TileMode mx = (SkShader::TileMode)buffer.readUInt(); - SkShader::TileMode my = (SkShader::TileMode)buffer.readUInt(); - return image ? image->makeShader(mx, my, &lm) : nullptr; -} - SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkShaderBase) SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkImageShader) -SkFlattenable::Register("SkBitmapProcShader", SkBitmapProcShader_CreateProc, kSkShaderBase_Type); SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END - bool SkImageShader::onAppendStages(const StageRec& rec) const { SkRasterPipeline* p = rec.fPipeline; SkArenaAlloc* alloc = rec.fAlloc; |