Remove references to SkImageDecoder (part 2)
As of this CL, SkImageDecoder is no longer used in Android and
will be deleted by Skia.
(cherry picked from commit 097a6ea4b65046df3e3cbf93d1acfc4e6833e02f)
Change-Id: Ic754ab0dde7ad1b65ccf3b2bc23fcbc5ef44ed08
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
index 4098772..3e94e1b 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>
@@ -117,8 +117,10 @@
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;
@@ -171,15 +173,10 @@
//StopWatch watch("blah");
SkBitmap bitmap;
- SkMemoryStream stream(frame.map->getDataPtr(), frame.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(frame.map->getDataPtr(),
+ frame.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
diff --git a/core/jni/android/graphics/GraphicsJNI.h b/core/jni/android/graphics/GraphicsJNI.h
index 5baa8f8..a5e94a10 100644
--- a/core/jni/android/graphics/GraphicsJNI.h
+++ b/core/jni/android/graphics/GraphicsJNI.h
@@ -10,7 +10,6 @@
#include "SkMallocPixelRef.h"
#include "SkPoint.h"
#include "SkRect.h"
-#include "SkImageDecoder.h"
#include <jni.h>
#include <hwui/Canvas.h>
diff --git a/core/jni/android/graphics/NinePatchPeeker.cpp b/core/jni/android/graphics/NinePatchPeeker.cpp
index 8a84a35..1ea5650 100644
--- a/core/jni/android/graphics/NinePatchPeeker.cpp
+++ b/core/jni/android/graphics/NinePatchPeeker.cpp
@@ -17,7 +17,6 @@
#include "NinePatchPeeker.h"
#include "SkBitmap.h"
-#include "SkImageDecoder.h"
using namespace android;