poppler/SplashOutputDev.h | 8 ++++---- splash/SplashBitmap.cc | 8 ++++---- splash/SplashBitmap.h | 21 ++++++++++++--------- splash/SplashClip.cc | 4 ++-- splash/SplashClip.h | 6 +++--- splash/SplashPath.cc | 4 ++-- splash/SplashPath.h | 6 +++--- splash/SplashPattern.cc | 4 ++-- splash/SplashPattern.h | 8 ++++---- splash/SplashScreen.cc | 4 ++-- splash/SplashScreen.h | 6 +++--- splash/SplashState.cc | 4 ++-- splash/SplashState.h | 6 +++--- splash/SplashXPath.cc | 4 ++-- splash/SplashXPath.h | 6 +++--- splash/SplashXPathScanner.cc | 2 +- splash/SplashXPathScanner.h | 6 +++--- 17 files changed, 55 insertions(+), 52 deletions(-)
New commits: commit a9eb92b611f97fe2eb92c4aa9a650b64d66095e0 Author: Albert Astals Cid <[email protected]> Date: Sat Aug 21 12:11:35 2021 +0200 splash: Make the copy() functions const diff --git a/poppler/SplashOutputDev.h b/poppler/SplashOutputDev.h index 544ac14c..9fc6f76e 100644 --- a/poppler/SplashOutputDev.h +++ b/poppler/SplashOutputDev.h @@ -61,7 +61,7 @@ class SplashFunctionPattern : public SplashPattern public: SplashFunctionPattern(SplashColorMode colorMode, GfxState *state, GfxFunctionShading *shading); - SplashPattern *copy() override { return new SplashFunctionPattern(colorMode, state, (GfxFunctionShading *)shading); } + SplashPattern *copy() const override { return new SplashFunctionPattern(colorMode, state, (GfxFunctionShading *)shading); } ~SplashFunctionPattern() override; @@ -117,7 +117,7 @@ class SplashAxialPattern : public SplashUnivariatePattern public: SplashAxialPattern(SplashColorMode colorMode, GfxState *state, GfxAxialShading *shading); - SplashPattern *copy() override { return new SplashAxialPattern(colorMode, state, (GfxAxialShading *)shading); } + SplashPattern *copy() const override { return new SplashAxialPattern(colorMode, state, (GfxAxialShading *)shading); } ~SplashAxialPattern() override; @@ -134,7 +134,7 @@ class SplashGouraudPattern : public SplashGouraudColor public: SplashGouraudPattern(bool bDirectColorTranslation, GfxState *state, GfxGouraudTriangleShading *shading); - SplashPattern *copy() override { return new SplashGouraudPattern(bDirectColorTranslation, state, shading); } + SplashPattern *copy() const override { return new SplashGouraudPattern(bDirectColorTranslation, state, shading); } ~SplashGouraudPattern() override; @@ -170,7 +170,7 @@ class SplashRadialPattern : public SplashUnivariatePattern public: SplashRadialPattern(SplashColorMode colorMode, GfxState *state, GfxRadialShading *shading); - SplashPattern *copy() override { return new SplashRadialPattern(colorMode, state, (GfxRadialShading *)shading); } + SplashPattern *copy() const override { return new SplashRadialPattern(colorMode, state, (GfxRadialShading *)shading); } ~SplashRadialPattern() override; diff --git a/splash/SplashBitmap.cc b/splash/SplashBitmap.cc index 71916e71..1f95bd1a 100644 --- a/splash/SplashBitmap.cc +++ b/splash/SplashBitmap.cc @@ -11,7 +11,7 @@ // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // -// Copyright (C) 2006, 2009, 2010, 2012, 2015, 2018, 2019 Albert Astals Cid <[email protected]> +// Copyright (C) 2006, 2009, 2010, 2012, 2015, 2018, 2019, 2021 Albert Astals Cid <[email protected]> // Copyright (C) 2007 Ilmari Heikkinen <[email protected]> // Copyright (C) 2009 Shen Liang <[email protected]> // Copyright (C) 2009 Stefan Thomas <[email protected]> @@ -52,7 +52,7 @@ // SplashBitmap //------------------------------------------------------------------------ -SplashBitmap::SplashBitmap(int widthA, int heightA, int rowPadA, SplashColorMode modeA, bool alphaA, bool topDown, std::vector<GfxSeparationColorSpace *> *separationListA) +SplashBitmap::SplashBitmap(int widthA, int heightA, int rowPadA, SplashColorMode modeA, bool alphaA, bool topDown, const std::vector<GfxSeparationColorSpace *> *separationListA) { width = widthA; height = heightA; @@ -127,10 +127,10 @@ SplashBitmap::SplashBitmap(int widthA, int heightA, int rowPadA, SplashColorMode separationList->push_back((GfxSeparationColorSpace *)separation->copy()); } -SplashBitmap *SplashBitmap::copy(SplashBitmap *src) +SplashBitmap *SplashBitmap::copy(const SplashBitmap *src) { SplashBitmap *result = new SplashBitmap(src->getWidth(), src->getHeight(), src->getRowPad(), src->getMode(), src->getAlphaPtr() != nullptr, src->getRowSize() >= 0, src->getSeparationList()); - unsigned char *dataSource = src->getDataPtr(); + SplashColorConstPtr dataSource = src->getDataPtr(); unsigned char *dataDest = result->getDataPtr(); int amount = src->getRowSize(); if (amount < 0) { diff --git a/splash/SplashBitmap.h b/splash/SplashBitmap.h index 9586f328..9e2d9912 100644 --- a/splash/SplashBitmap.h +++ b/splash/SplashBitmap.h @@ -13,7 +13,7 @@ // // Copyright (C) 2007 Ilmari Heikkinen <[email protected]> // Copyright (C) 2009 Shen Liang <[email protected]> -// Copyright (C) 2009, 2012, 2018 Albert Astals Cid <[email protected]> +// Copyright (C) 2009, 2012, 2018, 2021 Albert Astals Cid <[email protected]> // Copyright (C) 2009 Stefan Thomas <[email protected]> // Copyright (C) 2010, 2017 Adrian Johnson <[email protected]> // Copyright (C) 2010 Harry Roberts <[email protected]> @@ -51,23 +51,26 @@ public: // color mode <modeA>. Rows will be padded out to a multiple of // <rowPad> bytes. If <topDown> is false, the bitmap will be stored // upside-down, i.e., with the last row first in memory. - SplashBitmap(int widthA, int heightA, int rowPad, SplashColorMode modeA, bool alphaA, bool topDown = true, std::vector<GfxSeparationColorSpace *> *separationList = nullptr); - static SplashBitmap *copy(SplashBitmap *src); + SplashBitmap(int widthA, int heightA, int rowPad, SplashColorMode modeA, bool alphaA, bool topDown = true, const std::vector<GfxSeparationColorSpace *> *separationList = nullptr); + static SplashBitmap *copy(const SplashBitmap *src); ~SplashBitmap(); SplashBitmap(const SplashBitmap &) = delete; SplashBitmap &operator=(const SplashBitmap &) = delete; - int getWidth() { return width; } - int getHeight() { return height; } - int getRowSize() { return rowSize; } - int getAlphaRowSize() { return width; } - int getRowPad() { return rowPad; } - SplashColorMode getMode() { return mode; } + int getWidth() const { return width; } + int getHeight() const { return height; } + int getRowSize() const { return rowSize; } + int getAlphaRowSize() const { return width; } + int getRowPad() const { return rowPad; } + SplashColorMode getMode() const { return mode; } SplashColorPtr getDataPtr() { return data; } unsigned char *getAlphaPtr() { return alpha; } std::vector<GfxSeparationColorSpace *> *getSeparationList() { return separationList; } + SplashColorConstPtr getDataPtr() const { return data; } + const unsigned char *getAlphaPtr() const { return alpha; } + const std::vector<GfxSeparationColorSpace *> *getSeparationList() const { return separationList; } SplashError writePNMFile(char *fileName); SplashError writePNMFile(FILE *f); diff --git a/splash/SplashClip.cc b/splash/SplashClip.cc index 894679c6..06a5229a 100644 --- a/splash/SplashClip.cc +++ b/splash/SplashClip.cc @@ -11,7 +11,7 @@ // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // -// Copyright (C) 2010 Albert Astals Cid <[email protected]> +// Copyright (C) 2010, 2021 Albert Astals Cid <[email protected]> // Copyright (C) 2013, 2021 Thomas Freitag <[email protected]> // Copyright (C) 2019 Stefan Brüns <[email protected]> // @@ -70,7 +70,7 @@ SplashClip::SplashClip(SplashCoord x0, SplashCoord y0, SplashCoord x1, SplashCoo length = size = 0; } -SplashClip::SplashClip(SplashClip *clip) +SplashClip::SplashClip(const SplashClip *clip) { int i; diff --git a/splash/SplashClip.h b/splash/SplashClip.h index a85f8642..7e88e64c 100644 --- a/splash/SplashClip.h +++ b/splash/SplashClip.h @@ -11,7 +11,7 @@ // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // -// Copyright (C) 2010, 2018 Albert Astals Cid <[email protected]> +// Copyright (C) 2010, 2018, 2021 Albert Astals Cid <[email protected]> // Copyright (C) 2013 Thomas Freitag <[email protected]> // Copyright (C) 2019 Stefan Brüns <[email protected]> // @@ -50,7 +50,7 @@ public: SplashClip(SplashCoord x0, SplashCoord y0, SplashCoord x1, SplashCoord y1, bool antialiasA); // Copy a clip. - SplashClip *copy() { return new SplashClip(this); } + SplashClip *copy() const { return new SplashClip(this); } ~SplashClip(); @@ -113,7 +113,7 @@ public: int getNumPaths() { return length; } protected: - SplashClip(SplashClip *clip); + SplashClip(const SplashClip *clip); void grow(int nPaths); bool testClipPaths(int x, int y); diff --git a/splash/SplashPath.cc b/splash/SplashPath.cc index 20a372e3..3b49d255 100644 --- a/splash/SplashPath.cc +++ b/splash/SplashPath.cc @@ -12,7 +12,7 @@ // under GPL version 2 or later // // Copyright (C) 2018 Stefan Brüns <[email protected]> -// Copyright (C) 2018-2020 Albert Astals Cid <[email protected]> +// Copyright (C) 2018-2021 Albert Astals Cid <[email protected]> // Copyright (C) 2018 Adam Reichold <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -53,7 +53,7 @@ SplashPath::SplashPath() hintsLength = hintsSize = 0; } -SplashPath::SplashPath(SplashPath *path) +SplashPath::SplashPath(const SplashPath *path) { length = path->length; size = path->size; diff --git a/splash/SplashPath.h b/splash/SplashPath.h index e04d67af..4448a645 100644 --- a/splash/SplashPath.h +++ b/splash/SplashPath.h @@ -11,7 +11,7 @@ // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // -// Copyright (C) 2018, 2019 Albert Astals Cid <[email protected]> +// Copyright (C) 2018, 2019, 2021 Albert Astals Cid <[email protected]> // Copyright (C) 2018 Stefan Brüns <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -72,7 +72,7 @@ public: SplashPath(); // Copy a path. - SplashPath *copy() { return new SplashPath(this); } + SplashPath *copy() const { return new SplashPath(this); } ~SplashPath(); @@ -122,7 +122,7 @@ public: void reserve(int n); protected: - SplashPath(SplashPath *path); + SplashPath(const SplashPath *path); void grow(int nPts); bool noCurrentPoint() { return curSubpath == length; } bool onePointSubpath() { return curSubpath == length - 1; } diff --git a/splash/SplashPattern.cc b/splash/SplashPattern.cc index c433d422..0dae2468 100644 --- a/splash/SplashPattern.cc +++ b/splash/SplashPattern.cc @@ -12,7 +12,7 @@ // under GPL version 2 or later // // Copyright (C) 2010, 2011 Thomas Freitag <[email protected]> -// Copyright (C) 2020 Albert Astals Cid <[email protected]> +// Copyright (C) 2020, 2021 Albert Astals Cid <[email protected]> // // 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 @@ -37,7 +37,7 @@ SplashPattern::~SplashPattern() { } // SplashSolidColor //------------------------------------------------------------------------ -SplashSolidColor::SplashSolidColor(SplashColorPtr colorA) +SplashSolidColor::SplashSolidColor(SplashColorConstPtr colorA) { splashColorCopy(color, colorA); } diff --git a/splash/SplashPattern.h b/splash/SplashPattern.h index 83de32db..3c93b6e8 100644 --- a/splash/SplashPattern.h +++ b/splash/SplashPattern.h @@ -12,7 +12,7 @@ // under GPL version 2 or later // // Copyright (C) 2010, 2011, 2014 Thomas Freitag <[email protected]> -// Copyright (C) 2018, 2020 Albert Astals Cid <[email protected]> +// Copyright (C) 2018, 2020, 2021 Albert Astals Cid <[email protected]> // // 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 @@ -36,7 +36,7 @@ class SplashPattern public: SplashPattern(); - virtual SplashPattern *copy() = 0; + virtual SplashPattern *copy() const = 0; virtual ~SplashPattern(); @@ -66,9 +66,9 @@ private: class POPPLER_PRIVATE_EXPORT SplashSolidColor : public SplashPattern { public: - SplashSolidColor(SplashColorPtr colorA); + SplashSolidColor(SplashColorConstPtr colorA); - SplashPattern *copy() override { return new SplashSolidColor(color); } + SplashPattern *copy() const override { return new SplashSolidColor(color); } ~SplashSolidColor() override; diff --git a/splash/SplashScreen.cc b/splash/SplashScreen.cc index 96562af0..89ff7fe2 100644 --- a/splash/SplashScreen.cc +++ b/splash/SplashScreen.cc @@ -11,7 +11,7 @@ // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // -// Copyright (C) 2009, 2016, 2018, 2020 Albert Astals Cid <[email protected]> +// Copyright (C) 2009, 2016, 2018, 2020, 2021 Albert Astals Cid <[email protected]> // Copyright (C) 2012 Fabio D'Urso <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -365,7 +365,7 @@ void SplashScreen::buildSCDMatrix(int r) gfree(dots); } -SplashScreen::SplashScreen(SplashScreen *screen) +SplashScreen::SplashScreen(const SplashScreen *screen) { screenParams = screen->screenParams; size = screen->size; diff --git a/splash/SplashScreen.h b/splash/SplashScreen.h index a07d3298..64a9c1fd 100644 --- a/splash/SplashScreen.h +++ b/splash/SplashScreen.h @@ -11,7 +11,7 @@ // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // -// Copyright (C) 2009, 2018, 2020 Albert Astals Cid <[email protected]> +// Copyright (C) 2009, 2018, 2020, 2021 Albert Astals Cid <[email protected]> // // 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 @@ -33,13 +33,13 @@ class SplashScreen { public: SplashScreen(const SplashScreenParams *params); - SplashScreen(SplashScreen *screen); + SplashScreen(const SplashScreen *screen); ~SplashScreen(); SplashScreen(const SplashScreen &) = delete; SplashScreen &operator=(const SplashScreen &) = delete; - SplashScreen *copy() { return new SplashScreen(this); } + SplashScreen *copy() const { return new SplashScreen(this); } // Return the computed pixel value (0=black, 1=white) for the gray // level <value> at (<x>, <y>). diff --git a/splash/SplashState.cc b/splash/SplashState.cc index 96f794ee..1e1b1065 100644 --- a/splash/SplashState.cc +++ b/splash/SplashState.cc @@ -13,7 +13,7 @@ // // Copyright (C) 2009, 2011, 2012, 2015 Thomas Freitag <[email protected]> // Copyright (C) 2017 Adrian Johnson <[email protected]> -// Copyright (C) 2019 Albert Astals Cid <[email protected]> +// Copyright (C) 2019, 2021 Albert Astals Cid <[email protected]> // Copyright (C) 2020 Peter Wang <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -148,7 +148,7 @@ SplashState::SplashState(int width, int height, bool vectorAntialias, SplashScre next = nullptr; } -SplashState::SplashState(SplashState *state) +SplashState::SplashState(const SplashState *state) { memcpy(matrix, state->matrix, 6 * sizeof(SplashCoord)); strokePattern = state->strokePattern->copy(); diff --git a/splash/SplashState.h b/splash/SplashState.h index ebb428ad..26fbaffd 100644 --- a/splash/SplashState.h +++ b/splash/SplashState.h @@ -13,7 +13,7 @@ // // Copyright (C) 2011, 2012, 2015 Thomas Freitag <[email protected]> // Copyright (C) 2017 Adrian Johnson <[email protected]> -// Copyright (C) 2018 Albert Astals Cid <[email protected]> +// Copyright (C) 2018, 2021 Albert Astals Cid <[email protected]> // // 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 @@ -58,7 +58,7 @@ public: SplashState(int width, int height, bool vectorAntialias, SplashScreen *screenA); // Copy a state object. - SplashState *copy() { return new SplashState(this); } + SplashState *copy() const { return new SplashState(this); } ~SplashState(); @@ -89,7 +89,7 @@ public: void setTransfer(unsigned char *red, unsigned char *green, unsigned char *blue, unsigned char *gray); private: - SplashState(SplashState *state); + SplashState(const SplashState *state); SplashCoord matrix[6]; SplashPattern *strokePattern; diff --git a/splash/SplashXPath.cc b/splash/SplashXPath.cc index dfb8497b..02f2f16d 100644 --- a/splash/SplashXPath.cc +++ b/splash/SplashXPath.cc @@ -12,7 +12,7 @@ // under GPL version 2 or later // // Copyright (C) 2010 Paweł Wiejacha <[email protected]> -// Copyright (C) 2010, 2011, 2018, 2019 Albert Astals Cid <[email protected]> +// Copyright (C) 2010, 2011, 2018, 2019, 2021 Albert Astals Cid <[email protected]> // Copyright (C) 2013 Thomas Freitag <[email protected]> // Copyright (C) 2017 Adrian Johnson <[email protected]> // @@ -242,7 +242,7 @@ void SplashXPath::strokeAdjust(SplashXPathAdjust *adjust, SplashCoord *xp, Splas } } -SplashXPath::SplashXPath(SplashXPath *xPath) +SplashXPath::SplashXPath(const SplashXPath *xPath) { length = xPath->length; size = xPath->size; diff --git a/splash/SplashXPath.h b/splash/SplashXPath.h index bd0db9a0..a5bcd487 100644 --- a/splash/SplashXPath.h +++ b/splash/SplashXPath.h @@ -12,7 +12,7 @@ // under GPL version 2 or later // // Copyright (C) 2013 Thomas Freitag <[email protected]> -// Copyright (C) 2018 Albert Astals Cid <[email protected]> +// Copyright (C) 2018, 2021 Albert Astals Cid <[email protected]> // // 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 @@ -66,7 +66,7 @@ public: SplashXPath(SplashPath *path, SplashCoord *matrix, SplashCoord flatness, bool closeSubpaths, bool adjustLines = false, int linePosI = 0); // Copy an expanded path. - SplashXPath *copy() { return new SplashXPath(this); } + SplashXPath *copy() const { return new SplashXPath(this); } ~SplashXPath(); @@ -81,7 +81,7 @@ public: void sort(); protected: - SplashXPath(SplashXPath *xPath); + SplashXPath(const SplashXPath *xPath); void transform(SplashCoord *matrix, SplashCoord xi, SplashCoord yi, SplashCoord *xo, SplashCoord *yo); void strokeAdjust(SplashXPathAdjust *adjust, SplashCoord *xp, SplashCoord *yp); void grow(int nSegs); diff --git a/splash/SplashXPathScanner.cc b/splash/SplashXPathScanner.cc index fcd1c8e7..f8ede09a 100644 --- a/splash/SplashXPathScanner.cc +++ b/splash/SplashXPathScanner.cc @@ -112,7 +112,7 @@ SplashXPathScanner::SplashXPathScanner(SplashXPath *xPathA, bool eoA, int clipYM computeIntersections(); } -SplashXPathScanner::SplashXPathScanner(SplashXPathScanner *scanner) +SplashXPathScanner::SplashXPathScanner(const SplashXPathScanner *scanner) { xPath = scanner->xPath; eo = scanner->eo; diff --git a/splash/SplashXPathScanner.h b/splash/SplashXPathScanner.h index 0815d2f5..322688d4 100644 --- a/splash/SplashXPathScanner.h +++ b/splash/SplashXPathScanner.h @@ -12,7 +12,7 @@ // under GPL version 2 or later // // Copyright (C) 2013, 2014, 2021 Thomas Freitag <[email protected]> -// Copyright (C) 2018 Albert Astals Cid <[email protected]> +// Copyright (C) 2018, 2021 Albert Astals Cid <[email protected]> // Copyright (C) 2018 Stefan Brüns <[email protected]> // // To see a description of the changes please see the Changelog file that @@ -54,7 +54,7 @@ public: SplashXPathScanner(SplashXPath *xPathA, bool eoA, int clipYMin, int clipYMax); // Copy a scanner. - SplashXPathScanner *copy() { return new SplashXPathScanner(this); } + SplashXPathScanner *copy() const { return new SplashXPathScanner(this); } ~SplashXPathScanner(); @@ -97,7 +97,7 @@ public: void clipAALine(SplashBitmap *aaBuf, int *x0, int *x1, int y); protected: - SplashXPathScanner(SplashXPathScanner *scanner); + SplashXPathScanner(const SplashXPathScanner *scanner); private: void computeIntersections();
