[gtk+/wip/matthiasc/glyph-cache] gsk: Fix serialization of text nodes



commit 3a6dd85e7f64f89153dbc4fc004f90b226d0d55c
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Sep 20 21:00:33 2017 -0400

    gsk: Fix serialization of text nodes

 gsk/gskrendernodeimpl.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c
index a71bea7..ad6ffda 100644
--- a/gsk/gskrendernodeimpl.c
+++ b/gsk/gskrendernodeimpl.c
@@ -3901,6 +3901,8 @@ gsk_text_node_serialize (GskRenderNode *node)
 
   desc = pango_font_describe (self->font);
   s = pango_font_description_to_string (desc);
+
+  g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(uiiii)"));
   for (i = 0; i < self->glyphs->num_glyphs; i++)
     {
       PangoGlyphInfo *glyph = &self->glyphs->glyphs[i];
@@ -3912,7 +3914,6 @@ gsk_text_node_serialize (GskRenderNode *node)
                              glyph->attr.is_cluster_start);
     }
 
-  g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(uiiii)"));
   v = g_variant_new (GSK_TEXT_NODE_VARIANT_TYPE,
                      s,
                      self->color.red,
@@ -3935,7 +3936,7 @@ gsk_text_node_deserialize (GVariant  *variant,
 {
   PangoFont *font;
   PangoGlyphString *glyphs;
-  GVariantIter iter;
+  GVariantIter *iter;
   GskRenderNode *result;
   PangoGlyphInfo glyph;
   PangoFontDescription *desc;
@@ -3950,7 +3951,7 @@ gsk_text_node_deserialize (GVariant  *variant,
   if (!check_variant_type (variant, GSK_TEXT_NODE_VARIANT_TYPE, error))
     return NULL;
 
-  g_variant_get (variant, "(&sddddiidda(uiiii))",
+  g_variant_get (variant, "(&sdddddda(uiiii))",
                  &s, &color.red, &color.green, &color.blue, &color.alpha,
                  &x, &y, &iter);
 
@@ -3960,9 +3961,9 @@ gsk_text_node_deserialize (GVariant  *variant,
   font = pango_font_map_load_font (fontmap, context, desc);
 
   glyphs = pango_glyph_string_new ();
-  pango_glyph_string_set_size (glyphs, g_variant_iter_n_children (&iter));
+  pango_glyph_string_set_size (glyphs, g_variant_iter_n_children (iter));
   i = 0;
-  while (g_variant_iter_next (&iter, "(uiiii)",
+  while (g_variant_iter_next (iter, "(uiiii)",
                               &glyph.glyph, &glyph.geometry.width,
                               &glyph.geometry.x_offset, &glyph.geometry.y_offset,
                               &cluster_start))
@@ -3971,6 +3972,7 @@ gsk_text_node_deserialize (GVariant  *variant,
       glyphs->glyphs[i] = glyph;
       i++;
     }
+  g_variant_iter_free (iter);
 
   result = gsk_text_node_new (font, glyphs, &color, x, y); /* FIXME: Avoid copying glyphs */
 


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