ImageView/ImageButton: don't use deprecated gtk_picture_set_from_pixbuf, reduce code duplication

This commit is contained in:
Mis012
2024-04-20 00:08:09 +02:00
parent 98d17ac25e
commit b52e08fd7a
6 changed files with 15 additions and 18 deletions

View File

@@ -25,11 +25,10 @@ JNIEXPORT jlong JNICALL Java_android_widget_ImageView_native_1constructor(JNIEnv
return _INTPTR(image);
}
JNIEXPORT void JNICALL Java_android_widget_ImageView_native_1setPixbuf(JNIEnv *env, jobject this, jlong pixbuf_ptr)
JNIEXPORT void JNICALL Java_android_widget_ImageView_native_1setPixbuf(JNIEnv *env, jobject this, jlong widget_ptr, jlong pixbuf_ptr)
{
GtkWidget *image = _PTR(_GET_LONG_FIELD(this, "widget"));
GdkPixbuf *pixbuf = _PTR(pixbuf_ptr);
gtk_picture_set_pixbuf(GTK_PICTURE(image), pixbuf);
GdkPaintable *paintable = GDK_PAINTABLE(gdk_texture_new_for_pixbuf(_PTR(pixbuf_ptr)));
Java_android_widget_ImageView_native_1setDrawable(env, this, widget_ptr, _INTPTR(paintable));
}
JNIEXPORT void JNICALL Java_android_widget_ImageView_native_1setDrawable(JNIEnv *env, jobject this, jlong widget_ptr, jlong paintable_ptr)