From 8e7fac0c1465dad9f46cb51b10e99ac55723d36f Mon Sep 17 00:00:00 2001 From: Emanuele Aina Date: Thu, 8 Jan 2015 11:38:56 +0100 Subject: [PATCH 2/3] cairo-trace: Sync _create_similar_image() with _create_similar() After commit c1ac8db7e60b the cairo_surface_create_similar() and cairo_surface_create_similar_image() overrides diverged, with the latter not getting the bugfixes that have been applied to the first. This commit updates the cairo_surface_create_similar_image() override implementation to look like the one of cairo_surface_create_similar(), ensuring that the surface operand gets printed in the trace and always assigning an identifier for the newly created surface. Signed-off-by: Emanuele Aina --- util/cairo-trace/trace.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c index d5d76689c067..d388ab4f3777 100644 --- a/util/cairo-trace/trace.c +++ b/util/cairo-trace/trace.c @@ -3731,19 +3731,25 @@ cairo_surface_create_similar_image (cairo_surface_t *other, Object *other_obj = _get_object(SURFACE, other); Object *new_obj = _create_surface (ret); - if (other_obj->defined) + if (other_obj->operand != -1) { + if (current_stack_depth == other_obj->operand + 1) + _trace_printf ("dup "); + else + _trace_printf ("%d index ", + current_stack_depth - other_obj->operand - 1); + } else { + assert(other_obj->defined); _trace_printf ("s%ld ", other_obj->token); - else if (current_stack_depth == other_obj->operand + 1) - _trace_printf ("dup "); - else - _trace_printf ("%d index ", - current_stack_depth - other_obj->operand - 1); - _trace_printf ("//%s %d %d similar-image %% s%ld\n", + } + + _trace_printf ("//%s %d %d similar-image dup /s%ld exch def\n", _format_to_string (format), width, height, new_obj->token); + new_obj->width = width; new_obj->height = height; + new_obj->defined = TRUE; _push_object (new_obj); dump_stack(__func__); -- 2.1.4