[mutter] window-actor: Add a debugging tool to write a region to a PNG
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] window-actor: Add a debugging tool to write a region to a PNG
- Date: Fri, 25 May 2012 22:45:53 +0000 (UTC)
commit 30bc8bc6ce079a69cc933d9fe0a2d5a928be3b81
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Sun Apr 29 04:44:53 2012 -0400
window-actor: Add a debugging tool to write a region to a PNG
Just a helper function that I keep rewriting all over the place.
https://bugzilla.gnome.org/show_bug.cgi?id=676052
src/compositor/meta-window-actor.c | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index fb5b0c8..d7c8891 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -1684,7 +1684,7 @@ meta_window_actor_get_obscured_region (MetaWindowActor *self)
#if 0
/* Print out a region; useful for debugging */
static void
-dump_region (cairo_region_t *region)
+print_region (cairo_region_t *region)
{
int n_rects;
int i;
@@ -1702,6 +1702,26 @@ dump_region (cairo_region_t *region)
}
#endif
+#if 0
+/* Dump a region to a PNG file; useful for debugging */
+static void
+see_region (cairo_region_t *region,
+ int width,
+ int height,
+ char *filename)
+{
+ cairo_surface_t *surface = cairo_image_surface_create (CAIRO_FORMAT_A8, width, height);
+ cairo_t *cr = cairo_create (surface);
+
+ gdk_cairo_region (cr, region);
+ cairo_fill (cr);
+
+ cairo_surface_write_to_png (surface, filename);
+ cairo_destroy (cr);
+ cairo_surface_destroy (surface);
+}
+#endif
+
/**
* meta_window_actor_set_visible_region:
* @self: a #MetaWindowActor
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]