mirror of
https://github.com/immich-app/immich.git
synced 2026-03-29 05:25:41 +03:00
flutter-side decode
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#include <jni.h>
|
||||
#include <stdlib.h>
|
||||
#include <android/bitmap.h>
|
||||
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_app_alextran_immich_images_LocalImagesImpl_allocateNative(
|
||||
@@ -15,25 +14,15 @@ Java_app_alextran_immich_images_LocalImagesImpl_freeNative(
|
||||
free((void *) address);
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_app_alextran_immich_images_LocalImagesImpl_reallocNative(
|
||||
JNIEnv *env, jclass clazz, jlong address, jint size) {
|
||||
void *ptr = realloc((void *) address, size);
|
||||
return (jlong) ptr;
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_app_alextran_immich_images_LocalImagesImpl_wrapAsBuffer(
|
||||
JNIEnv *env, jclass clazz, jlong address, jint capacity) {
|
||||
return (*env)->NewDirectByteBuffer(env, (void *) address, capacity);
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_app_alextran_immich_images_RemoteImagesImpl_lockBitmapPixels(
|
||||
JNIEnv *env, jclass clazz, jobject bitmap) {
|
||||
void *pixels = NULL;
|
||||
int result = AndroidBitmap_lockPixels(env, bitmap, &pixels);
|
||||
if (result != ANDROID_BITMAP_RESULT_SUCCESS) {
|
||||
return 0;
|
||||
}
|
||||
return (jlong) pixels;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_alextran_immich_images_RemoteImagesImpl_unlockBitmapPixels(
|
||||
JNIEnv *env, jclass clazz, jobject bitmap) {
|
||||
AndroidBitmap_unlockPixels(env, bitmap);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user