[gtk+/wip/baedert/drawing] widget: Bring resize and baseline debug rendering back
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/drawing] widget: Bring resize and baseline debug rendering back
- Date: Sat, 20 May 2017 17:29:58 +0000 (UTC)
commit 7a091c7e069b60ca654bb1a05372e29e4fa7ba53
Author: Timm Bäder <mail baedert org>
Date: Sat May 20 19:32:16 2017 +0200
widget: Bring resize and baseline debug rendering back
gtk/gtkwidget.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 4ee2b58..d446a6d 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -15576,6 +15576,46 @@ gtk_widget_reset_controllers (GtkWidget *widget)
}
}
+static inline void
+gtk_widget_maybe_add_debug_render_nodes (GtkWidget *widget,
+ GtkSnapshot *snapshot,
+ const graphene_rect_t *bounds)
+{
+ GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
+ GdkDisplay *display = gtk_widget_get_display (widget);
+
+ if (GTK_DISPLAY_DEBUG_CHECK (display, BASELINES))
+ {
+ int baseline = gtk_widget_get_allocated_baseline (widget);
+
+ if (baseline != -1)
+ {
+ cairo_t *ct = gtk_snapshot_append_cairo (snapshot, bounds, "Baseline Debug");
+ cairo_new_path (ct);
+ cairo_move_to (ct, 0, baseline+0.5);
+ cairo_line_to (ct, bounds->size.width, baseline+0.5);
+ cairo_set_line_width (ct, 1.0);
+ cairo_set_source_rgba (ct, 1.0, 0, 0, 0.25);
+ cairo_stroke (ct);
+
+ cairo_destroy (ct);
+ }
+ }
+
+ if (GTK_DISPLAY_DEBUG_CHECK (display, RESIZE) &&
+ priv->highlight_resize)
+ {
+ cairo_t *ct = gtk_snapshot_append_cairo (snapshot, bounds, "Resize Debug");
+ cairo_rectangle (ct, 0, 0, bounds->size.width, bounds->size.height);
+ cairo_set_source_rgba (ct, 1, 0, 0, 0.2);
+ cairo_fill (ct);
+ cairo_destroy (ct);
+
+ priv->highlight_resize = FALSE;
+ gtk_widget_queue_draw (widget);
+ }
+}
+
void
gtk_widget_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
@@ -15702,6 +15742,11 @@ gtk_widget_snapshot (GtkWidget *widget,
gtk_css_filter_value_pop_snapshot (filter_value, snapshot);
+#ifdef G_ENABLE_DEBUG
+ gtk_widget_maybe_add_debug_render_nodes (widget, snapshot, &bounds);
+#endif
+
+
if (GTK_DEBUG_CHECK (SNAPSHOT))
gtk_snapshot_pop (snapshot);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]