Loading core/jni/android/graphics/ImageDecoder.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -203,7 +203,8 @@ static jobject ImageDecoder_nDecodeBitmap(JNIEnv* env, jobject /*clazz*/, jlong jint desiredWidth, jint desiredHeight, jobject jsubset, jboolean requireMutable, jint allocator, jboolean requireUnpremul, jboolean preferRamOverQuality, jboolean asAlphaMask, jlong colorSpaceHandle) { jboolean asAlphaMask, jlong colorSpaceHandle, jboolean extended) { auto* decoder = reinterpret_cast<ImageDecoder*>(nativePtr); SkAndroidCodec* codec = decoder->mCodec.get(); const SkISize desiredSize = SkISize::Make(desiredWidth, desiredHeight); Loading Loading @@ -253,8 +254,9 @@ static jobject ImageDecoder_nDecodeBitmap(JNIEnv* env, jobject /*clazz*/, jlong } } // Otherwise, stick with N32 } else if (extended) { colorType = kRGBA_F16_SkColorType; } else { // This is currently the only way to know that we should decode to F16. colorType = codec->computeOutputColorType(colorType); } Loading Loading @@ -517,7 +519,7 @@ static const JNINativeMethod gImageDecoderMethods[] = { { "nCreate", "([BIILandroid/graphics/ImageDecoder$Source;)Landroid/graphics/ImageDecoder;", (void*) ImageDecoder_nCreateByteArray }, { "nCreate", "(Ljava/io/InputStream;[BLandroid/graphics/ImageDecoder$Source;)Landroid/graphics/ImageDecoder;", (void*) ImageDecoder_nCreateInputStream }, { "nCreate", "(Ljava/io/FileDescriptor;Landroid/graphics/ImageDecoder$Source;)Landroid/graphics/ImageDecoder;", (void*) ImageDecoder_nCreateFd }, { "nDecodeBitmap", "(JLandroid/graphics/ImageDecoder;ZIILandroid/graphics/Rect;ZIZZZJ)Landroid/graphics/Bitmap;", { "nDecodeBitmap", "(JLandroid/graphics/ImageDecoder;ZIILandroid/graphics/Rect;ZIZZZJZ)Landroid/graphics/Bitmap;", (void*) ImageDecoder_nDecodeBitmap }, { "nGetSampledSize","(JI)Landroid/util/Size;", (void*) ImageDecoder_nGetSampledSize }, { "nGetPadding", "(JLandroid/graphics/Rect;)V", (void*) ImageDecoder_nGetPadding }, Loading graphics/java/android/graphics/ImageDecoder.java +9 −4 Original line number Diff line number Diff line Loading @@ -1641,12 +1641,17 @@ public final class ImageDecoder implements AutoCloseable { @NonNull private Bitmap decodeBitmapInternal() throws IOException { checkState(); long colorSpacePtr = mDesiredColorSpace == null ? 0 : mDesiredColorSpace.getNativeInstance(); long colorSpacePtr = 0; boolean extended = false; if (mDesiredColorSpace != null) { colorSpacePtr = mDesiredColorSpace.getNativeInstance(); extended = mDesiredColorSpace == ColorSpace.get(ColorSpace.Named.EXTENDED_SRGB) || mDesiredColorSpace == ColorSpace.get(ColorSpace.Named.LINEAR_EXTENDED_SRGB); } return nDecodeBitmap(mNativePtr, this, mPostProcessor != null, mDesiredWidth, mDesiredHeight, mCropRect, mMutable, mAllocator, mUnpremultipliedRequired, mConserveMemory, mDecodeAsAlphaMask, colorSpacePtr); mConserveMemory, mDecodeAsAlphaMask, colorSpacePtr, extended); } private void callHeaderDecoded(@Nullable OnHeaderDecodedListener listener, Loading Loading @@ -1934,7 +1939,7 @@ public final class ImageDecoder implements AutoCloseable { @Nullable Rect cropRect, boolean mutable, int allocator, boolean unpremulRequired, boolean conserveMemory, boolean decodeAsAlphaMask, long desiredColorSpace) long desiredColorSpace, boolean extended) throws IOException; private static native Size nGetSampledSize(long nativePtr, int sampleSize); Loading Loading
core/jni/android/graphics/ImageDecoder.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -203,7 +203,8 @@ static jobject ImageDecoder_nDecodeBitmap(JNIEnv* env, jobject /*clazz*/, jlong jint desiredWidth, jint desiredHeight, jobject jsubset, jboolean requireMutable, jint allocator, jboolean requireUnpremul, jboolean preferRamOverQuality, jboolean asAlphaMask, jlong colorSpaceHandle) { jboolean asAlphaMask, jlong colorSpaceHandle, jboolean extended) { auto* decoder = reinterpret_cast<ImageDecoder*>(nativePtr); SkAndroidCodec* codec = decoder->mCodec.get(); const SkISize desiredSize = SkISize::Make(desiredWidth, desiredHeight); Loading Loading @@ -253,8 +254,9 @@ static jobject ImageDecoder_nDecodeBitmap(JNIEnv* env, jobject /*clazz*/, jlong } } // Otherwise, stick with N32 } else if (extended) { colorType = kRGBA_F16_SkColorType; } else { // This is currently the only way to know that we should decode to F16. colorType = codec->computeOutputColorType(colorType); } Loading Loading @@ -517,7 +519,7 @@ static const JNINativeMethod gImageDecoderMethods[] = { { "nCreate", "([BIILandroid/graphics/ImageDecoder$Source;)Landroid/graphics/ImageDecoder;", (void*) ImageDecoder_nCreateByteArray }, { "nCreate", "(Ljava/io/InputStream;[BLandroid/graphics/ImageDecoder$Source;)Landroid/graphics/ImageDecoder;", (void*) ImageDecoder_nCreateInputStream }, { "nCreate", "(Ljava/io/FileDescriptor;Landroid/graphics/ImageDecoder$Source;)Landroid/graphics/ImageDecoder;", (void*) ImageDecoder_nCreateFd }, { "nDecodeBitmap", "(JLandroid/graphics/ImageDecoder;ZIILandroid/graphics/Rect;ZIZZZJ)Landroid/graphics/Bitmap;", { "nDecodeBitmap", "(JLandroid/graphics/ImageDecoder;ZIILandroid/graphics/Rect;ZIZZZJZ)Landroid/graphics/Bitmap;", (void*) ImageDecoder_nDecodeBitmap }, { "nGetSampledSize","(JI)Landroid/util/Size;", (void*) ImageDecoder_nGetSampledSize }, { "nGetPadding", "(JLandroid/graphics/Rect;)V", (void*) ImageDecoder_nGetPadding }, Loading
graphics/java/android/graphics/ImageDecoder.java +9 −4 Original line number Diff line number Diff line Loading @@ -1641,12 +1641,17 @@ public final class ImageDecoder implements AutoCloseable { @NonNull private Bitmap decodeBitmapInternal() throws IOException { checkState(); long colorSpacePtr = mDesiredColorSpace == null ? 0 : mDesiredColorSpace.getNativeInstance(); long colorSpacePtr = 0; boolean extended = false; if (mDesiredColorSpace != null) { colorSpacePtr = mDesiredColorSpace.getNativeInstance(); extended = mDesiredColorSpace == ColorSpace.get(ColorSpace.Named.EXTENDED_SRGB) || mDesiredColorSpace == ColorSpace.get(ColorSpace.Named.LINEAR_EXTENDED_SRGB); } return nDecodeBitmap(mNativePtr, this, mPostProcessor != null, mDesiredWidth, mDesiredHeight, mCropRect, mMutable, mAllocator, mUnpremultipliedRequired, mConserveMemory, mDecodeAsAlphaMask, colorSpacePtr); mConserveMemory, mDecodeAsAlphaMask, colorSpacePtr, extended); } private void callHeaderDecoded(@Nullable OnHeaderDecodedListener listener, Loading Loading @@ -1934,7 +1939,7 @@ public final class ImageDecoder implements AutoCloseable { @Nullable Rect cropRect, boolean mutable, int allocator, boolean unpremulRequired, boolean conserveMemory, boolean decodeAsAlphaMask, long desiredColorSpace) long desiredColorSpace, boolean extended) throws IOException; private static native Size nGetSampledSize(long nativePtr, int sampleSize); Loading