From d1b8186fd75922e73e62ef8f2ebb011e334ebe36 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 5 Nov 2008 01:16:25 +0000 Subject: [PATCH] [trace] Correct emission of set_font_face and set_source set_font_face was not consuming it's operand but blithely placing an undefined font_face onto the operand stack, whereas set_source was performing invalid exchanges on the stack. --- util/cairo-trace/trace.c | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c index c16efc69d..c12820e9c 100644 --- a/util/cairo-trace/trace.c +++ b/util/cairo-trace/trace.c @@ -1423,13 +1423,6 @@ cairo_set_source (cairo_t *cr, cairo_pattern_t *source) _exch_operands (); _consume_operand (); } - else if (_is_current (PATTERN, source, 0)) - { - _emit_context (cr); - fprintf (logfile, "exch "); - _exch_operands (); - _consume_operand (); - } else { _emit_context (cr); @@ -1938,8 +1931,33 @@ cairo_get_font_face (cairo_t *cr) void cairo_set_font_face (cairo_t *cr, cairo_font_face_t *font_face) { - _emit_cairo_op (cr, "f%ld set_font_face\n", - _get_font_face_id (font_face)); + if (cr != NULL && font_face != NULL) { + if (_pop_operands_to (FONT_FACE, font_face)) { + if (_is_current (CONTEXT, cr, 1)) { + if (_write_lock ()) { + _consume_operand (); + fprintf (logfile, "set_font_face\n"); + _write_unlock (); + } + } else { + if (_get_object (CONTEXT, cr)->defined) { + if (_write_lock ()) { + _consume_operand (); + fprintf (logfile, + "c%ld exch set_font_face pop\n", + _get_context_id (cr)); + _write_unlock (); + } + } else { + _emit_cairo_op (cr, "f%ld set_font_face\n", + _get_font_face_id (font_face)); + } + } + } else { + _emit_cairo_op (cr, "f%ld set_font_face\n", + _get_font_face_id (font_face)); + } + } return DLCALL (cairo_set_font_face, cr, font_face); }