diff options
author | Leon Scroggins III <scroggo@google.com> | 2020-12-17 15:43:54 -0500 |
---|---|---|
committer | Leon Scroggins III <scroggo@google.com> | 2021-01-05 12:37:47 -0500 |
commit | 139145be8082f0606045b89feebc9126a9a376d8 (patch) | |
tree | ed515cb13a9608be4cb87baebe801ec0b5346580 /libs/hwui/jni/ImageDecoder.cpp | |
parent | 31d0862eca09541eee6a2db6f914087d2ce1f4e4 (diff) |
Handle EXIF orientation in hwui/ImageDecoder
Bug: 160984428
Test: AImageDecoderTest#testRespectOrientation
ImageDecoderTest#testRespectOrientation
Ieda439910ae52e609f0710d424503616d99ae5c7
I23caef26b4c82173c758dd0ce7fb6f04e4154588
I345a13d20776a007052d32e74fa42865b42f726d
It is possible to create an animated image with an exif orientation.
Using kRespect, there is no clean way to handle the orientation plus
compositing frames. Switch ImageDecoder to use kIgnore (the default).
Depends on a change in Skia (https://review.skia.org/344762) to make
SkAnimatedImage handle the orientation even with kIgnore.
Change-Id: Ib93b0ced09fa3cca4a6681745406355c48158fae
Diffstat (limited to 'libs/hwui/jni/ImageDecoder.cpp')
-rw-r--r-- | libs/hwui/jni/ImageDecoder.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/libs/hwui/jni/ImageDecoder.cpp b/libs/hwui/jni/ImageDecoder.cpp index da91d46b0738..96e912fd9f26 100644 --- a/libs/hwui/jni/ImageDecoder.cpp +++ b/libs/hwui/jni/ImageDecoder.cpp @@ -135,19 +135,15 @@ static jobject native_create(JNIEnv* env, std::unique_ptr<SkStream> stream, return throw_exception(env, kSourceException, "", jexception, source); } - auto androidCodec = SkAndroidCodec::MakeFromCodec(std::move(codec), - SkAndroidCodec::ExifOrientationBehavior::kRespect); + auto androidCodec = SkAndroidCodec::MakeFromCodec(std::move(codec)); if (!androidCodec.get()) { return throw_exception(env, kSourceMalformedData, "", nullptr, source); } - const auto& info = androidCodec->getInfo(); - const int width = info.width(); - const int height = info.height(); const bool isNinePatch = peeker->mPatch != nullptr; ImageDecoder* decoder = new ImageDecoder(std::move(androidCodec), std::move(peeker)); return env->NewObject(gImageDecoder_class, gImageDecoder_constructorMethodID, - reinterpret_cast<jlong>(decoder), width, height, + reinterpret_cast<jlong>(decoder), decoder->width(), decoder->height(), animated, isNinePatch); } |