flutter-side decode

This commit is contained in:
mertalev
2026-01-17 23:46:46 -05:00
parent 24ff08e094
commit 00ea98479f
8 changed files with 106 additions and 123 deletions

View File

@@ -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);
}