[cairo-commit] 4 commits - src/cairo-surface-observer.c

Chris Wilson ickle at kemper.freedesktop.org
Thu Aug 18 04:09:02 PDT 2011


 src/cairo-surface-observer.c |   76 ++++++++++++++++++++++++++++---------------
 1 file changed, 50 insertions(+), 26 deletions(-)

New commits:
commit 76a3d0dc11624049115cf84859eec5168194e873
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Aug 16 17:20:00 2011 +0100

    observer: only print out the non-zero clip types
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-surface-observer.c b/src/cairo-surface-observer.c
index 364447b..3bd9682 100644
--- a/src/cairo-surface-observer.c
+++ b/src/cairo-surface-observer.c
@@ -1025,12 +1025,15 @@ print_path (cairo_output_stream_t *stream,
 static void
 print_clip (cairo_output_stream_t *stream, const struct clip *c)
 {
-    _cairo_output_stream_printf (stream,
-				 "  clip: %d none, %d region, %d boxes, %d general path\n",
-				 c->type[0],
-				 c->type[1],
-				 c->type[2],
-				 c->type[3]);
+    static const char *names[] = {
+	"none",
+	"region",
+	"boxes",
+	"general path",
+    };
+    _cairo_output_stream_printf (stream, "  clip:");
+    print_array (stream, c->type, names, ARRAY_LENGTH (names));
+    _cairo_output_stream_printf (stream, "\n");
 }
 
 static void
commit a8232ff77cc6eff866494c5a408d914907d643ad
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Aug 16 17:18:09 2011 +0100

    observer: only print out the non-zero path types
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-surface-observer.c b/src/cairo-surface-observer.c
index 314d0e4..364447b 100644
--- a/src/cairo-surface-observer.c
+++ b/src/cairo-surface-observer.c
@@ -1010,13 +1010,16 @@ static void
 print_path (cairo_output_stream_t *stream,
 	    const struct path *p)
 {
-    _cairo_output_stream_printf (stream,
-				 "  path: %d empty, %d pixel-aligned, %d rectilinear, %d straight, %d curved\n",
-				 p->type[0],
-				 p->type[1],
-				 p->type[2],
-				 p->type[3],
-				 p->type[4]);
+    static const char *names[] = {
+	"empty",
+	"pixel-aligned",
+	"rectliinear",
+	"straight",
+	"curved",
+    };
+    _cairo_output_stream_printf (stream, "  path:");
+    print_array (stream, p->type, names, ARRAY_LENGTH (names));
+    _cairo_output_stream_printf (stream, "\n");
 }
 
 static void
commit e4b4b6bfd92000dee2d8384ad64d2e2cfd998bf5
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Aug 16 17:15:37 2011 +0100

    obverser: only print out the active patterns
    
    I prefer the reduced output as exemplified by the operator message.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-surface-observer.c b/src/cairo-surface-observer.c
index 5c3e604..314d0e4 100644
--- a/src/cairo-surface-observer.c
+++ b/src/cairo-surface-observer.c
@@ -875,7 +875,7 @@ print_extents (cairo_output_stream_t *stream, const struct extents *e)
 				 e->unbounded);
 }
 
-static inline int ordercmp (int a, int b, unsigned int *array)
+static inline int ordercmp (int a, int b, const unsigned int *array)
 {
     /* high to low */
     return array[b] - array[a];
@@ -884,7 +884,7 @@ CAIRO_COMBSORT_DECLARE_WITH_DATA (sort_order, int, ordercmp)
 
 static void
 print_array (cairo_output_stream_t *stream,
-	     unsigned int *array,
+	     const unsigned int *array,
 	     const char **names,
 	     int count)
 {
@@ -897,7 +897,7 @@ print_array (cairo_output_stream_t *stream,
 	    order[j++] = i;
     }
 
-    sort_order (order, j, array);
+    sort_order (order, j, (void *)array);
     for (i = 0; i < j; i++)
 	_cairo_output_stream_printf (stream, " %d %s",
 				     array[order[i]], names[order[i]]);
@@ -992,16 +992,18 @@ print_pattern (cairo_output_stream_t *stream,
 	       const char *name,
 	       const struct pattern *p)
 {
-    _cairo_output_stream_printf (stream,
-				 "  %s: %d solid, %d native, %d record, %d other surface, %d linear, %d radial, %d mesh\n",
-				 name,
-				 p->type[3], /* solid first */
-				 p->type[0],
-				 p->type[1],
-				 p->type[2],
-				 p->type[4],
-				 p->type[5],
-				 p->type[6]);
+    static const char *names[] = {
+	"native",
+	"record",
+	"other surface",
+	"solid",
+	"linear",
+	"radial",
+	"mesh"
+    };
+    _cairo_output_stream_printf (stream, "  %s:", name);
+    print_array (stream, p->type, names, ARRAY_LENGTH (names));
+    _cairo_output_stream_printf (stream, "\n");
 }
 
 static void
commit e8ed203da3d132d98c2c1ac73a0ca9955907313e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Aug 16 17:07:52 2011 +0100

    observer: print path antialias modes
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-surface-observer.c b/src/cairo-surface-observer.c
index e5ffe16..5c3e604 100644
--- a/src/cairo-surface-observer.c
+++ b/src/cairo-surface-observer.c
@@ -974,6 +974,20 @@ print_line_joins (cairo_output_stream_t *stream, unsigned int *array)
 }
 
 static void
+print_antialias (cairo_output_stream_t *stream, unsigned int *array)
+{
+    static const char *names[] = {
+	"default",
+	"none",
+	"gray",
+	"subpixel"
+    };
+    _cairo_output_stream_printf (stream, "  antialias:");
+    print_array (stream, array, names, NUM_ANTIALIAS);
+    _cairo_output_stream_printf (stream, "\n");
+}
+
+static void
 print_pattern (cairo_output_stream_t *stream,
 	       const char *name,
 	       const struct pattern *p)
@@ -1051,6 +1065,7 @@ _cairo_observation_print (cairo_output_stream_t *stream,
 	print_operators (stream, log->fill.operators);
 	print_pattern (stream, "source", &log->fill.source);
 	print_path (stream, &log->fill.path);
+	print_antialias (stream, log->fill.antialias);
 	print_clip (stream, &log->fill.clip);
     }
 
@@ -1061,6 +1076,7 @@ _cairo_observation_print (cairo_output_stream_t *stream,
 	print_operators (stream, log->stroke.operators);
 	print_pattern (stream, "source", &log->stroke.source);
 	print_path (stream, &log->stroke.path);
+	print_antialias (stream, log->stroke.antialias);
 	print_line_caps (stream, log->stroke.caps);
 	print_line_joins (stream, log->stroke.joins);
 	print_clip (stream, &log->stroke.clip);


More information about the cairo-commit mailing list