From e1ded5b1e042c8cefa7f136228d5a63a7bdf84b5 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 25 Oct 2006 21:40:08 -0400 Subject: [PATCH] [PDF] Set CTM before path construction The previous order is undefined according to the PDF spec. The resulting PDF was being misrendered using OS X Preview viewer. This was reported in this thread: http://lists.freedesktop.org/archives/cairo/2006-October/008271.html --- src/cairo-pdf-surface.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c index 6db28ecfb..39bd6951e 100644 --- a/src/cairo-pdf-surface.c +++ b/src/cairo-pdf-surface.c @@ -2539,6 +2539,11 @@ _cairo_pdf_surface_stroke (void *abstract_surface, info.output = surface->output; info.ctm_inverse = ctm_inverse; + _cairo_output_stream_printf (surface->output, + "q %f %f %f %f %f %f cm\r\n", + ctm->xx, ctm->yx, ctm->xy, ctm->yy, + ctm->x0, ctm->y0); + status = _cairo_path_fixed_interpret (path, CAIRO_DIRECTION_FORWARD, _cairo_pdf_path_move_to, @@ -2547,11 +2552,6 @@ _cairo_pdf_surface_stroke (void *abstract_surface, _cairo_pdf_path_close_path, &info); - _cairo_output_stream_printf (surface->output, - "q %f %f %f %f %f %f cm\r\n", - ctm->xx, ctm->yx, ctm->xy, ctm->yy, - ctm->x0, ctm->y0); - _cairo_output_stream_printf (surface->output, "S Q\r\n"); return status;