diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-07-04 13:16:42 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-07-04 13:16:42 +0100 |
commit | f4019be7bdff5c67d679f4de1070c25aa99a993d (patch) | |
tree | 684677dd85523540baa2450b9c6d45f9cabd502c /util/cairo-trace | |
parent | dcb7f1d034438c5c890490df93a86b40fea3036c (diff) |
[trace] Remove a few transient pattern def/undef
It is easier on the eye to use
'1 index set-source exch pop'
rather than
'dup /p0 exch def p0 set-source /p0 undef'
(as patterns are expected to be temporary so we strive to avoid naming
them).
Diffstat (limited to 'util/cairo-trace')
-rw-r--r-- | util/cairo-trace/trace.c | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c index 92b49819..e910d9ee 100644 --- a/util/cairo-trace/trace.c +++ b/util/cairo-trace/trace.c @@ -1985,20 +1985,29 @@ cairo_set_source (cairo_t *cr, cairo_pattern_t *source) { _emit_line_info (); if (cr != NULL && source != NULL && _write_lock ()) { + Object *obj = _get_object (PATTERN, source); + bool need_context_and_pattern = true; + if (_is_current (PATTERN, source, 0) && _is_current (CONTEXT, cr, 1)) { - _consume_operand (); + if (obj->defined) { + _consume_operand (); + need_context_and_pattern = false; + } } else if (_is_current (PATTERN, source, 1) && _is_current (CONTEXT, cr, 0)) { - _trace_printf ("exch "); - _exch_operands (); - _consume_operand (); + if (obj->defined) { + _trace_printf ("exch "); + _exch_operands (); + _consume_operand (); + need_context_and_pattern = false; + } } - else - { + + if (need_context_and_pattern) { _emit_context (cr); _emit_pattern_id (source); } @@ -2353,18 +2362,29 @@ cairo_mask (cairo_t *cr, cairo_pattern_t *pattern) { _emit_line_info (); if (cr != NULL && pattern != NULL && _write_lock ()) { + Object *obj = _get_object (PATTERN, pattern); + bool need_context_and_pattern = true; + if (_is_current (PATTERN, pattern, 0) && _is_current (CONTEXT, cr, 1)) { - _consume_operand (); + if (obj->defined) { + _consume_operand (); + need_context_and_pattern = false; + } } else if (_is_current (PATTERN, pattern, 1) && _is_current (CONTEXT, cr, 0)) { - _trace_printf ("exch "); - _exch_operands (); - _consume_operand (); - } else { + if (obj->defined) { + _trace_printf ("exch "); + _exch_operands (); + _consume_operand (); + need_context_and_pattern = false; + } + } + + if (need_context_and_pattern) { _emit_context (cr); _emit_pattern_id (pattern); } |