From 9b8b4232587831fdada37de033c272a3c5049c34 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Thu, 12 Jan 2012 00:26:03 +1030 Subject: [PATCH] cairo: avoid setting huge clip area when printing Bug 44002 --- poppler/CairoOutputDev.cc | 21 ++++++++++++--------- 1 files changed, 12 insertions(+), 9 deletions(-) diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc index fae0136..e2ecfda 100644 --- a/poppler/CairoOutputDev.cc +++ b/poppler/CairoOutputDev.cc @@ -2779,15 +2779,17 @@ void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, cairo_save (cairo); cairo_set_source (cairo, pattern); - if (printing) - cairo_rectangle (cairo, 0., 0., width, height); - else + if (!printing) cairo_rectangle (cairo, 0., 0., 1., 1.); if (maskPattern) { - cairo_clip (cairo); + if (!printing) + cairo_clip (cairo); cairo_mask (cairo, maskPattern); } else { - cairo_fill (cairo); + if (printing) + cairo_paint (cairo); + else + cairo_fill (cairo); } cairo_restore (cairo); @@ -2796,11 +2798,12 @@ void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, if (cairo_shape) { cairo_save (cairo_shape); cairo_set_source (cairo_shape, pattern); - if (printing) - cairo_rectangle (cairo_shape, 0., 0., width, height); - else + if (printing) { + cairo_paint (cairo_shape); + } else { cairo_rectangle (cairo_shape, 0., 0., 1., 1.); - cairo_fill (cairo_shape); + cairo_fill (cairo_shape); + } cairo_restore (cairo_shape); } -- 1.7.5.4