[gtk/glyph-cache-mystery: 2/2] misc debug spew




commit 988a9e260c7e696a43d73c83e5dec6c0871a6925
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jul 30 14:00:25 2021 -0400

    misc debug spew

 gsk/ngl/gsknglglyphlibrary.c | 16 +++++++++++++---
 gsk/ngl/gsknglrenderjob.c    |  2 +-
 tests/simple.c               |  4 ++--
 3 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/gsk/ngl/gsknglglyphlibrary.c b/gsk/ngl/gsknglglyphlibrary.c
index 9f269d8643..5c824a4318 100644
--- a/gsk/ngl/gsknglglyphlibrary.c
+++ b/gsk/ngl/gsknglglyphlibrary.c
@@ -182,6 +182,8 @@ render_glyph (cairo_surface_t           *surface,
   cairo_destroy (cr);
 
   cairo_surface_flush (surface);
+
+  cairo_surface_write_to_png (surface, "glyph-cache-upload.png");
 }
 
 static void
@@ -223,13 +225,19 @@ gsk_ngl_glyph_library_upload_glyph (GskNglGlyphLibrary     *self,
   surface = gsk_ngl_glyph_library_create_surface (self, stride, width, height, device_scale);
   render_glyph (surface, scaled_font, key, value);
 
+  {
+    cairo_t *cr = cairo_create (surface);
+    cairo_set_line_width (cr, 1);
+    cairo_set_source_rgb (cr, 1, 0, 0);
+    cairo_rectangle (cr, 0.5, 0.5, width - 1, height - 1);
+    cairo_stroke (cr);
+    cairo_destroy (cr);
+  }
+
   texture_id = GSK_NGL_TEXTURE_ATLAS_ENTRY_TEXTURE (value);
 
   g_assert (texture_id > 0);
 
-  glPixelStorei (GL_UNPACK_ROW_LENGTH, stride / 4);
-  glBindTexture (GL_TEXTURE_2D, texture_id);
-
   if G_UNLIKELY (gdk_gl_context_get_use_es (gdk_gl_context_get_current ()))
     {
       pixel_data = free_data = g_malloc (width * height * 4);
@@ -250,6 +258,8 @@ gsk_ngl_glyph_library_upload_glyph (GskNglGlyphLibrary     *self,
       gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
     }
 
+  glPixelStorei (GL_UNPACK_ROW_LENGTH, stride / 4);
+  glBindTexture (GL_TEXTURE_2D, texture_id);
   glTexSubImage2D (GL_TEXTURE_2D, 0, x, y, width, height,
                    gl_format, gl_type, pixel_data);
   glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
diff --git a/gsk/ngl/gsknglrenderjob.c b/gsk/ngl/gsknglrenderjob.c
index 87c407cd9b..f96470d68f 100644
--- a/gsk/ngl/gsknglrenderjob.c
+++ b/gsk/ngl/gsknglrenderjob.c
@@ -3936,7 +3936,7 @@ gsk_ngl_render_job_render (GskNglRenderJob *job,
   gdk_gl_context_pop_debug_group (job->command_queue->context);
   gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Build GL command queue", "");
 
-#if 0
+#if 1
   /* At this point the atlases have uploaded content while we processed
    * nodes but have not necessarily been used by the commands in the queue.
    */
diff --git a/tests/simple.c b/tests/simple.c
index 062afdc9fa..f7bb8da23b 100644
--- a/tests/simple.c
+++ b/tests/simple.c
@@ -45,12 +45,12 @@ main (int argc, char *argv[])
   gtk_init ();
 
   window = gtk_window_new ();
-  gtk_window_set_title (GTK_WINDOW (window), "hello world");
   gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
   g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
 
+  g_object_set (gtk_settings_get_default (), "gtk-font-name", "JetBrains Mono 20", NULL);
   button = gtk_button_new ();
-  gtk_button_set_label (GTK_BUTTON (button), "hello world");
+  gtk_button_set_label (GTK_BUTTON (button), "<!--");
   gtk_widget_set_margin_top (button, 10);
   gtk_widget_set_margin_bottom (button, 10);
   gtk_widget_set_margin_start (button, 10);


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