[gtk/ci-jobs: 1/7] Declare global counter only in debug builds



commit 1806af1e83b08d44f257b868d6b8e17a6fb8077b
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Jan 29 14:02:16 2020 +0100

    Declare global counter only in debug builds

 gdk/gdkdrawcontext.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/gdk/gdkdrawcontext.c b/gdk/gdkdrawcontext.c
index 5822ed7eb2..93f85528e6 100644
--- a/gdk/gdkdrawcontext.c
+++ b/gdk/gdkdrawcontext.c
@@ -175,13 +175,17 @@ gdk_draw_context_class_init (GdkDrawContextClass *klass)
   g_object_class_install_properties (gobject_class, LAST_PROP, pspecs);
 }
 
+#ifdef G_ENABLE_DEBUG
 static guint pixels_counter;
+#endif
 
 static void
 gdk_draw_context_init (GdkDrawContext *self)
 {
+#ifdef G_ENABLE_DEBUG
   if (pixels_counter == 0)
     pixels_counter = gdk_profiler_define_int_counter ("frame pixels", "Pixels drawn per frame");
+#endif
 }
 
 /**
@@ -320,6 +324,7 @@ gdk_draw_context_begin_frame (GdkDrawContext       *context,
   GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context, priv->frame_region);
 }
 
+#ifdef G_ENABLE_DEBUG
 static gint64
 region_get_pixels (cairo_region_t *region)
 {
@@ -336,6 +341,7 @@ region_get_pixels (cairo_region_t *region)
 
   return pixels;
 }
+#endif
 
 /**
  * gdk_draw_context_end_frame:
@@ -376,10 +382,12 @@ gdk_draw_context_end_frame (GdkDrawContext *context)
 
   GDK_DRAW_CONTEXT_GET_CLASS (context)->end_frame (context, priv->frame_region);
 
+#ifdef G_ENABLE_DEBUG
   if (gdk_profiler_is_running ())
     gdk_profiler_set_int_counter (pixels_counter,
                                   g_get_monotonic_time () * 1000,
                                   region_get_pixels (priv->frame_region));
+#endif
 
   g_clear_pointer (&priv->frame_region, cairo_region_destroy);
   g_clear_object (&priv->surface->paint_context);


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