diff options
Diffstat (limited to 'src/cairo-debug.c')
-rw-r--r-- | src/cairo-debug.c | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/src/cairo-debug.c b/src/cairo-debug.c index 61156f0..8d310a5 100644 --- a/src/cairo-debug.c +++ b/src/cairo-debug.c @@ -61,15 +61,59 @@ cairo_debug_reset_static_data (void) { CAIRO_MUTEX_INITIALIZE (); - _cairo_font_face_reset_static_data (); + _cairo_scaled_font_map_destroy (); + + _cairo_toy_font_face_reset_static_data (); #if CAIRO_HAS_FT_FONT _cairo_ft_font_reset_static_data (); #endif + _cairo_intern_string_reset_static_data (); + _cairo_scaled_font_reset_static_data (); _cairo_pattern_reset_static_data (); CAIRO_MUTEX_FINALIZE (); } + +#if HAVE_VALGRIND +void +_cairo_debug_check_image_surface_is_defined (const cairo_surface_t *surface) +{ + const cairo_image_surface_t *image = (cairo_image_surface_t *) surface; + const uint8_t *bits; + int row, width; + + if (surface == NULL) + return; + + if (! RUNNING_ON_VALGRIND) + return; + + bits = image->data; + switch (image->format) { + case CAIRO_FORMAT_A1: + width = (image->width + 7)/8; + break; + case CAIRO_FORMAT_A8: + width = image->width; + break; + case CAIRO_FORMAT_RGB24: + case CAIRO_FORMAT_ARGB32: + width = image->width*4; + break; + default: + /* XXX compute width from pixman bpp */ + return; + } + + for (row = 0; row < image->height; row++) { + VALGRIND_CHECK_MEM_IS_DEFINED (bits, width); + /* and then silence any future valgrind warnings */ + VALGRIND_MAKE_MEM_DEFINED (bits, width); + bits += image->stride; + } +} +#endif |