memorytexture: Use right size for GBytes
authorBenjamin Otte <otte@redhat.com>
Tue, 14 Feb 2023 05:18:37 +0000 (06:18 +0100)
committerBenjamin Otte <otte@redhat.com>
Tue, 14 Feb 2023 22:42:17 +0000 (23:42 +0100)
The GBytes were created with the wrong size.

Nobody seems to have looked at it.

gdk/gdkmemorytexture.c

index e241ebd0a3a864e3743a55412a253e41eb20ce41..6f9967dcfb2c6598beccc2b4e26531498beee90c 100644 (file)
@@ -222,7 +222,7 @@ gdk_memory_texture_from_texture (GdkTexture      *texture,
   data = g_malloc_n (stride, texture->height);
 
   gdk_texture_do_download (texture, format, data, stride);
-  bytes = g_bytes_new_take (data, stride);
+  bytes = g_bytes_new_take (data, stride * texture->height);
   result = gdk_memory_texture_new (texture->width,
                                    texture->height,
                                    format,
@@ -239,6 +239,12 @@ gdk_memory_texture_get_data (GdkMemoryTexture *self)
   return g_bytes_get_data (self->bytes, NULL);
 }
 
+GBytes *
+gdk_memory_texture_get_bytes (GdkMemoryTexture *self)
+{
+  return self->bytes;
+}
+
 gsize
 gdk_memory_texture_get_stride (GdkMemoryTexture *self)
 {