[gtk/path-ops: 23/23] Revert "path ops: Add a debug api"




commit e402d1abef8c8a8caab70d5bea0415101ee9d594
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Apr 1 19:32:03 2022 -0400

    Revert "path ops: Add a debug api"
    
    This reverts commit 3744cc468aaa9347d1d6d6a2c639e1d6da09b6f7.

 gsk/gskpathops.c | 65 -------------------------------------------------
 tests/glyphs.c   | 73 --------------------------------------------------------
 2 files changed, 138 deletions(-)
---
diff --git a/gsk/gskpathops.c b/gsk/gskpathops.c
index 0384d122f8..d43b9e636d 100644
--- a/gsk/gskpathops.c
+++ b/gsk/gskpathops.c
@@ -32,8 +32,6 @@
 
 /* {{{ General utilities */
 
-#define RAD_TO_DEG(r) ((r)*180.0/M_PI)
-
 static void
 g_list_insert_after (GList    *l,
                      gpointer  data)
@@ -979,59 +977,6 @@ dump_dotfile (GList      *edges,
   g_string_free (s, TRUE);
 }
 
-static GString *debug_stream;
-
-GDK_AVAILABLE_IN_ALL
-void gsk_path_set_debug_stream (GString *string);
-
-void
-gsk_path_set_debug_stream (GString *string)
-{
-  debug_stream = string;
-}
-
-static void
-add_debug (const char *format,
-           ...)
-{
-  if (debug_stream)
-    {
-      va_list args;
-
-      va_start (args, format);
-      g_string_append_vprintf (debug_stream,  format, args);
-      va_end (args);
-    }
-}
-
-static void
-add_edge_debug (Node *node,
-                Edge *edge,
-                GString *s)
-{
-  if (edge->end == node)
-    g_string_append_printf (s, "/%s: %d %d%d", edge->name, (int)RAD_TO_DEG (edge->end_angle), 
edge->area_left == AREA_IN, edge->area_right == AREA_IN);
-  else
-    g_string_append_printf (s, "/%s: %d %d%d", edge->name, (int)RAD_TO_DEG (edge->start_angle), 
edge->area_right == AREA_IN, edge->area_left == AREA_IN);
-}
-
-static void
-add_node_debug (Node *node)
-{
-  GString *s = g_string_new ("");
-
-  g_string_append_printf (s, "b:%d ", node->boundaries);
-  for (int i = 0; i < node->edges->len; i++)
-    {
-      Edge *edge = g_ptr_array_index (node->edges, i);
-      add_edge_debug (node, edge, s);
-    }
-
-  add_debug ("(%g,%g) %d %s\n", node->p.x, node->p.y, node->inconsistent, s->str);
-
-  g_string_free (s, TRUE);
-}
-
 /* }}} */
 
 /*
@@ -1428,16 +1373,6 @@ gsk_path_op (GskPathOp  operation,
   if (opdata.second)
     gsk_path_measure_unref (opdata.second);
 
-  if (debug_stream)
-    {
-      g_string_truncate (debug_stream, 0);
-      for (l = opdata.nodes; l; l = l->next)
-        {
-          Node *node = l->data;
-          add_node_debug (node);
-        }
-    }
-
   g_list_free_full (opdata.edges, (GDestroyNotify) edge_free);
   g_list_free_full (opdata.nodes, (GDestroyNotify) node_free);
 
diff --git a/tests/glyphs.c b/tests/glyphs.c
index 4a346da7d7..b2c70f128b 100644
--- a/tests/glyphs.c
+++ b/tests/glyphs.c
@@ -1,8 +1,6 @@
 #include <gtk/gtk.h>
 #include <gsk/gskcurveprivate.h>
 
-static GString *debug_stream;
-
 #define DEMO_TYPE_WIDGET (demo_widget_get_type ())
 G_DECLARE_FINAL_TYPE (DemoWidget, demo_widget, DEMO, WIDGET, GtkWidget)
 
@@ -294,66 +292,6 @@ point_cb (GskPathOperation        op,
   return TRUE;
 }
 
-static void
-add_debug_string (GtkWidget *widget,
-                  GtkSnapshot *snapshot,
-                  double       x,
-                  double       y,
-                  const char  *text)
-{
-  PangoLayout *layout;
-
-  layout = gtk_widget_create_pango_layout (widget, text);
-
-  gtk_snapshot_save (snapshot);
-
-  draw_point2 (snapshot, &GRAPHENE_POINT_INIT (x, y), &(GdkRGBA) { 1, 0, 1, 1 }, 4);
-
-  gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x + 10, y + 10));
-  gtk_snapshot_append_layout (snapshot, layout, &(GdkRGBA){0, 0, 0, 1});
-  gtk_snapshot_restore (snapshot);
-
-  g_object_unref (layout);
-}
-
-static void
-add_debug_stream (GtkWidget *widget,
-                  GtkSnapshot *snapshot)
-{
-  char **s;
-
-  s = g_strsplit (debug_stream->str, "\n", -1);
-  for (int i = 0; s[i]; i++)
-    {
-      char *end;
-      char *p = s[i];
-      double x, y;
-      gboolean inconsistent;
-
-      if (p[0] != '(')
-        break;
-       p++;
-
-       x = g_ascii_strtod (p, &end);
-       if (*end != ',')
-         break;
-       p = end + 1;
-
-       y = g_ascii_strtod (p, &end);
-       if (*end != ')')
-         break;
-       p = end + 1;
-
-       inconsistent = g_ascii_strtoll (p, &end, 10);
-       p = end + 1;
-
-       if (inconsistent)
-         add_debug_string (widget, snapshot, x, y, p);
-    }
-
-  g_strfreev (s);
-}
-
 static void
 demo_widget_snapshot (GtkWidget   *widget,
                       GtkSnapshot *snapshot)
@@ -374,8 +312,6 @@ demo_widget_snapshot (GtkWidget   *widget,
   width = self->bounds.origin.x + self->bounds.size.width + 10;
   height =self->bounds.origin.y + self->bounds.size.height + 10;
 
-  add_debug_stream (widget, snapshot);
-
   if (self->do_fill)
     {
       gtk_snapshot_push_fill (snapshot, self->path, self->fill_rule);
@@ -605,8 +541,6 @@ update_text_output (DemoWidget *self)
   g_free (text);
 }
 
-extern void gsk_path_set_debug_stream (GString *string);
-
 static void
 demo_widget_set_path (DemoWidget *self,
                       GskPath    *path1,
@@ -624,13 +558,6 @@ demo_widget_set_path (DemoWidget *self,
 
   self->orig_path1 = gsk_path_ref (path1);
   self->orig_path2 = gsk_path_ref (path2);
-
-  if (!debug_stream)
-    {
-      debug_stream = g_string_new ("");
-      gsk_path_set_debug_stream (debug_stream);
-    }
-
   switch (self->operation)
     {
     case 0:


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