dmabuf: Allocate the intermediate buffer properly.

We should use the stride from the buffer's format, not from the dmabuf.
This commit is contained in:
Benjamin Otte 2023-10-20 12:12:23 +02:00
parent 4e47d0d71e
commit f29303dea7

View File

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