diff options
author | Albert Astals Cid <aacid@kde.org> | 2021-02-07 23:37:56 +0100 |
---|---|---|
committer | Albert Astals Cid <aacid@kde.org> | 2021-02-07 23:37:56 +0100 |
commit | 2589f3252fe304bd52be2a9322915c5397be4b09 (patch) | |
tree | f7fcc7db2def147a124e99cc2268756be3f4044f | |
parent | 0ea6219dd1f2531d44eacfc584e331ecb4b46fb8 (diff) |
OutputDev:tilingPatternFill pass the GfxTilingPattern
instead of lots of fields from it
Makes the signature simpler :)
-rw-r--r-- | poppler/CairoOutputDev.cc | 10 | ||||
-rw-r--r-- | poppler/CairoOutputDev.h | 11 | ||||
-rw-r--r-- | poppler/Gfx.cc | 3 | ||||
-rw-r--r-- | poppler/OutputDev.h | 5 | ||||
-rw-r--r-- | poppler/PSOutputDev.cc | 10 | ||||
-rw-r--r-- | poppler/PSOutputDev.h | 5 | ||||
-rw-r--r-- | poppler/PreScanOutputDev.cc | 9 | ||||
-rw-r--r-- | poppler/PreScanOutputDev.h | 5 | ||||
-rw-r--r-- | poppler/SplashOutputDev.cc | 11 | ||||
-rw-r--r-- | poppler/SplashOutputDev.h | 5 | ||||
-rw-r--r-- | utils/ImageOutputDev.cc | 5 | ||||
-rw-r--r-- | utils/ImageOutputDev.h | 5 |
12 files changed, 42 insertions, 42 deletions
diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc index c3e29f38..aa68c6cd 100644 --- a/poppler/CairoOutputDev.cc +++ b/poppler/CairoOutputDev.cc @@ -16,7 +16,7 @@ // // Copyright (C) 2005-2008 Jeff Muizelaar <jeff@infidigm.net> // Copyright (C) 2005, 2006 Kristian Høgsberg <krh@redhat.com> -// Copyright (C) 2005, 2009, 2012, 2017-2020 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2005, 2009, 2012, 2017-2021 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2005 Nickolay V. Shmyrev <nshmyrev@yandex.ru> // Copyright (C) 2006-2011, 2013, 2014, 2017, 2018 Carlos Garcia Campos <carlosgc@gnome.org> // Copyright (C) 2008 Carl Worth <cworth@cworth.org> @@ -885,8 +885,7 @@ void CairoOutputDev::eoFill(GfxState *state) } } -bool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat, Object *str, const double *pmat, int paintType, int /*tilingType*/, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, - double xStep, double yStep) +bool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat, GfxTilingPattern *tPat, const double *mat, int x0, int y0, int x1, int y1, double xStep, double yStep) { PDFRectangle box; Gfx *gfx; @@ -902,6 +901,11 @@ bool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat, StrokePathClip *strokePathTmp; bool adjusted_stroke_width_tmp; cairo_pattern_t *maskTmp; + const double *bbox = tPat->getBBox(); + const double *pmat = tPat->getMatrix(); + const int paintType = tPat->getPaintType(); + Dict *resDict = tPat->getResDict(); + Object *str = tPat->getContentStream(); width = bbox[2] - bbox[0]; height = bbox[3] - bbox[1]; diff --git a/poppler/CairoOutputDev.h b/poppler/CairoOutputDev.h index 87e1dc55..dc101e22 100644 --- a/poppler/CairoOutputDev.h +++ b/poppler/CairoOutputDev.h @@ -23,7 +23,7 @@ // Copyright (C) 2010-2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2015 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp> // Copyright (C) 2016 Jason Crain <jason@aquaticape.us> -// Copyright (C) 2018, 2019 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2018, 2019, 2021 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich // Copyright (C) 2020 Michal <sudolskym@gmail.com> // @@ -170,8 +170,7 @@ public: void fill(GfxState *state) override; void eoFill(GfxState *state) override; void clipToStrokePath(GfxState *state) override; - bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str, const double *pmat, int paintType, int tilingType, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, double xStep, - double yStep) override; + bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, GfxTilingPattern *tPat, const double *mat, int x0, int y0, int x1, int y1, double xStep, double yStep) override; #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) bool functionShadedFill(GfxState *state, GfxFunctionShading *shading) override; #endif @@ -421,11 +420,7 @@ public: void fill(GfxState *state) override { } void eoFill(GfxState *state) override { } void clipToStrokePath(GfxState *state) override { } - bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str, const double *pmat, int paintType, int tilingType, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, double xStep, - double yStep) override - { - return true; - } + bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, GfxTilingPattern *tPat, const double *mat, int x0, int y0, int x1, int y1, double xStep, double yStep) override { return true; } bool axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) override { return true; } bool radialShadedFill(GfxState *state, GfxRadialShading *shading, double sMin, double sMax) override { return true; } diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc index 34a02d53..cbdd5feb 100644 --- a/poppler/Gfx.cc +++ b/poppler/Gfx.cc @@ -2174,8 +2174,7 @@ void Gfx::doTilingPatternFill(GfxTilingPattern *tPat, bool stroke, bool eoFill, } } if (shouldDrawPattern) { - if (out->useTilingPatternFill() - && out->tilingPatternFill(state, this, catalog, tPat->getContentStream(), tPat->getMatrix(), tPat->getPaintType(), tPat->getTilingType(), tPat->getResDict(), m1, tPat->getBBox(), xi0, yi0, xi1, yi1, xstep, ystep)) { + if (out->useTilingPatternFill() && out->tilingPatternFill(state, this, catalog, tPat, m1, xi0, yi0, xi1, yi1, xstep, ystep)) { // do nothing } else { out->updatePatternOpacity(state); diff --git a/poppler/OutputDev.h b/poppler/OutputDev.h index 1802894b..024764a6 100644 --- a/poppler/OutputDev.h +++ b/poppler/OutputDev.h @@ -19,7 +19,7 @@ // Copyright (C) 2007, 2011, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2009-2013, 2015 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2009, 2011 Carlos Garcia Campos <carlosgc@gnome.org> -// Copyright (C) 2009, 2012, 2013, 2018, 2019 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2009, 2012, 2013, 2018, 2019, 2021 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com> // Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> // Copyright (C) 2012 William Bader <williambader@hotmail.com> @@ -229,8 +229,7 @@ public: virtual void stroke(GfxState * /*state*/) { } virtual void fill(GfxState * /*state*/) { } virtual void eoFill(GfxState * /*state*/) { } - virtual bool tilingPatternFill(GfxState * /*state*/, Gfx * /*gfx*/, Catalog * /*cat*/, Object * /*str*/, const double * /*pmat*/, int /*paintType*/, int /*tilingType*/, Dict * /*resDict*/, const double * /*mat*/, - const double * /*bbox*/, int /*x0*/, int /*y0*/, int /*x1*/, int /*y1*/, double /*xStep*/, double /*yStep*/) + virtual bool tilingPatternFill(GfxState * /*state*/, Gfx * /*gfx*/, Catalog * /*cat*/, GfxTilingPattern * /*tPat*/, const double * /*mat*/, int /*x0*/, int /*y0*/, int /*x1*/, int /*y1*/, double /*xStep*/, double /*yStep*/) { return false; } diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc index de73c15b..695f1c1e 100644 --- a/poppler/PSOutputDev.cc +++ b/poppler/PSOutputDev.cc @@ -4445,9 +4445,15 @@ bool PSOutputDev::tilingPatternFillL2(GfxState *state, Catalog *cat, Object *str return true; } -bool PSOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat, Object *str, const double *pmat, int paintType, int tilingType, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, - double xStep, double yStep) +bool PSOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat, GfxTilingPattern *tPat, const double *mat, int x0, int y0, int x1, int y1, double xStep, double yStep) { + const double *bbox = tPat->getBBox(); + const double *pmat = tPat->getMatrix(); + const int paintType = tPat->getPaintType(); + const int tilingType = tPat->getTilingType(); + Dict *resDict = tPat->getResDict(); + Object *str = tPat->getContentStream(); + if (x1 - x0 == 1 && y1 - y0 == 1) { // Don't need to use patterns if only one instance of the pattern is used PDFRectangle box; diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h index c51b10a1..5c320914 100644 --- a/poppler/PSOutputDev.h +++ b/poppler/PSOutputDev.h @@ -15,7 +15,7 @@ // // Copyright (C) 2005 Martin Kretzschmar <martink@gnome.org> // Copyright (C) 2005 Kristian Høgsberg <krh@redhat.com> -// Copyright (C) 2006-2008, 2012, 2013, 2015, 2017-2020 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2006-2008, 2012, 2013, 2015, 2017-2021 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2007 Brad Hards <bradh@kde.org> // Copyright (C) 2009-2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2009 Till Kamppeter <till.kamppeter@gmail.com> @@ -232,8 +232,7 @@ public: void stroke(GfxState *state) override; void fill(GfxState *state) override; void eoFill(GfxState *state) override; - bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str, const double *pmat, int paintType, int tilingType, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, double xStep, - double yStep) override; + bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, GfxTilingPattern *tPat, const double *mat, int x0, int y0, int x1, int y1, double xStep, double yStep) override; bool functionShadedFill(GfxState *state, GfxFunctionShading *shading) override; bool axialShadedFill(GfxState *state, GfxAxialShading *shading, double /*tMin*/, double /*tMax*/) override; bool radialShadedFill(GfxState *state, GfxRadialShading *shading, double /*sMin*/, double /*sMax*/) override; diff --git a/poppler/PreScanOutputDev.cc b/poppler/PreScanOutputDev.cc index 478a7f23..d28da26c 100644 --- a/poppler/PreScanOutputDev.cc +++ b/poppler/PreScanOutputDev.cc @@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org> -// Copyright (C) 2010, 2011, 2018-2020 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2010, 2011, 2018-2021 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2011, 2014 William Bader <williambader@hotmail.com> // Copyright (C) 2011, 2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2011 Adrian Johnson <ajohnson@redneon.com> @@ -73,15 +73,14 @@ void PreScanOutputDev::eoFill(GfxState *state) check(state->getFillColorSpace(), state->getFillColor(), state->getFillOpacity(), state->getBlendMode()); } -bool PreScanOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *catalog, Object *str, const double *pmat, int paintType, int /*tilingType*/, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, - double xStep, double yStep) +bool PreScanOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *catalog, GfxTilingPattern *tPat, const double *mat, int x0, int y0, int x1, int y1, double xStep, double yStep) { - if (paintType == 1) { + if (tPat->getPaintType() == 1) { bool tilingNeeded = (x1 - x0 != 1 || y1 - y0 != 1); if (tilingNeeded) { inTilingPatternFill++; } - gfx->drawForm(str, resDict, mat, bbox); + gfx->drawForm(tPat->getContentStream(), tPat->getResDict(), mat, tPat->getBBox()); if (tilingNeeded) { inTilingPatternFill--; } diff --git a/poppler/PreScanOutputDev.h b/poppler/PreScanOutputDev.h index 7e089a5d..2e0aae50 100644 --- a/poppler/PreScanOutputDev.h +++ b/poppler/PreScanOutputDev.h @@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org> -// Copyright (C) 2010, 2018-2020 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2010, 2018-2021 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2011, 2014 William Bader <williambader@hotmail.com> // Copyright (C) 2011, 2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2011 Adrian Johnson <ajohnson@redneon.com> @@ -80,8 +80,7 @@ public: void stroke(GfxState *state) override; void fill(GfxState *state) override; void eoFill(GfxState *state) override; - bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str, const double *pmat, int paintType, int tilingType, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, double xStep, - double yStep) override; + bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, GfxTilingPattern *tPat, const double *mat, int x0, int y0, int x1, int y1, double xStep, double yStep) override; bool functionShadedFill(GfxState *state, GfxFunctionShading *shading) override; bool axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) override; bool radialShadedFill(GfxState *state, GfxRadialShading *shading, double tMin, double tMax) override; diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index 403c596b..3fd590b8 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -15,7 +15,7 @@ // // Copyright (C) 2005 Takashi Iwai <tiwai@suse.de> // Copyright (C) 2006 Stefan Schweizer <genstef@gentoo.org> -// Copyright (C) 2006-2020 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2006-2021 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk@gmail.com> // Copyright (C) 2006 Scott Turner <scotty1024@mac.com> // Copyright (C) 2007 Koji Otani <sho@bbr.jp> @@ -4188,8 +4188,7 @@ void SplashOutputDev::setFreeTypeHinting(bool enable, bool enableSlightHintingA) enableSlightHinting = enableSlightHintingA; } -bool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *catalog, Object *str, const double *ptm, int paintType, int /*tilingType*/, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, - double xStep, double yStep) +bool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *catalog, GfxTilingPattern *tPat, const double *mat, int x0, int y0, int x1, int y1, double xStep, double yStep) { PDFRectangle box; Splash *formerSplash = splash; @@ -4203,6 +4202,10 @@ bool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat double savedCTM[6]; double kx, ky, sx, sy; bool retValue = false; + const double *bbox = tPat->getBBox(); + const double *ptm = tPat->getMatrix(); + const int paintType = tPat->getPaintType(); + Dict *resDict = tPat->getResDict(); width = bbox[2] - bbox[0]; height = bbox[3] - bbox[1]; @@ -4362,7 +4365,7 @@ bool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat splash->setFillPattern(formerSplash->getFillPattern()->copy()); splash->setStrokePattern(formerSplash->getStrokePattern()->copy()); } - gfx->display(str); + gfx->display(tPat->getContentStream()); delete splash; splash = formerSplash; diff --git a/poppler/SplashOutputDev.h b/poppler/SplashOutputDev.h index 1a68d1f9..f0b5028b 100644 --- a/poppler/SplashOutputDev.h +++ b/poppler/SplashOutputDev.h @@ -20,7 +20,7 @@ // Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com> // Copyright (C) 2011 Andrea Canciani <ranma42@gmail.com> // Copyright (C) 2011, 2017 Adrian Johnson <ajohnson@redneon.com> -// Copyright (C) 2012, 2015, 2018-2020 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2012, 2015, 2018-2021 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2015, 2016 William Bader <williambader@hotmail.com> // Copyright (C) 2018 Stefan Brüns <stefan.bruens@rwth-aachen.de> // @@ -265,8 +265,7 @@ public: void stroke(GfxState *state) override; void fill(GfxState *state) override; void eoFill(GfxState *state) override; - bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *catalog, Object *str, const double *ptm, int paintType, int tilingType, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, double xStep, - double yStep) override; + bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *catalog, GfxTilingPattern *tPat, const double *mat, int x0, int y0, int x1, int y1, double xStep, double yStep) override; bool functionShadedFill(GfxState *state, GfxFunctionShading *shading) override; bool axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) override; bool radialShadedFill(GfxState *state, GfxRadialShading *shading, double tMin, double tMax) override; diff --git a/utils/ImageOutputDev.cc b/utils/ImageOutputDev.cc index c438ce33..879d94ee 100644 --- a/utils/ImageOutputDev.cc +++ b/utils/ImageOutputDev.cc @@ -13,7 +13,7 @@ // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // -// Copyright (C) 2005, 2007, 2011, 2018, 2019 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2005, 2007, 2011, 2018, 2019, 2021 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2006 Rainer Keller <class321@gmx.de> // Copyright (C) 2008 Timothy Lee <timothy.lee@siriushk.com> // Copyright (C) 2008 Vasile Gaburici <gaburici@cs.umd.edu> @@ -658,8 +658,7 @@ void ImageOutputDev::writeImage(GfxState *state, Object *ref, Stream *str, int w embedStr->restore(); } -bool ImageOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str, const double *pmat, int paintType, int tilingType, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, - double xStep, double yStep) +bool ImageOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, GfxTilingPattern *tPat, const double *mat, int x0, int y0, int x1, int y1, double xStep, double yStep) { return true; // do nothing -- this avoids the potentially slow loop in Gfx.cc diff --git a/utils/ImageOutputDev.h b/utils/ImageOutputDev.h index a665f3f8..67b77b7b 100644 --- a/utils/ImageOutputDev.h +++ b/utils/ImageOutputDev.h @@ -19,7 +19,7 @@ // Copyright (C) 2010 Jakob Voss <jakob.voss@gbv.de> // Copyright (C) 2012, 2013, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> -// Copyright (C) 2018, 2019 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2018, 2019, 2021 Albert Astals Cid <aacid@kde.org> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -117,8 +117,7 @@ public: bool useDrawChar() override { return false; } //----- path painting - bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str, const double *pmat, int paintType, int tilingType, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, double xStep, - double yStep) override; + bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, GfxTilingPattern *tPat, const double *mat, int x0, int y0, int x1, int y1, double xStep, double yStep) override; //----- image drawing void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, bool invert, bool interpolate, bool inlineImg) override; |