From f29303dea70e7bdd685aadcfb95e720760013ea7 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 20 Oct 2023 12:12:23 +0200 Subject: [PATCH] dmabuf: Allocate the intermediate buffer properly. We should use the stride from the buffer's format, not from the dmabuf. --- gdk/gdkdmabuf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gdk/gdkdmabuf.c b/gdk/gdkdmabuf.c index a9e14a2c45..6407f179a5 100644 --- a/gdk/gdkdmabuf.c +++ b/gdk/gdkdmabuf.c @@ -172,16 +172,14 @@ gdk_dmabuf_direct_downloader_download (const GdkDmabufDownloader *downloader, gdk_dmabuf_direct_downloader_do_download (texture, data, stride); else { - const GdkDmabuf *dmabuf; unsigned int width, height; guchar *src_data; gsize src_stride; - dmabuf = gdk_dmabuf_texture_get_dmabuf (GDK_DMABUF_TEXTURE (texture)); width = gdk_texture_get_width (texture); height = gdk_texture_get_height (texture); - src_stride = dmabuf->planes[0].stride; + src_stride = width * gdk_memory_format_bytes_per_pixel (src_format); src_data = g_new (guchar, src_stride * height); gdk_dmabuf_direct_downloader_do_download (texture, src_data, src_stride);