[gtk/wip/matthiasc/shared-glyph-cache] Fix an off-by-one error



commit e4d97960c5d5f23fbe997a0e188232d6fd3743e1
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Jun 4 01:37:48 2019 +0000

    Fix an off-by-one error
    
    This was causing the 'I' to not show up
    because it was the lettter that overflowed
    the first row in the glyph cache.

 gsk/gl/gskglglyphcache.c | 35 +----------------------------------
 1 file changed, 1 insertion(+), 34 deletions(-)
---
diff --git a/gsk/gl/gskglglyphcache.c b/gsk/gl/gskglglyphcache.c
index 7080380762..b08b799a5a 100644
--- a/gsk/gl/gskglglyphcache.c
+++ b/gsk/gl/gskglglyphcache.c
@@ -142,7 +142,7 @@ add_to_cache (GskGLGlyphCache  *cache,
       GskGLTextureAtlas *test_atlas = g_ptr_array_index (cache->atlases, i);
       gboolean was_packed;
 
-      was_packed = gsk_gl_texture_atlas_pack (test_atlas, width, height, &packed_x, &packed_y);
+      was_packed = gsk_gl_texture_atlas_pack (test_atlas, width + 2, height + 2, &packed_x, &packed_y);
 
       if (was_packed)
         {
@@ -261,35 +261,6 @@ render_glyph (const GskGLTextureAtlas *atlas,
   return TRUE;
 }
 
-static void
-check_gl_error (const char *s)
-{
-  int error = glGetError ();
-
-  switch (error)
-    {
-    case GL_INVALID_OPERATION:
-      g_print ("%s: INVALID_OPERATION\n", s);
-      break;
-    case GL_INVALID_ENUM:
-      g_print ("%s: INVALID_ENUM\n", s);
-      break;
-    case GL_INVALID_VALUE:
-      g_print ("%s: INVALID_VALUE\n", s);
-      break;
-    case GL_OUT_OF_MEMORY:
-      g_print ("%s: OUT_OF_MEMORY\n", s);
-      break;
-    case GL_INVALID_FRAMEBUFFER_OPERATION:
-      g_print ("%s: INVALID_FRAMEBUFFER_OPERATION\n", s);
-      break;
-    case GL_NO_ERROR:
-      break;
-    default:
-      g_print ("%s: error %d\n", s, error);
-    }
-}
-
 static void
 upload_region_or_else (GdkDisplay *display,
                        guint           texture_id,
@@ -306,7 +277,6 @@ upload_region_or_else (GdkDisplay *display,
   glBindTexture (GL_TEXTURE_2D, texture_id);
   glTextureSubImage2D (texture_id, 0, region->x, region->y, region->width, region->height,
                    GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, region->data);
-  check_gl_error ("upload region");
 
   gdk_gl_context_make_current (previous);
 }
@@ -429,11 +399,8 @@ create_shared_texture (GdkDisplay *display,
 
   glBindTexture (GL_TEXTURE_2D, 0);
 
-  check_gl_error ("create shared texture");
-
   gdk_gl_context_make_current (previous);
 
-g_print ("shared glyph atlas texture: %d\n", texture_id);
   return texture_id;
 }
 


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