diff options
Diffstat (limited to 'cmds/bootanimation/BootAnimation.cpp')
-rw-r--r-- | cmds/bootanimation/BootAnimation.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp index c9211939ec6c..3c2efd891e1a 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -49,8 +49,8 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" #include <SkBitmap.h> +#include <SkImage.h> #include <SkStream.h> -#include <SkImageDecoder.h> #pragma GCC diagnostic pop #include <GLES/gl.h> @@ -139,8 +139,10 @@ status_t BootAnimation::initTexture(Texture* texture, AssetManager& assets, if (asset == NULL) return NO_INIT; SkBitmap bitmap; - SkImageDecoder::DecodeMemory(asset->getBuffer(false), asset->getLength(), - &bitmap, kUnknown_SkColorType, SkImageDecoder::kDecodePixels_Mode); + sk_sp<SkData> data = SkData::MakeWithoutCopy(asset->getBuffer(false), + asset->getLength()); + sk_sp<SkImage> image = SkImage::MakeFromEncoded(data); + image->asLegacyBitmap(&bitmap, SkImage::kRO_LegacyBitmapMode); asset->close(); delete asset; @@ -192,15 +194,10 @@ status_t BootAnimation::initTexture(Texture* texture, AssetManager& assets, status_t BootAnimation::initTexture(FileMap* map, int* width, int* height) { SkBitmap bitmap; - SkMemoryStream stream(map->getDataPtr(), map->getDataLength()); - SkImageDecoder* codec = SkImageDecoder::Factory(&stream); - if (codec != NULL) { - codec->setDitherImage(false); - codec->decode(&stream, &bitmap, - kN32_SkColorType, - SkImageDecoder::kDecodePixels_Mode); - delete codec; - } + sk_sp<SkData> data = SkData::MakeWithoutCopy(map->getDataPtr(), + map->getDataLength()); + sk_sp<SkImage> image = SkImage::MakeFromEncoded(data); + image->asLegacyBitmap(&bitmap, SkImage::kRO_LegacyBitmapMode); // FileMap memory is never released until application exit. // Release it now as the texture is already loaded and the memory used for |