[cairo-commit] util/cairo-trace

Chris Wilson ickle at kemper.freedesktop.org
Fri Jul 29 09:24:39 PDT 2011


 util/cairo-trace/trace.c |   23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

New commits:
commit b2ee7d9a21df56bf68851930448bc91f49a93e3d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Jul 29 17:14:42 2011 +0100

    trace: Emit the content type for image surfaces
    
    Currently we only emit the format, but if you want to later convert
    the images to a normal surface for replay it is handy to have the
    content.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index 9337a3b..d9e7704 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -1465,6 +1465,25 @@ _format_to_string (cairo_format_t format)
 }
 
 static const char *
+_format_to_content_string (cairo_format_t format)
+{
+    switch (format) {
+    case CAIRO_FORMAT_INVALID:
+	return "INVALID";
+    case CAIRO_FORMAT_ARGB32:
+	return "COLOR_ALPHA";
+    case CAIRO_FORMAT_RGB30:
+    case CAIRO_FORMAT_RGB24:
+    case CAIRO_FORMAT_RGB16_565:
+	return "COLOR";
+    case CAIRO_FORMAT_A8:
+    case CAIRO_FORMAT_A1:
+	return "ALPHA";
+    }
+    return "UNKNOWN";
+}
+
+static const char *
 _status_to_string (cairo_status_t status)
 {
 #define f(name) case CAIRO_STATUS_ ## name: return "STATUS_" #name
@@ -3406,13 +3425,15 @@ cairo_image_surface_create (cairo_format_t format, int width, int height)
     if (_write_lock ()) {
 	Object *obj = _create_surface (ret);
 	const char *format_str = _format_to_string (format);
+	const char *content_str = _format_to_content_string (format);
 
 	_trace_printf ("dict\n"
 		       "  /width %d set\n"
 		       "  /height %d set\n"
 		       "  /format //%s set\n"
+		       "  /content //%s set\n"
 		       "  image dup /s%ld exch def\n",
-		       width, height, format_str, obj->token);
+		       width, height, format_str, content_str, obj->token);
 	obj->width = width;
 	obj->height = height;
 	obj->defined = TRUE;


More information about the cairo-commit mailing list