poppler/CairoOutputDev.cc | 16 ++++++++-------- poppler/CairoOutputDev.h | 2 +- utils/pdftocairo.cc | 14 ++++++-------- 3 files changed, 15 insertions(+), 17 deletions(-)
New commits: commit 5f939d683a8978cdfdb65a3471296bf9e5940055 Author: Adrian Johnson <[email protected]> Date: Sun Jun 19 11:07:09 2016 +0930 pdftocairo: revert the use of groups for blending into white page This was added in 853e949 but has since been found to cause regressions eg the test case in bug 63587. diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc index 906a5a1..2997683 100644 --- a/utils/pdftocairo.cc +++ b/utils/pdftocairo.cc @@ -641,12 +641,6 @@ static void renderPage(PDFDoc *doc, CairoOutputDev *cairoOut, int pg, cr = cairo_create(surface); - if (!printing && !transp) { - cairo_set_source_rgb (cr, 1,1,1); - cairo_paint (cr); - cairo_push_group_with_content (cr, CAIRO_CONTENT_COLOR_ALPHA); - } - cairoOut->setCairo(cr); cairoOut->setPrinting(printing); cairoOut->setAntialias(antialiasEnum); @@ -680,9 +674,13 @@ static void renderPage(PDFDoc *doc, CairoOutputDev *cairoOut, int pg, cairo_restore(cr); cairoOut->setCairo(NULL); + // Blend onto white page if (!printing && !transp) { - cairo_pop_group_to_source (cr); - cairo_paint (cr); + cairo_save(cr); + cairo_set_operator(cr, CAIRO_OPERATOR_DEST_OVER); + cairo_set_source_rgb(cr, 1, 1, 1); + cairo_paint(cr); + cairo_restore(cr); } status = cairo_status(cr); commit 5165c1a59332a0bc9da60a1a8d53dace039aae32 Author: Adrian Johnson <[email protected]> Date: Sun Jun 19 11:19:24 2016 +0930 cairo: fix bug in setAntialias() Was setting the member cairo instead of cr parameter. Also rename the function to avoid confusion with the public setAntialias() and make it static to prevent this type of bug in future. diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc index 9f892b2..a734324 100644 --- a/poppler/CairoOutputDev.cc +++ b/poppler/CairoOutputDev.cc @@ -206,7 +206,7 @@ void CairoOutputDev::setCairo(cairo_t *cairo) /* save the initial matrix so that we can use it for type3 fonts. */ //XXX: is this sufficient? could we miss changes to the matrix somehow? cairo_get_matrix(cairo, &orig_matrix); - setAntialias(cairo, antialias); + setContextAntialias(cairo, antialias); } else { this->cairo = NULL; this->cairo_shape = NULL; @@ -233,15 +233,15 @@ void CairoOutputDev::setAntialias(cairo_antialias_t antialias) { this->antialias = antialias; if (cairo) - setAntialias (cairo, antialias); + setContextAntialias (cairo, antialias); if (cairo_shape) - setAntialias (cairo_shape, antialias); + setContextAntialias (cairo_shape, antialias); } -void CairoOutputDev::setAntialias(cairo_t *cr, cairo_antialias_t antialias) +void CairoOutputDev::setContextAntialias(cairo_t *cr, cairo_antialias_t antialias) { cairo_font_options_t *font_options; - cairo_set_antialias (cairo, antialias); + cairo_set_antialias (cr, antialias); font_options = cairo_font_options_create (); cairo_get_font_options (cr, font_options); cairo_font_options_set_antialias (font_options, antialias); @@ -934,7 +934,7 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat old_cairo = cairo; cairo = cairo_create (surface); cairo_surface_destroy (surface); - setAntialias(cairo, antialias); + setContextAntialias(cairo, antialias); cairo_scale (cairo, surface_width / width, surface_height / height); box.x1 = bbox[0]; box.y1 = bbox[1]; @@ -1633,7 +1633,7 @@ void CairoOutputDev::beginTransparencyGroup(GfxState * /*state*/, double * /*bbo cairo_surface_t *cairo_shape_surface = cairo_surface_create_similar_clip (cairo, CAIRO_CONTENT_ALPHA); cairo_shape = cairo_create (cairo_shape_surface); cairo_surface_destroy (cairo_shape_surface); - setAntialias(cairo_shape, antialias); + setContextAntialias(cairo_shape, antialias); /* the color doesn't matter as long as it is opaque */ cairo_set_source_rgb (cairo_shape, 0, 0, 0); @@ -1788,7 +1788,7 @@ void CairoOutputDev::setSoftMask(GfxState * state, double * bbox, GBool alpha, cairo_surface_t *source = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height); cairo_t *maskCtx = cairo_create(source); - setAntialias(maskCtx, antialias); + setContextAntialias(maskCtx, antialias); //XXX: hopefully this uses the correct color space */ if (!alpha && groupColorSpaceStack->cs) { diff --git a/poppler/CairoOutputDev.h b/poppler/CairoOutputDev.h index 3a6dbfa..3fa9eca 100644 --- a/poppler/CairoOutputDev.h +++ b/poppler/CairoOutputDev.h @@ -289,7 +289,7 @@ protected: #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0) GBool setMimeDataForJBIG2Globals (Stream *str, cairo_surface_t *image); #endif - void setAntialias(cairo_t *cr, cairo_antialias_t antialias); + static void setContextAntialias(cairo_t *cr, cairo_antialias_t antialias); GfxRGB fill_color, stroke_color; cairo_pattern_t *fill_pattern, *stroke_pattern; _______________________________________________ poppler mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/poppler
