summaryrefslogtreecommitdiff
path: root/util/cairo-trace
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-11-12 00:37:40 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2008-11-13 11:36:41 +0000
commit4cd6b0c0b9862f398877cb23c294399b480ac8d0 (patch)
tree4baee9b4b4adb04c4a6971be13cc256be9ba8f66 /util/cairo-trace
parent76f249a49399744d6d936e36ca4d68ab4a1f3d3b (diff)
[trace] Check for an undefined pattern and use index instead.
Diffstat (limited to 'util/cairo-trace')
-rw-r--r--util/cairo-trace/trace.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index 18968464..d3e7320d 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -780,6 +780,22 @@ _get_pattern_id (cairo_pattern_t *pattern)
return _get_id (PATTERN, pattern);
}
+static void
+_emit_pattern_id (cairo_pattern_t *pattern)
+{
+ Object *obj = _get_object (PATTERN, pattern);
+ if (obj == NULL) {
+ fprintf (logfile, "null ");
+ } else {
+ if (obj->defined) {
+ fprintf (logfile, "p%ld ", obj->token);
+ } else {
+ fprintf (logfile, "%d index ",
+ current_stack_depth - obj->operand - 1);
+ }
+ }
+}
+
static long
_create_scaled_font_id (cairo_scaled_font_t *font)
{
@@ -1662,7 +1678,7 @@ cairo_set_source (cairo_t *cr, cairo_pattern_t *source)
else
{
_emit_context (cr);
- fprintf (logfile, "p%ld ", _get_pattern_id (source));
+ _emit_pattern_id (source);
}
fprintf (logfile, "set_source\n");
@@ -2010,7 +2026,7 @@ cairo_mask (cairo_t *cr, cairo_pattern_t *pattern)
_consume_operand ();
} else {
_emit_context (cr);
- fprintf (logfile, "p%ld ", _get_pattern_id (pattern));
+ _emit_pattern_id (pattern);
}
fprintf (logfile, " mask\n");