From 9a7768a58a938b84860b0f8a3327e82b731cdc0c Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Fri, 25 Jan 2013 22:24:50 +1030 Subject: [PATCH] cairo: support uncolored tiling patterns Bug 59179 --- poppler/CairoOutputDev.cc | 26 ++++++++++++++++++++++++++ poppler/CairoOutputDev.h | 1 + 2 files changed, 27 insertions(+) diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc index 10df30c..eafd841 100644 --- a/poppler/CairoOutputDev.cc +++ b/poppler/CairoOutputDev.cc @@ -144,6 +144,7 @@ CairoOutputDev::CairoOutputDev() { prescaleImages = gTrue; printing = gTrue; use_show_text_glyphs = gFalse; + inUncoloredPattern = gFalse; inType3Char = gFalse; t3_glyph_has_bbox = gFalse; @@ -461,6 +462,10 @@ void CairoOutputDev::updateLineWidth(GfxState *state) { void CairoOutputDev::updateFillColor(GfxState *state) { GfxRGB color = fill_color; + if (inUncoloredPattern) { + return; + } + state->getFillRGB(&fill_color); if (cairo_pattern_get_type (fill_pattern) != CAIRO_PATTERN_TYPE_SOLID || color.r != fill_color.r || @@ -481,6 +486,10 @@ void CairoOutputDev::updateFillColor(GfxState *state) { void CairoOutputDev::updateStrokeColor(GfxState *state) { GfxRGB color = stroke_color; + if (inUncoloredPattern) { + return; + } + state->getStrokeRGB(&stroke_color); if (cairo_pattern_get_type (fill_pattern) != CAIRO_PATTERN_TYPE_SOLID || color.r != stroke_color.r || @@ -501,6 +510,10 @@ void CairoOutputDev::updateStrokeColor(GfxState *state) { void CairoOutputDev::updateFillOpacity(GfxState *state) { double opacity = fill_opacity; + if (inUncoloredPattern) { + return; + } + fill_opacity = state->getFillOpacity(); if (opacity != fill_opacity) { cairo_pattern_destroy(fill_pattern); @@ -516,6 +529,10 @@ void CairoOutputDev::updateFillOpacity(GfxState *state) { void CairoOutputDev::updateStrokeOpacity(GfxState *state) { double opacity = stroke_opacity; + if (inUncoloredPattern) { + return; + } + stroke_opacity = state->getStrokeOpacity(); if (opacity != stroke_opacity) { cairo_pattern_destroy(stroke_pattern); @@ -529,6 +546,9 @@ void CairoOutputDev::updateStrokeOpacity(GfxState *state) { } void CairoOutputDev::updateFillColorStop(GfxState *state, double offset) { + if (inUncoloredPattern) { + return; + } state->getFillRGB(&fill_color); cairo_pattern_add_color_stop_rgba(fill_pattern, offset, @@ -852,7 +872,13 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat strokePathTmp = strokePathClip; strokePathClip = NULL; gfx = new Gfx(doc, this, resDict, &box, NULL, NULL, NULL, gfxA->getXRef()); + if (paintType == 2) { + inUncoloredPattern = gTrue; + } gfx->display(str); + if (paintType == 2) { + inUncoloredPattern = gFalse; + } delete gfx; strokePathClip = strokePathTmp; diff --git a/poppler/CairoOutputDev.h b/poppler/CairoOutputDev.h index 2ac1fd5..e2cdf16 100644 --- a/poppler/CairoOutputDev.h +++ b/poppler/CairoOutputDev.h @@ -320,6 +320,7 @@ protected: int utf8Count; int utf8Max; cairo_path_t *textClipPath; + GBool inUncoloredPattern; // inside a uncolored pattern (PaintType = 2) GBool inType3Char; // inside a Type 3 CharProc double t3_glyph_wx, t3_glyph_wy; GBool t3_glyph_has_bbox; -- 1.7.10.4