From 774696011d4ae81fa422772ea59d7053474fd8fb Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 14 Feb 2023 07:41:11 +0100 Subject: [PATCH] glrenderer: Use GdkTexureDownloader --- gsk/gl/gskglcommandqueue.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/gsk/gl/gskglcommandqueue.c b/gsk/gl/gskglcommandqueue.c index 72d2b320d0..8fee49fd15 100644 --- a/gsk/gl/gskglcommandqueue.c +++ b/gsk/gl/gskglcommandqueue.c @@ -27,8 +27,8 @@ #include #include -#include #include +#include #include #include @@ -1359,7 +1359,8 @@ gsk_gl_command_queue_do_upload_texture (GskGLCommandQueue *self, GdkGLContext *context; const guchar *data; gsize stride; - GdkMemoryTexture *memtex; + GBytes *bytes; + GdkTextureDownloader downloader; GdkMemoryFormat data_format; int width, height; GLenum gl_internalformat; @@ -1394,9 +1395,11 @@ gsk_gl_command_queue_do_upload_texture (GskGLCommandQueue *self, } } - memtex = gdk_memory_texture_from_texture (texture, data_format); - data = gdk_memory_texture_get_data (memtex); - stride = gdk_memory_texture_get_stride (memtex); + gdk_texture_downloader_init (&downloader, texture); + gdk_texture_downloader_set_format (&downloader, data_format); + bytes = gdk_texture_downloader_download_bytes (&downloader, &stride); + gdk_texture_downloader_finish (&downloader); + data = g_bytes_get_data (bytes, NULL); bpp = gdk_memory_format_bytes_per_pixel (data_format); glPixelStorei (GL_UNPACK_ALIGNMENT, gdk_memory_format_alignment (data_format)); @@ -1426,7 +1429,7 @@ gsk_gl_command_queue_do_upload_texture (GskGLCommandQueue *self, } glPixelStorei (GL_UNPACK_ALIGNMENT, 4); - g_object_unref (memtex); + g_bytes_unref (bytes); } int