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
GskCanvas.drawBitmap(): reuse GdkTexture objects
This commit is contained in:
@@ -10,11 +10,10 @@
|
||||
|
||||
#include "../generated_headers/android_graphics_GskCanvas.h"
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawBitmap(JNIEnv *env, jclass this_class, jlong snapshot_ptr, jlong pixbuf_ptr, jint x, jint y, jint width, jint height, jint color)
|
||||
JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawBitmap(JNIEnv *env, jclass this_class, jlong snapshot_ptr, jlong texture_ptr, jint x, jint y, jint width, jint height, jint color)
|
||||
{
|
||||
GdkSnapshot *snapshot = (GdkSnapshot *)_PTR(snapshot_ptr);
|
||||
GdkPixbuf *pixbuf = (GdkPixbuf *)_PTR(pixbuf_ptr);
|
||||
GdkTexture *texture = gdk_texture_new_for_pixbuf(pixbuf);
|
||||
GdkTexture *texture = GDK_TEXTURE(_PTR(texture_ptr));
|
||||
if (color) { // use only alpha from pixbuf, color is fixed
|
||||
graphene_matrix_t color_matrix;
|
||||
graphene_vec4_t color_offset;
|
||||
@@ -30,7 +29,6 @@ JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawBitmap(JNIEnv
|
||||
gtk_snapshot_append_texture(snapshot, texture, &GRAPHENE_RECT_INIT(x, y, width, height));
|
||||
if (color)
|
||||
gtk_snapshot_pop(snapshot);
|
||||
g_object_unref(texture);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawRect(JNIEnv *env, jclass this_class, jlong snapshot_ptr, jfloat left, jfloat top, jfloat right, jfloat bottom, jint color)
|
||||
|
||||
Reference in New Issue
Block a user