[gtk] gl: Don't use memcmp for comparing cache keys



commit 0a876f11a0879dc6082d3356f8eb060ddffac1e6
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Oct 12 01:00:08 2019 -0400

    gl: Don't use memcmp for comparing cache keys
    
    Some innocent change made us use a stack-allocated
    key, and things broke. Lets go back to comparing
    cache keys field by field.

 gsk/gl/gskglglyphcache.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/gsk/gl/gskglglyphcache.c b/gsk/gl/gskglglyphcache.c
index 66b84a02be..f7cb6fc2c6 100644
--- a/gsk/gl/gskglglyphcache.c
+++ b/gsk/gl/gskglglyphcache.c
@@ -79,7 +79,14 @@ gsk_gl_glyph_cache_unref (GskGLGlyphCache *self)
 static gboolean
 glyph_cache_equal (gconstpointer v1, gconstpointer v2)
 {
-  return memcmp (v1, v2, sizeof (GlyphCacheKey)) == 0;
+  const GlyphCacheKey *key1 = v1;
+  const GlyphCacheKey *key2 = v2;
+
+  return key1->font == key2->font &&
+         key1->glyph == key2->glyph &&
+         key1->xshift == key2->xshift &&
+         key1->yshift == key2->yshift &&
+         key1->scale == key2->scale;
 }
 
 static guint


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]