forked from AuroraMiddleware/gtk
GtkPixelCache: Add debug feature to track redraws
Each time we redraw we tint it in a different color so that you can see which regions are redrawn.
This commit is contained in:
parent
30dc399b72
commit
dde714386d
@ -49,7 +49,8 @@ typedef enum {
|
|||||||
GTK_DEBUG_BUILDER = 1 << 11,
|
GTK_DEBUG_BUILDER = 1 << 11,
|
||||||
GTK_DEBUG_SIZE_REQUEST = 1 << 12,
|
GTK_DEBUG_SIZE_REQUEST = 1 << 12,
|
||||||
GTK_DEBUG_NO_CSS_CACHE = 1 << 13,
|
GTK_DEBUG_NO_CSS_CACHE = 1 << 13,
|
||||||
GTK_DEBUG_BASELINES = 1 << 14
|
GTK_DEBUG_BASELINES = 1 << 14,
|
||||||
|
GTK_DEBUG_PIXEL_CACHE = 1 << 15
|
||||||
} GtkDebugFlag;
|
} GtkDebugFlag;
|
||||||
|
|
||||||
#ifdef G_ENABLE_DEBUG
|
#ifdef G_ENABLE_DEBUG
|
||||||
|
@ -172,7 +172,8 @@ static const GDebugKey gtk_debug_keys[] = {
|
|||||||
{"builder", GTK_DEBUG_BUILDER},
|
{"builder", GTK_DEBUG_BUILDER},
|
||||||
{"size-request", GTK_DEBUG_SIZE_REQUEST},
|
{"size-request", GTK_DEBUG_SIZE_REQUEST},
|
||||||
{"no-css-cache", GTK_DEBUG_NO_CSS_CACHE},
|
{"no-css-cache", GTK_DEBUG_NO_CSS_CACHE},
|
||||||
{"baselines", GTK_DEBUG_BASELINES}
|
{"baselines", GTK_DEBUG_BASELINES},
|
||||||
|
{"pixel-cache", GTK_DEBUG_PIXEL_CACHE}
|
||||||
};
|
};
|
||||||
#endif /* G_ENABLE_DEBUG */
|
#endif /* G_ENABLE_DEBUG */
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "gtkdebug.h"
|
||||||
#include "gtkpixelcacheprivate.h"
|
#include "gtkpixelcacheprivate.h"
|
||||||
|
|
||||||
/* The extra size of the offscreen surface we allocate
|
/* The extra size of the offscreen surface we allocate
|
||||||
@ -289,7 +290,27 @@ _gtk_pixel_cache_repaint (GtkPixelCache *cache,
|
|||||||
|
|
||||||
cairo_set_operator (backing_cr, CAIRO_OPERATOR_OVER);
|
cairo_set_operator (backing_cr, CAIRO_OPERATOR_OVER);
|
||||||
|
|
||||||
|
cairo_save (backing_cr);
|
||||||
draw (backing_cr, user_data);
|
draw (backing_cr, user_data);
|
||||||
|
cairo_restore (backing_cr);
|
||||||
|
|
||||||
|
#ifdef G_ENABLE_DEBUG
|
||||||
|
if (gtk_get_debug_flags () & GTK_DEBUG_PIXEL_CACHE)
|
||||||
|
{
|
||||||
|
GdkRGBA colors[] = {
|
||||||
|
{ 1, 0, 0, 0.08},
|
||||||
|
{ 0, 1, 0, 0.08},
|
||||||
|
{ 0, 0, 1, 0.08},
|
||||||
|
{ 1, 0, 1, 0.08},
|
||||||
|
{ 1, 1, 0, 0.08},
|
||||||
|
{ 0, 1, 1, 0.08},
|
||||||
|
};
|
||||||
|
static int current_color = 0;
|
||||||
|
|
||||||
|
gdk_cairo_set_source_rgba (backing_cr, &colors[(current_color++) % G_N_ELEMENTS (colors)]);
|
||||||
|
cairo_paint (backing_cr);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
cairo_destroy (backing_cr);
|
cairo_destroy (backing_cr);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user