implement BitmapFactory.decodeStream() using gdk_pixbuf_new_from_stream

The java InputStream is wrapped into a custom GInputStream
implementation
This commit is contained in:
Julian Winkler
2023-09-01 13:09:04 +02:00
parent 30b990f60a
commit ceb5df9d39
7 changed files with 95 additions and 8 deletions

View File

@@ -596,7 +596,7 @@ public class BitmapFactory {
tempStorage = opts.inTempStorage;
if (tempStorage == null)
tempStorage = new byte[DECODE_BUFFER_SIZE];
return nativeDecodeStream(is, tempStorage, outPadding, opts);
return new Bitmap(nativeDecodeStream(is, tempStorage, outPadding, opts));
}
/**
@@ -669,7 +669,7 @@ public class BitmapFactory {
return decodeFileDescriptor(fd, null, null);
}
private static native Bitmap nativeDecodeStream(InputStream is, byte[] storage,
private static native long nativeDecodeStream(InputStream is, byte[] storage,
Rect padding, Options opts);
private static native Bitmap nativeDecodeFileDescriptor(FileDescriptor fd,
Rect padding, Options opts);