poppler/CairoOutputDev.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
New commits: commit 454f7468c6a6a442a5064b5daa24d65ebf4fc6b6 Author: Chris Wilson <[email protected]> Date: Thu Jul 9 10:43:00 2009 +0100 [cairo] Fix drawImage() for non-1x1 images Carlos noticed a nasty bug with converting drawImage() to use PAD + fill, instead of NONE + paint. That is the image was being padded out far beyond the correct output extents. The cause is that the caller pre-scales the context for the image, so the output rectangle was many times the true image size - obliterating large amounts of the page. The temporary fix is to counter-act the scaling on the context. Longer term, after fixing all painters to use PAD correctly, we need to review the callers to remove unnecessary pre-scaling. diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc index 79c5c76..a14f68a 100644 --- a/poppler/CairoOutputDev.cc +++ b/poppler/CairoOutputDev.cc @@ -1856,21 +1856,29 @@ void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, LOG (printf ("drawImageMask %dx%d\n", width, height)); - cairo_matrix_init_translate (&matrix, 0, height); - cairo_matrix_scale (&matrix, width, -height); - - cairo_pattern_set_matrix (pattern, &matrix); cairo_pattern_set_filter (pattern, interpolate ? CAIRO_FILTER_BILINEAR : CAIRO_FILTER_FAST); cairo_pattern_set_extend (pattern, CAIRO_EXTEND_PAD); + /* XXX Undo the transformation applied before drawImage(), once all + * painters have been fixed to use PAD we can then fix the callers + * not to apply useless transformations. + */ + cairo_matrix_init_translate (&matrix, 0, height); + cairo_matrix_scale (&matrix, width, -height); + cairo_matrix_invert (&matrix); + + cairo_save (cairo); + cairo_transform (cairo, &matrix); cairo_set_source (cairo, pattern); cairo_rectangle (cairo, 0., 0., width, height); cairo_fill (cairo); + cairo_restore (cairo); if (cairo_shape) { cairo_save (cairo_shape); + cairo_transform (cairo_shape, &matrix); cairo_rectangle (cairo_shape, 0., 0., width, height); cairo_set_source (cairo_shape, pattern); cairo_fill (cairo_shape); _______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
