You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
implement BitmapFactory.decodeStream() using gdk_pixbuf_new_from_stream
The java InputStream is wrapped into a custom GInputStream implementation
This commit is contained in:
@@ -136,7 +136,13 @@ public final class Bitmap {
|
||||
mLayoutBounds = null;
|
||||
}
|
||||
|
||||
Bitmap(long pixbuf) {
|
||||
this();
|
||||
this.pixbuf = pixbuf;
|
||||
}
|
||||
|
||||
private native long native_bitmap_from_path(CharSequence path);
|
||||
static native long native_copy(long src);
|
||||
|
||||
/**
|
||||
* Private constructor that must received an already allocated native bitmap
|
||||
@@ -784,7 +790,7 @@ public final class Bitmap {
|
||||
|
||||
return bitmap;
|
||||
*/
|
||||
return new Bitmap();
|
||||
return new Bitmap(native_copy(source.pixbuf));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1606,7 +1612,7 @@ public final class Bitmap {
|
||||
int quality, OutputStream stream,
|
||||
byte[] tempStorage);
|
||||
private static native void nativeErase(int nativeBitmap, int color);
|
||||
private static native int nativeRowBytes(int nativeBitmap);
|
||||
private static native int nativeRowBytes(long nativeBitmap);
|
||||
private static native int nativeConfig(int nativeBitmap);
|
||||
|
||||
private static native int nativeGetPixel(int nativeBitmap, int x, int y,
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user