gltexture: Use proper alignment for downloads
authorMatthias Clasen <mclasen@redhat.com>
Wed, 31 May 2023 02:35:45 +0000 (22:35 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 31 May 2023 02:35:45 +0000 (22:35 -0400)
gdk/gdkgltexture.c

index 6e72af54032384b9a64fd65ae54feff55ccf786c..d9d62190d9568432752a892a7a682d5ee10d41b7 100644 (file)
@@ -204,6 +204,7 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
           gsize stride = texture->width * gdk_memory_format_bytes_per_pixel (format);
           guchar *pixels = g_malloc_n (stride, texture->height);
 
+          glPixelStorei (GL_PACK_ALIGNMENT, 1);
           glGetTexImage (GL_TEXTURE_2D,
                          0,
                          gl_format,
@@ -271,6 +272,7 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
           gsize stride = actual_bpp * texture->width;
           guchar *pixels = g_malloc_n (stride, texture->height);
 
+          glPixelStorei (GL_PACK_ALIGNMENT, 1);
           glReadPixels (0, 0,
                         texture->width, texture->height,
                         gl_read_format,