Use per-display debug flags for visual debugging
This commit is contained in:
parent
02742d5332
commit
1a5cb41bd9
@ -31,6 +31,7 @@
|
||||
#include "gtkrenderbackgroundprivate.h"
|
||||
#include "gtkrenderborderprivate.h"
|
||||
#include "gtkdebug.h"
|
||||
#include "gtkprivate.h"
|
||||
|
||||
/*
|
||||
* Gadgets are 'next-generation widgets' - they combine a CSS node
|
||||
@ -887,50 +888,53 @@ gtk_css_gadget_draw (GtkCssGadget *gadget,
|
||||
height - margin.top - margin.bottom);
|
||||
|
||||
#if G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (LAYOUT))
|
||||
{
|
||||
cairo_save (cr);
|
||||
cairo_new_path (cr);
|
||||
cairo_rectangle (cr,
|
||||
x + margin.left,
|
||||
y + margin.top,
|
||||
width - margin.left - margin.right,
|
||||
height - margin.top - margin.bottom);
|
||||
cairo_set_line_width (cr, 1.0);
|
||||
cairo_set_source_rgba (cr, 0, 0, 1.0, 0.33);
|
||||
cairo_stroke (cr);
|
||||
cairo_rectangle (cr,
|
||||
contents_x,
|
||||
contents_y,
|
||||
contents_width,
|
||||
contents_height);
|
||||
cairo_set_line_width (cr, 1.0);
|
||||
cairo_set_source_rgba (cr, 1.0, 0, 1.0, 0.33);
|
||||
cairo_stroke (cr);
|
||||
cairo_restore (cr);
|
||||
}
|
||||
if (GTK_DEBUG_CHECK (BASELINES))
|
||||
{
|
||||
int baseline = priv->allocated_baseline;
|
||||
{
|
||||
GdkDisplay *display = gtk_widget_get_display (gtk_css_gadget_get_owner (gadget));
|
||||
if (GTK_DISPLAY_DEBUG_CHECK (display, LAYOUT))
|
||||
{
|
||||
cairo_save (cr);
|
||||
cairo_new_path (cr);
|
||||
cairo_rectangle (cr,
|
||||
x + margin.left,
|
||||
y + margin.top,
|
||||
width - margin.left - margin.right,
|
||||
height - margin.top - margin.bottom);
|
||||
cairo_set_line_width (cr, 1.0);
|
||||
cairo_set_source_rgba (cr, 0, 0, 1.0, 0.33);
|
||||
cairo_stroke (cr);
|
||||
cairo_rectangle (cr,
|
||||
contents_x,
|
||||
contents_y,
|
||||
contents_width,
|
||||
contents_height);
|
||||
cairo_set_line_width (cr, 1.0);
|
||||
cairo_set_source_rgba (cr, 1.0, 0, 1.0, 0.33);
|
||||
cairo_stroke (cr);
|
||||
cairo_restore (cr);
|
||||
}
|
||||
if (GTK_DISPLAY_DEBUG_CHECK (display, BASELINES))
|
||||
{
|
||||
int baseline = priv->allocated_baseline;
|
||||
|
||||
if (baseline != -1)
|
||||
{
|
||||
if (priv->owner && !gtk_widget_get_has_window (priv->owner))
|
||||
{
|
||||
GtkAllocation widget_alloc;
|
||||
gtk_widget_get_allocation (priv->owner, &widget_alloc);
|
||||
baseline -= widget_alloc.y;
|
||||
}
|
||||
cairo_save (cr);
|
||||
cairo_new_path (cr);
|
||||
cairo_move_to (cr, x + margin.left, priv->allocated_baseline + 0.5);
|
||||
cairo_rel_line_to (cr, width - margin.left - margin.right, 0);
|
||||
cairo_set_line_width (cr, 1.0);
|
||||
cairo_set_source_rgba (cr, 1.0, 0, 0.25, 0.25);
|
||||
cairo_stroke (cr);
|
||||
cairo_restore (cr);
|
||||
}
|
||||
}
|
||||
if (baseline != -1)
|
||||
{
|
||||
if (priv->owner && !gtk_widget_get_has_window (priv->owner))
|
||||
{
|
||||
GtkAllocation widget_alloc;
|
||||
gtk_widget_get_allocation (priv->owner, &widget_alloc);
|
||||
baseline -= widget_alloc.y;
|
||||
}
|
||||
cairo_save (cr);
|
||||
cairo_new_path (cr);
|
||||
cairo_move_to (cr, x + margin.left, priv->allocated_baseline + 0.5);
|
||||
cairo_rel_line_to (cr, width - margin.left - margin.right, 0);
|
||||
cairo_set_line_width (cr, 1.0);
|
||||
cairo_set_source_rgba (cr, 1.0, 0, 0.25, 0.25);
|
||||
cairo_stroke (cr);
|
||||
cairo_restore (cr);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkdebug.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkpixelcacheprivate.h"
|
||||
#include "gtkrenderbackgroundprivate.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
@ -186,7 +187,7 @@ _gtk_pixel_cache_create_surface_if_needed (GtkPixelCache *cache,
|
||||
cairo_content_t content;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (NO_PIXEL_CACHE))
|
||||
if (GTK_DISPLAY_DEBUG_CHECK (gdk_window_get_display (window), NO_PIXEL_CACHE))
|
||||
return;
|
||||
#endif
|
||||
|
||||
@ -329,6 +330,7 @@ _gtk_pixel_cache_set_position (GtkPixelCache *cache,
|
||||
|
||||
static void
|
||||
_gtk_pixel_cache_repaint (GtkPixelCache *cache,
|
||||
GdkWindow *window,
|
||||
GtkPixelCacheDrawFunc draw,
|
||||
cairo_rectangle_int_t *view_rect,
|
||||
cairo_rectangle_int_t *canvas_rect,
|
||||
@ -361,7 +363,7 @@ _gtk_pixel_cache_repaint (GtkPixelCache *cache,
|
||||
cairo_restore (backing_cr);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (PIXEL_CACHE))
|
||||
if (GTK_DISPLAY_DEBUG_CHECK (gdk_window_get_display (window), PIXEL_CACHE))
|
||||
{
|
||||
GdkRGBA colors[] = {
|
||||
{ 1, 0, 0, 0.08},
|
||||
@ -449,7 +451,7 @@ _gtk_pixel_cache_draw (GtkPixelCache *cache,
|
||||
_gtk_pixel_cache_create_surface_if_needed (cache, window,
|
||||
view_rect, canvas_rect);
|
||||
_gtk_pixel_cache_set_position (cache, view_rect, canvas_rect);
|
||||
_gtk_pixel_cache_repaint (cache, draw, view_rect, canvas_rect, user_data);
|
||||
_gtk_pixel_cache_repaint (cache, window, draw, view_rect, canvas_rect, user_data);
|
||||
|
||||
if (cache->surface && context_is_unscaled (cr) &&
|
||||
/* Don't use backing surface if rendering elsewhere */
|
||||
|
@ -6988,7 +6988,7 @@ gtk_widget_draw_internal (GtkWidget *widget,
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (BASELINES))
|
||||
if (GTK_DISPLAY_DEBUG_CHECK (gtk_widget_get_display (widget), BASELINES))
|
||||
{
|
||||
gint baseline = gtk_widget_get_allocated_baseline (widget);
|
||||
gint width = gtk_widget_get_allocated_width (widget);
|
||||
@ -7005,8 +7005,7 @@ gtk_widget_draw_internal (GtkWidget *widget,
|
||||
cairo_restore (cr);
|
||||
}
|
||||
}
|
||||
|
||||
if (GTK_DEBUG_CHECK (RESIZE) &&
|
||||
if (GTK_DISPLAY_DEBUG_CHECK (gtk_widget_get_display (widget), RESIZE) &&
|
||||
widget->priv->highlight_resize)
|
||||
{
|
||||
GtkAllocation alloc;
|
||||
|
Loading…
Reference in New Issue
Block a user