From 97e64de4bc8aae7a34a867e6917d934a2e2e2487 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Thu, 24 Jan 2013 22:18:36 +1030 Subject: [PATCH] cairo: support uncolored tiling patterns Bug 59179 --- poppler/CairoOutputDev.cc | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc index 10df30c..52a2cff 100644 --- a/poppler/CairoOutputDev.cc +++ b/poppler/CairoOutputDev.cc @@ -843,6 +843,13 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat if (cairo_surface_status (surface)) return gFalse; + if (paintType == 2) { + if (strokePathClip) + cairo_set_source (cairo, stroke_pattern); + else + cairo_set_source (cairo, fill_pattern); + } + old_cairo = cairo; cairo = cairo_create (surface); cairo_surface_destroy (surface); @@ -870,12 +877,25 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat cairo_matrix_init (&matrix, mat[0], mat[1], mat[2], mat[3], mat[4], mat[5]); cairo_transform (cairo, &matrix); - cairo_set_source (cairo, pattern); cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT); - if (strokePathClip) { - fillToStrokePathClip(state); + if (paintType == 1) { + /* Colored tiling pattern */ + cairo_set_source (cairo, pattern); + if (strokePathClip) { + fillToStrokePathClip(state); + } else { + cairo_fill (cairo); + } } else { - cairo_fill (cairo); + /* Uncolored tiling pattern */ + if (strokePathClip) { + cairo_push_group(cairo); + cairo_mask (cairo, pattern); + cairo_pop_group_to_source(cairo); + fillToStrokePathClip(state); + } else { + cairo_mask (cairo, pattern); + } } cairo_pattern_destroy (pattern); -- 1.7.10.4