gl: Handle row stride for glyph cache upload
authorMatthias Clasen <mclasen@redhat.com>
Sat, 12 Oct 2019 01:16:40 +0000 (21:16 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 12 Oct 2019 01:16:40 +0000 (21:16 -0400)
In theory, we can have data with a stride here,
so set the necessary parameters to tell GL about
it.

gsk/gl/gskglglyphcache.c

index 0357f9910de5ca0c5030afe1fedd6c445b1d4039..66b84a02beded569e0ba53c45593faae2c8caf8f 100644 (file)
@@ -189,11 +189,13 @@ upload_glyph (GlyphCacheKey    *key,
 
   if (render_glyph (key, value, &r))
     {
+      glPixelStorei (GL_UNPACK_ROW_LENGTH, r.stride / 4);
       glBindTexture (GL_TEXTURE_2D, value->texture_id);
       glTexSubImage2D (GL_TEXTURE_2D, 0,
                        r.x, r.y, r.width, r.height,
                        GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
                        r.data);
+      glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
       g_free (r.data);
     }