[poppler] poppler/CairoOutputDev.cc poppler/CairoOutputDev.h poppler/Gfx.cc poppler/GfxState.cc poppler/GfxState.h poppler/PSOutputDev.cc poppler/PSOutputDev.h poppler/SplashOutputDev.cc poppler/SplashOutputDev.h poppler/TextOutputDev.cc qt5/src

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Nov 23 07:25:00 UTC 2019


 poppler/CairoOutputDev.cc  |    7 +-
 poppler/CairoOutputDev.h   |    4 -
 poppler/Gfx.cc             |    6 +-
 poppler/GfxState.cc        |   42 +++++++-------
 poppler/GfxState.h         |  129 ++++++++++++++++++++++-----------------------
 poppler/PSOutputDev.cc     |   12 +---
 poppler/PSOutputDev.h      |    2 
 poppler/SplashOutputDev.cc |    5 -
 poppler/SplashOutputDev.h  |    2 
 poppler/TextOutputDev.cc   |   12 +---
 qt5/src/ArthurOutputDev.cc |    5 -
 11 files changed, 109 insertions(+), 117 deletions(-)

New commits:
commit 064bbe4be40300739ce8352658e4883534442128
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sat Nov 23 08:13:21 2019 +0100

    Add some const to GfxState & friends

diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index cbfd0bdd..28f3ae6b 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -712,7 +712,7 @@ void CairoOutputDev::updateFont(GfxState *state) {
 
 /* Align stroke coordinate i if the point is the start or end of a
  * horizontal or vertical line */
-void CairoOutputDev::alignStrokeCoords(GfxSubpath *subpath, int i, double *x, double *y)
+void CairoOutputDev::alignStrokeCoords(const GfxSubpath *subpath, int i, double *x, double *y)
 {
   double x1, y1, x2, y2;
   bool align = false;
@@ -752,13 +752,12 @@ void CairoOutputDev::alignStrokeCoords(GfxSubpath *subpath, int i, double *x, do
 
 #undef STROKE_COORD_TOLERANCE
 
-void CairoOutputDev::doPath(cairo_t *c, GfxState *state, GfxPath *path) {
-  GfxSubpath *subpath;
+void CairoOutputDev::doPath(cairo_t *c, GfxState *state, const GfxPath *path) {
   int i, j;
   double x, y;
   cairo_new_path (c);
   for (i = 0; i < path->getNumSubpaths(); ++i) {
-    subpath = path->getSubpath(i);
+    const GfxSubpath *subpath = path->getSubpath(i);
     if (subpath->getNumPoints() > 0) {
       if (align_stroke_coords) {
         alignStrokeCoords(subpath, 0, &x, &y);
diff --git a/poppler/CairoOutputDev.h b/poppler/CairoOutputDev.h
index 4bef6df7..9e6f497c 100644
--- a/poppler/CairoOutputDev.h
+++ b/poppler/CairoOutputDev.h
@@ -274,7 +274,7 @@ public:
   double *getType3GlyphBBox () { return t3_glyph_bbox; }
 
 protected:
-  void doPath(cairo_t *cairo, GfxState *state, GfxPath *path);
+  void doPath(cairo_t *cairo, GfxState *state, const GfxPath *path);
   cairo_surface_t *downscaleSurface(cairo_surface_t *orig_surface);
   void getScaledSize(const cairo_matrix_t *matrix,
                      int orig_width, int orig_height,
@@ -285,7 +285,7 @@ protected:
   void setMimeData(GfxState *state, Stream *str, Object *ref,
 		   GfxImageColorMap *colorMap, cairo_surface_t *image, int height);
   void fillToStrokePathClip(GfxState *state);
-  void alignStrokeCoords(GfxSubpath *subpath, int i, double *x, double *y);
+  void alignStrokeCoords(const GfxSubpath *subpath, int i, double *x, double *y);
 #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0)
   bool setMimeDataForJBIG2Globals (Stream *str, cairo_surface_t *image);
 #endif
diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index c5d47443..e8da5038 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -4350,9 +4350,9 @@ void Gfx::doImage(Object *ref, Stream *str, bool inlineImg) {
       char *tempIntent = nullptr;
       Object objIntent = dict->lookup("Intent");
       if (objIntent.isName()) {
-        tempIntent = state->getRenderingIntent();
-        if (tempIntent != nullptr) {
-          tempIntent = strdup(tempIntent);
+        const char *stateIntent = state->getRenderingIntent();
+        if (stateIntent != nullptr) {
+          tempIntent = strdup(stateIntent);
         }
         state->setRenderingIntent(objIntent.getName());
       }
diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index b7347d35..c2851d32 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -437,7 +437,7 @@ void GfxColorSpace::createMapping(std::vector<GfxSeparationColorSpace*> *separat
 }
 
 void GfxColorSpace::getDefaultRanges(double *decodeLow, double *decodeRange,
-				     int maxImgPixel) {
+				     int maxImgPixel) const {
   int i;
 
   for (i = 0; i < getNComps(); ++i) {
@@ -733,7 +733,7 @@ void GfxDeviceGrayColorSpace::getDeviceN(const GfxColor *color, GfxColor *device
   deviceN->c[3] = clip01(gfxColorComp1 - color->c[0]);
 }
 
-void GfxDeviceGrayColorSpace::getDefaultColor(GfxColor *color) {
+void GfxDeviceGrayColorSpace::getDefaultColor(GfxColor *color) const {
   color->c[0] = 0;
 }
 
@@ -943,7 +943,7 @@ void GfxCalGrayColorSpace::getDeviceN(const GfxColor *color, GfxColor *deviceN)
   deviceN->c[3] = cmyk.k;
 }
 
-void GfxCalGrayColorSpace::getDefaultColor(GfxColor *color) {
+void GfxCalGrayColorSpace::getDefaultColor(GfxColor *color) const {
   color->c[0] = 0;
 }
 
@@ -1085,7 +1085,7 @@ void GfxDeviceRGBColorSpace::getDeviceN(const GfxColor *color, GfxColor *deviceN
   deviceN->c[3] = cmyk.k;
 }
 
-void GfxDeviceRGBColorSpace::getDefaultColor(GfxColor *color) {
+void GfxDeviceRGBColorSpace::getDefaultColor(GfxColor *color) const {
   color->c[0] = 0;
   color->c[1] = 0;
   color->c[2] = 0;
@@ -1310,7 +1310,7 @@ void GfxCalRGBColorSpace::getDeviceN(const GfxColor *color, GfxColor *deviceN) c
   deviceN->c[3] = cmyk.k;
 }
 
-void GfxCalRGBColorSpace::getDefaultColor(GfxColor *color) {
+void GfxCalRGBColorSpace::getDefaultColor(GfxColor *color) const {
   color->c[0] = 0;
   color->c[1] = 0;
   color->c[2] = 0;
@@ -1442,7 +1442,7 @@ void GfxDeviceCMYKColorSpace::getDeviceN(const GfxColor *color, GfxColor *device
   deviceN->c[3] = clip01(color->c[3]);
 }
 
-void GfxDeviceCMYKColorSpace::getDefaultColor(GfxColor *color) {
+void GfxDeviceCMYKColorSpace::getDefaultColor(GfxColor *color) const {
   color->c[0] = 0;
   color->c[1] = 0;
   color->c[2] = 0;
@@ -1698,7 +1698,7 @@ void GfxLabColorSpace::getDeviceN(const GfxColor *color, GfxColor *deviceN) cons
   deviceN->c[3] = cmyk.k;
 }
 
-void GfxLabColorSpace::getDefaultColor(GfxColor *color) {
+void GfxLabColorSpace::getDefaultColor(GfxColor *color) const {
   color->c[0] = 0;
   if (aMin > 0) {
     color->c[1] = dblToCol(aMin);
@@ -1717,7 +1717,7 @@ void GfxLabColorSpace::getDefaultColor(GfxColor *color) {
 }
 
 void GfxLabColorSpace::getDefaultRanges(double *decodeLow, double *decodeRange,
-					int maxImgPixel) {
+					int maxImgPixel) const {
   decodeLow[0] = 0;
   decodeRange[0] = 100;
   decodeLow[1] = aMin;
@@ -2342,7 +2342,7 @@ void GfxICCBasedColorSpace::getDeviceN(const GfxColor *color, GfxColor *deviceN)
   deviceN->c[3] = cmyk.k;
 }
 
-void GfxICCBasedColorSpace::getDefaultColor(GfxColor *color) {
+void GfxICCBasedColorSpace::getDefaultColor(GfxColor *color) const {
   int i;
 
   for (i = 0; i < nComps; ++i) {
@@ -2358,7 +2358,7 @@ void GfxICCBasedColorSpace::getDefaultColor(GfxColor *color) {
 
 void GfxICCBasedColorSpace::getDefaultRanges(double *decodeLow,
 					     double *decodeRange,
-					     int maxImgPixel) {
+					     int maxImgPixel) const {
   alt->getDefaultRanges(decodeLow, decodeRange, maxImgPixel);
 
 #if 0
@@ -2591,13 +2591,13 @@ void GfxIndexedColorSpace::getDeviceN(const GfxColor *color, GfxColor *deviceN)
   base->getDeviceN(mapColorToBase(color, &color2), deviceN);
 }
 
-void GfxIndexedColorSpace::getDefaultColor(GfxColor *color) {
+void GfxIndexedColorSpace::getDefaultColor(GfxColor *color) const {
   color->c[0] = 0;
 }
 
 void GfxIndexedColorSpace::getDefaultRanges(double *decodeLow,
 					    double *decodeRange,
-					    int maxImgPixel) {
+					    int maxImgPixel) const {
   decodeLow[0] = 0;
   decodeRange[0] = maxImgPixel;
 }
@@ -2798,7 +2798,7 @@ void GfxSeparationColorSpace::getDeviceN(const GfxColor *color, GfxColor *device
   }
 }
 
-void GfxSeparationColorSpace::getDefaultColor(GfxColor *color) {
+void GfxSeparationColorSpace::getDefaultColor(GfxColor *color) const {
   color->c[0] = gfxColorComp1;
 }
 
@@ -3079,7 +3079,7 @@ void GfxDeviceNColorSpace::getDeviceN(const GfxColor *color, GfxColor *deviceN)
   }
 }
 
-void GfxDeviceNColorSpace::getDefaultColor(GfxColor *color) {
+void GfxDeviceNColorSpace::getDefaultColor(GfxColor *color) const {
   int i;
 
   for (i = 0; i < nComps; ++i) {
@@ -3235,7 +3235,7 @@ void GfxPatternColorSpace::getDeviceN(const GfxColor *color, GfxColor *deviceN)
   deviceN->c[3] = 1;
 }
 
-void GfxPatternColorSpace::getDefaultColor(GfxColor *color) {
+void GfxPatternColorSpace::getDefaultColor(GfxColor *color) const {
   color->c[0]=0;
 }
 
@@ -4053,7 +4053,7 @@ GfxShading *GfxAxialShading::copy() {
   return new GfxAxialShading(this);
 }
 
-double GfxAxialShading::getDistance(double sMin, double sMax) {
+double GfxAxialShading::getDistance(double sMin, double sMax) const {
   double xMin, yMin, xMax, yMax;
 
   xMin = x0 + sMin * (x1 - x0);
@@ -4232,7 +4232,7 @@ GfxShading *GfxRadialShading::copy() {
   return new GfxRadialShading(this);
 }
 
-double GfxRadialShading::getDistance(double sMin, double sMax) {
+double GfxRadialShading::getDistance(double sMin, double sMax) const {
   double xMin, yMin, rMin, xMax, yMax, rMax;
 
   xMin = x0 + sMin * (x1 - x0);
@@ -6701,7 +6701,7 @@ void GfxState::setPath(GfxPath *pathA) {
 }
 
 void GfxState::getUserClipBBox(double *xMin, double *yMin,
-			       double *xMax, double *yMax) {
+			       double *xMax, double *yMax) const {
   double ictm[6];
   double xMin1, yMin1, xMax1, yMax1, tx, ty;
 
@@ -6769,7 +6769,7 @@ void GfxState::getUserClipBBox(double *xMin, double *yMin,
   *yMax = yMax1;
 }
 
-double GfxState::transformWidth(double w) {
+double GfxState::transformWidth(double w) const {
   double x, y;
 
   x = ctm[0] + ctm[2];
@@ -6777,7 +6777,7 @@ double GfxState::transformWidth(double w) {
   return w * sqrt(0.5 * (x * x + y * y));
 }
 
-double GfxState::getTransformedFontSize() {
+double GfxState::getTransformedFontSize() const {
   double x1, y1, x2, y2;
 
   x1 = textMat[2] * fontSize;
@@ -6788,7 +6788,7 @@ double GfxState::getTransformedFontSize() {
 }
 
 void GfxState::getFontTransMat(double *m11, double *m12,
-			       double *m21, double *m22) {
+			       double *m21, double *m22) const {
   *m11 = (textMat[0] * ctm[0] + textMat[1] * ctm[2]) * fontSize;
   *m12 = (textMat[0] * ctm[1] + textMat[1] * ctm[3]) * fontSize;
   *m21 = (textMat[2] * ctm[0] + textMat[3] * ctm[2]) * fontSize;
diff --git a/poppler/GfxState.h b/poppler/GfxState.h
index 7a6e4031..733e7e62 100644
--- a/poppler/GfxState.h
+++ b/poppler/GfxState.h
@@ -217,7 +217,7 @@ public:
   GfxColorSpace& operator=(const GfxColorSpace &other) = delete;
 
   virtual GfxColorSpace *copy() = 0;
-  virtual GfxColorSpaceMode getMode() = 0;
+  virtual GfxColorSpaceMode getMode() const = 0;
 
   // Construct a color space.  Returns nullptr if unsuccessful.
   static GfxColorSpace *parse(GfxResources *res, Object *csObj, OutputDev *out, GfxState *state, int recursion = 0);
@@ -250,12 +250,12 @@ public:
   virtual int getNComps() const = 0;
 
   // Get this color space's default color.
-  virtual void getDefaultColor(GfxColor *color) = 0;
+  virtual void getDefaultColor(GfxColor *color) const = 0;
 
   // Return the default ranges for each component, assuming an image
   // with a max pixel value of <maxImgPixel>.
   virtual void getDefaultRanges(double *decodeLow, double *decodeRange,
-				int maxImgPixel);
+				int maxImgPixel) const;
 
   // Returns true if painting operations in this color space never
   // mark the page (e.g., the "None" colorant).
@@ -296,7 +296,7 @@ public:
   GfxDeviceGrayColorSpace();
   ~GfxDeviceGrayColorSpace();
   GfxColorSpace *copy() override;
-  GfxColorSpaceMode getMode() override { return csDeviceGray; }
+  GfxColorSpaceMode getMode() const override { return csDeviceGray; }
 
   void getGray(const GfxColor *color, GfxGray *gray) const override;
   void getRGB(const GfxColor *color, GfxRGB *rgb) const override;
@@ -315,7 +315,7 @@ public:
   bool useGetDeviceNLine() const override { return true; }
 
   int getNComps() const override { return 1; }
-  void getDefaultColor(GfxColor *color) override;
+  void getDefaultColor(GfxColor *color) const override;
 
 private:
 };
@@ -330,7 +330,7 @@ public:
   GfxCalGrayColorSpace();
   ~GfxCalGrayColorSpace();
   GfxColorSpace *copy() override;
-  GfxColorSpaceMode getMode() override { return csCalGray; }
+  GfxColorSpaceMode getMode() const override { return csCalGray; }
 
   // Construct a CalGray color space.  Returns nullptr if unsuccessful.
   static GfxColorSpace *parse(Array *arr, GfxState *state);
@@ -341,16 +341,16 @@ public:
   void getDeviceN(const GfxColor *color, GfxColor *deviceN) const override;
 
   int getNComps() const override { return 1; }
-  void getDefaultColor(GfxColor *color) override;
+  void getDefaultColor(GfxColor *color) const override;
 
   // CalGray-specific access.
-  double getWhiteX() { return whiteX; }
-  double getWhiteY() { return whiteY; }
-  double getWhiteZ() { return whiteZ; }
-  double getBlackX() { return blackX; }
-  double getBlackY() { return blackY; }
-  double getBlackZ() { return blackZ; }
-  double getGamma() { return gamma; }
+  double getWhiteX() const { return whiteX; }
+  double getWhiteY() const { return whiteY; }
+  double getWhiteZ() const { return whiteZ; }
+  double getBlackX() const { return blackX; }
+  double getBlackY() const { return blackY; }
+  double getBlackZ() const { return blackZ; }
+  double getGamma() const { return gamma; }
 
 private:
 
@@ -374,7 +374,7 @@ public:
   GfxDeviceRGBColorSpace();
   ~GfxDeviceRGBColorSpace();
   GfxColorSpace *copy() override;
-  GfxColorSpaceMode getMode() override { return csDeviceRGB; }
+  GfxColorSpaceMode getMode() const override { return csDeviceRGB; }
 
   void getGray(const GfxColor *color, GfxGray *gray) const override;
   void getRGB(const GfxColor *color, GfxRGB *rgb) const override;
@@ -393,7 +393,7 @@ public:
   bool useGetDeviceNLine() const override { return true; }
 
   int getNComps() const override { return 3; }
-  void getDefaultColor(GfxColor *color) override;
+  void getDefaultColor(GfxColor *color) const override;
 
 private:
 };
@@ -408,7 +408,7 @@ public:
   GfxCalRGBColorSpace();
   ~GfxCalRGBColorSpace();
   GfxColorSpace *copy() override;
-  GfxColorSpaceMode getMode() override { return csCalRGB; }
+  GfxColorSpaceMode getMode() const override { return csCalRGB; }
 
   // Construct a CalRGB color space.  Returns nullptr if unsuccessful.
   static GfxColorSpace *parse(Array *arr, GfxState *state);
@@ -419,7 +419,7 @@ public:
   void getDeviceN(const GfxColor *color, GfxColor *deviceN) const override;
 
   int getNComps() const override { return 3; }
-  void getDefaultColor(GfxColor *color) override;
+  void getDefaultColor(GfxColor *color) const override;
 
   // CalRGB-specific access.
   double getWhiteX() const { return whiteX; }
@@ -456,7 +456,7 @@ public:
   GfxDeviceCMYKColorSpace();
   ~GfxDeviceCMYKColorSpace();
   GfxColorSpace *copy() override;
-  GfxColorSpaceMode getMode() override { return csDeviceCMYK; }
+  GfxColorSpaceMode getMode() const override { return csDeviceCMYK; }
 
   void getGray(const GfxColor *color, GfxGray *gray) const override;
   void getRGB(const GfxColor *color, GfxRGB *rgb) const override;
@@ -472,7 +472,7 @@ public:
   bool useGetDeviceNLine() const override { return true; }
 
   int getNComps() const override { return 4; }
-  void getDefaultColor(GfxColor *color) override;
+  void getDefaultColor(GfxColor *color) const override;
 
 private:
 };
@@ -487,7 +487,7 @@ public:
   GfxLabColorSpace();
   ~GfxLabColorSpace();
   GfxColorSpace *copy() override;
-  GfxColorSpaceMode getMode() override { return csLab; }
+  GfxColorSpaceMode getMode() const override { return csLab; }
 
   // Construct a Lab color space.  Returns nullptr if unsuccessful.
   static GfxColorSpace *parse(Array *arr, GfxState *state);
@@ -498,22 +498,22 @@ public:
   void getDeviceN(const GfxColor *color, GfxColor *deviceN) const override;
 
   int getNComps() const override { return 3; }
-  void getDefaultColor(GfxColor *color) override;
+  void getDefaultColor(GfxColor *color) const override;
 
   void getDefaultRanges(double *decodeLow, double *decodeRange,
-				int maxImgPixel) override;
+				int maxImgPixel) const override;
 
   // Lab-specific access.
-  double getWhiteX() { return whiteX; }
-  double getWhiteY() { return whiteY; }
-  double getWhiteZ() { return whiteZ; }
-  double getBlackX() { return blackX; }
-  double getBlackY() { return blackY; }
-  double getBlackZ() { return blackZ; }
-  double getAMin() { return aMin; }
-  double getAMax() { return aMax; }
-  double getBMin() { return bMin; }
-  double getBMax() { return bMax; }
+  double getWhiteX() const { return whiteX; }
+  double getWhiteY() const { return whiteY; }
+  double getWhiteZ() const { return whiteZ; }
+  double getBlackX() const { return blackX; }
+  double getBlackY() const { return blackY; }
+  double getBlackZ() const { return blackZ; }
+  double getAMin() const { return aMin; }
+  double getAMax() const { return aMax; }
+  double getBMin() const { return bMin; }
+  double getBMax() const { return bMax; }
 
 private:
 
@@ -537,7 +537,7 @@ public:
   GfxICCBasedColorSpace(int nCompsA, GfxColorSpace *altA);
   ~GfxICCBasedColorSpace();
   GfxColorSpace *copy() override;
-  GfxColorSpaceMode getMode() override { return csICCBased; }
+  GfxColorSpaceMode getMode() const override { return csICCBased; }
 
   // Construct an ICCBased color space.  Returns nullptr if unsuccessful.
   static GfxColorSpace *parse(Array *arr, OutputDev *out, GfxState *state, int recursion);
@@ -557,10 +557,10 @@ public:
   bool useGetDeviceNLine() const override;
 
   int getNComps() const override { return nComps; }
-  void getDefaultColor(GfxColor *color) override;
+  void getDefaultColor(GfxColor *color) const override;
 
   void getDefaultRanges(double *decodeLow, double *decodeRange,
-				int maxImgPixel) override;
+				int maxImgPixel) const override;
 
   // ICCBased-specific access.
   GfxColorSpace *getAlt() { return alt; }
@@ -588,7 +588,7 @@ public:
   GfxIndexedColorSpace(GfxColorSpace *baseA, int indexHighA);
   ~GfxIndexedColorSpace();
   GfxColorSpace *copy() override;
-  GfxColorSpaceMode getMode() override { return csIndexed; }
+  GfxColorSpaceMode getMode() const override { return csIndexed; }
 
   // Construct an Indexed color space.  Returns nullptr if unsuccessful.
   static GfxColorSpace *parse(GfxResources *res, Array *arr, OutputDev *out, GfxState *state, int recursion);
@@ -608,17 +608,17 @@ public:
   bool useGetDeviceNLine() const override { return true; }
 
   int getNComps() const override { return 1; }
-  void getDefaultColor(GfxColor *color) override;
+  void getDefaultColor(GfxColor *color) const override;
 
   void getDefaultRanges(double *decodeLow, double *decodeRange,
-				int maxImgPixel) override;
+				int maxImgPixel) const override;
 
   // Indexed-specific access.
   GfxColorSpace *getBase() { return base; }
-  int getIndexHigh() { return indexHigh; }
+  int getIndexHigh() const { return indexHigh; }
   unsigned char *getLookup() { return lookup; }
   GfxColor *mapColorToBase(const GfxColor *color, GfxColor *baseColor) const;
-  unsigned int getOverprintMask() { return base->getOverprintMask(); }
+  unsigned int getOverprintMask() const { return base->getOverprintMask(); }
   void createMapping(std::vector<GfxSeparationColorSpace*> *separationList, int maxSepComps) override
     { base->createMapping(separationList, maxSepComps); }
 
@@ -641,7 +641,7 @@ public:
 			  Function *funcA);
   ~GfxSeparationColorSpace();
   GfxColorSpace *copy() override;
-  GfxColorSpaceMode getMode() override { return csSeparation; }
+  GfxColorSpaceMode getMode() const override { return csSeparation; }
 
   // Construct a Separation color space.  Returns nullptr if unsuccessful.
   static GfxColorSpace *parse(GfxResources *res, Array *arr, OutputDev *out, GfxState *state, int recursion);
@@ -654,12 +654,12 @@ public:
   void createMapping(std::vector<GfxSeparationColorSpace*> *separationList, int maxSepComps) override;
 
   int getNComps() const override { return 1; }
-  void getDefaultColor(GfxColor *color) override;
+  void getDefaultColor(GfxColor *color) const override;
 
   bool isNonMarking() const override { return nonMarking; }
 
   // Separation-specific access.
-  GooString *getName() { return name; }
+  const GooString *getName() const { return name; }
   GfxColorSpace *getAlt() { return alt; }
   const Function *getFunc() const { return func; }
 
@@ -686,7 +686,7 @@ public:
 		       GfxColorSpace *alt, Function *func, std::vector<GfxSeparationColorSpace*> *sepsCS);
   ~GfxDeviceNColorSpace();
   GfxColorSpace *copy() override;
-  GfxColorSpaceMode getMode() override { return csDeviceN; }
+  GfxColorSpaceMode getMode() const override { return csDeviceN; }
 
   // Construct a DeviceN color space.  Returns nullptr if unsuccessful.
   static GfxColorSpace *parse(GfxResources *res, Array *arr, OutputDev *out, GfxState *state, int recursion);
@@ -699,14 +699,14 @@ public:
   void createMapping(std::vector<GfxSeparationColorSpace*> *separationList, int maxSepComps) override;
 
   int getNComps() const override { return nComps; }
-  void getDefaultColor(GfxColor *color) override;
+  void getDefaultColor(GfxColor *color) const override;
 
   bool isNonMarking() const override { return nonMarking; }
 
   // DeviceN-specific access.
   const std::string &getColorantName(int i) const { return names[i]; }
   GfxColorSpace *getAlt() { return alt; }
-  Function *getTintTransformFunc() { return func; }
+  const Function *getTintTransformFunc() const { return func; }
 
 private:
 
@@ -732,7 +732,7 @@ public:
   GfxPatternColorSpace(GfxColorSpace *underA);
   ~GfxPatternColorSpace();
   GfxColorSpace *copy() override;
-  GfxColorSpaceMode getMode() override { return csPattern; }
+  GfxColorSpaceMode getMode() const override { return csPattern; }
 
   // Construct a Pattern color space.  Returns nullptr if unsuccessful.
   static GfxColorSpace *parse(GfxResources *res, Array *arr, OutputDev *out, GfxState *state, int recursion);
@@ -743,7 +743,7 @@ public:
   void getDeviceN(const GfxColor *color, GfxColor *deviceN) const override;
 
   int getNComps() const override { return 0; }
-  void getDefaultColor(GfxColor *color) override;
+  void getDefaultColor(GfxColor *color) const override;
 
   // Pattern-specific access.
   GfxColorSpace *getUnder() { return under; }
@@ -919,7 +919,7 @@ public:
 				 double xMin, double yMin,
 				 double xMax, double yMax) = 0;
 
-  virtual double getDistance(double tMin, double tMax) = 0;
+  virtual double getDistance(double tMin, double tMax) const = 0;
 
 private:
 
@@ -993,7 +993,7 @@ public:
 				 double xMin, double yMin,
 				 double xMax, double yMax) override;
 
-  double getDistance(double tMin, double tMax) override;
+  double getDistance(double tMin, double tMax) const override;
 
 private:
 
@@ -1027,7 +1027,7 @@ public:
 				 double xMin, double yMin,
 				 double xMax, double yMax) override;
 
-  double getDistance(double tMin, double tMax) override;
+  double getDistance(double tMin, double tMax) const override;
 
 private:
 
@@ -1327,6 +1327,7 @@ public:
   // Get subpaths.
   int getNumSubpaths() const { return n; }
   GfxSubpath *getSubpath(int i) { return subpaths[i]; }
+  const GfxSubpath *getSubpath(int i) const { return subpaths[i]; }
 
   // Get last point on last subpath.
   double getLastX() const { return subpaths[n-1]->getLastX(); }
@@ -1501,14 +1502,14 @@ public:
   double getLeading() const { return leading; }
   double getRise() const { return rise; }
   int getRender() const { return render; }
-  char *getRenderingIntent() { return renderingIntent; }
-  GfxPath *getPath() { return path; }
+  const char *getRenderingIntent() const { return renderingIntent; }
+  const GfxPath *getPath() const { return path; }
   void setPath(GfxPath *pathA);
   double getCurX() const { return curX; }
   double getCurY() const { return curY; }
-  void getClipBBox(double *xMin, double *yMin, double *xMax, double *yMax)
+  void getClipBBox(double *xMin, double *yMin, double *xMax, double *yMax) const
     { *xMin = clipXMin; *yMin = clipYMin; *xMax = clipXMax; *yMax = clipYMax; }
-  void getUserClipBBox(double *xMin, double *yMin, double *xMax, double *yMax);
+  void getUserClipBBox(double *xMin, double *yMin, double *xMax, double *yMax) const;
   double getLineX() const { return lineX; }
   double getLineY() const { return lineY; }
 
@@ -1517,23 +1518,23 @@ public:
   bool isPath() const { return path->isPath(); }
 
   // Transforms.
-  void transform(double x1, double y1, double *x2, double *y2)
+  void transform(double x1, double y1, double *x2, double *y2) const
     { *x2 = ctm[0] * x1 + ctm[2] * y1 + ctm[4];
       *y2 = ctm[1] * x1 + ctm[3] * y1 + ctm[5]; }
-  void transformDelta(double x1, double y1, double *x2, double *y2)
+  void transformDelta(double x1, double y1, double *x2, double *y2) const
     { *x2 = ctm[0] * x1 + ctm[2] * y1;
       *y2 = ctm[1] * x1 + ctm[3] * y1; }
-  void textTransform(double x1, double y1, double *x2, double *y2)
+  void textTransform(double x1, double y1, double *x2, double *y2) const
     { *x2 = textMat[0] * x1 + textMat[2] * y1 + textMat[4];
       *y2 = textMat[1] * x1 + textMat[3] * y1 + textMat[5]; }
-  void textTransformDelta(double x1, double y1, double *x2, double *y2)
+  void textTransformDelta(double x1, double y1, double *x2, double *y2) const
     { *x2 = textMat[0] * x1 + textMat[2] * y1;
       *y2 = textMat[1] * x1 + textMat[3] * y1; }
-  double transformWidth(double w);
-  double getTransformedLineWidth()
+  double transformWidth(double w) const;
+  double getTransformedLineWidth() const
     { return transformWidth(lineWidth); }
-  double getTransformedFontSize();
-  void getFontTransMat(double *m11, double *m12, double *m21, double *m22);
+  double getTransformedFontSize() const;
+  void getFontTransMat(double *m11, double *m12, double *m21, double *m22) const;
 
   // Change state parameters.
   void setCTM(double a, double b, double c,
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 04418a4b..2de5454d 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1006,7 +1006,7 @@ private:
 
   int width, height;
   GfxImageColorMap *colorMap;
-  Function *func;
+  const Function *func;
   ImageStream *imgStr;
   int buf[gfxColorMaxComps];
   int pixelIdx;
@@ -4977,15 +4977,14 @@ void PSOutputDev::clipToStrokePath(GfxState *state) {
   writePS("Ws\n");
 }
 
-void PSOutputDev::doPath(GfxPath *path) {
-  GfxSubpath *subpath;
+void PSOutputDev::doPath(const GfxPath *path) {
   double x0, y0, x1, y1, x2, y2, x3, y3, x4, y4;
   int n, m, i, j;
 
   n = path->getNumSubpaths();
 
   if (n == 1 && path->getSubpath(0)->getNumPoints() == 5) {
-    subpath = path->getSubpath(0);
+    const GfxSubpath *subpath = path->getSubpath(0);
     x0 = subpath->getX(0);
     y0 = subpath->getY(0);
     x4 = subpath->getX(4);
@@ -5012,7 +5011,7 @@ void PSOutputDev::doPath(GfxPath *path) {
   }
 
   for (i = 0; i < n; ++i) {
-    subpath = path->getSubpath(i);
+    const GfxSubpath *subpath = path->getSubpath(i);
     m = subpath->getNumPoints();
     writePSFmt("{0:.6g} {1:.6g} m\n", subpath->getX(0), subpath->getY(0));
     j = 1;
@@ -6602,7 +6601,6 @@ void PSOutputDev::dumpColorSpaceL2(GfxColorSpace *colorSpace,
   double low[gfxColorMaxComps], range[gfxColorMaxComps];
   GfxColor color;
   GfxCMYK cmyk;
-  Function *func;
   int n, numComps, numAltComps;
   int byte;
   int i, j, k;
@@ -6745,7 +6743,7 @@ void PSOutputDev::dumpColorSpaceL2(GfxColorSpace *colorSpace,
     lookup = indexedCS->getLookup();
     writePSFmt(" {0:d} <\n", n);
     if (baseCS->getMode() == csDeviceN && level != psLevel3 && level != psLevel3Sep) {
-      func = ((GfxDeviceNColorSpace *)baseCS)->getTintTransformFunc();
+      const Function *func = ((GfxDeviceNColorSpace *)baseCS)->getTintTransformFunc();
       baseCS->getDefaultRanges(low, range, indexedCS->getIndexHigh());
       if (((GfxDeviceNColorSpace *)baseCS)->getAlt()->getMode() == csLab) {
 	labCS = (GfxLabColorSpace *)((GfxDeviceNColorSpace *)baseCS)->getAlt();
diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h
index 7e6d1703..c84478e1 100644
--- a/poppler/PSOutputDev.h
+++ b/poppler/PSOutputDev.h
@@ -383,7 +383,7 @@ private:
   void setupForm(Ref id, Object *strObj);
   void addProcessColor(double c, double m, double y, double k);
   void addCustomColor(GfxSeparationColorSpace *sepCS);
-  void doPath(GfxPath *path);
+  void doPath(const GfxPath *path);
   void maskToClippingPath(Stream *maskStr, int maskWidth, int maskHeight, bool maskInvert);
   void doImageL1(Object *ref, GfxImageColorMap *colorMap,
 		 bool invert, bool inlineImg,
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index 140be47a..f9d27a53 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -2192,15 +2192,14 @@ void SplashOutputDev::clipToStrokePath(GfxState *state) {
   delete path2;
 }
 
-SplashPath SplashOutputDev::convertPath(GfxState *state, GfxPath *path,
+SplashPath SplashOutputDev::convertPath(GfxState *state, const GfxPath *path,
 					 bool dropEmptySubpaths) {
   SplashPath sPath;
-  GfxSubpath *subpath;
   int n, i, j;
 
   n = dropEmptySubpaths ? 1 : 0;
   for (i = 0; i < path->getNumSubpaths(); ++i) {
-    subpath = path->getSubpath(i);
+    const GfxSubpath *subpath = path->getSubpath(i);
     if (subpath->getNumPoints() > n) {
       sPath.reserve(subpath->getNumPoints() + 1);
       sPath.moveTo((SplashCoord)subpath->getX(0),
diff --git a/poppler/SplashOutputDev.h b/poppler/SplashOutputDev.h
index fc2d787f..dfd0cdbf 100644
--- a/poppler/SplashOutputDev.h
+++ b/poppler/SplashOutputDev.h
@@ -404,7 +404,7 @@ private:
   static void getMatteColor( SplashColorMode colorMode, GfxImageColorMap *colorMap, const GfxColor * matteColor, SplashColor splashMatteColor);
   void setOverprintMask(GfxColorSpace *colorSpace, bool overprintFlag,
 			int overprintMode, const GfxColor *singleColor, bool grayIndexed = false);
-  SplashPath convertPath(GfxState *state, GfxPath *path,
+  SplashPath convertPath(GfxState *state, const GfxPath *path,
 			  bool dropEmptySubpaths);
   void drawType3Glyph(GfxState *state, T3FontCache *t3Font,
 		      T3FontCacheTag *tag, unsigned char *data);
diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
index 719ee194..61781cdc 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -5783,18 +5783,16 @@ void TextOutputDev::endActualText(GfxState *state)
 }
 
 void TextOutputDev::stroke(GfxState *state) {
-  GfxPath *path;
-  GfxSubpath *subpath;
   double x[2], y[2];
 
   if (!doHTML) {
     return;
   }
-  path = state->getPath();
+  const GfxPath *path = state->getPath();
   if (path->getNumSubpaths() != 1) {
     return;
   }
-  subpath = path->getSubpath(0);
+  const GfxSubpath *subpath = path->getSubpath(0);
   if (subpath->getNumPoints() != 2) {
     return;
   }
@@ -5808,8 +5806,6 @@ void TextOutputDev::stroke(GfxState *state) {
 }
 
 void TextOutputDev::fill(GfxState *state) {
-  GfxPath *path;
-  GfxSubpath *subpath;
   double x[5], y[5];
   double rx0, ry0, rx1, ry1, t;
   int i;
@@ -5817,11 +5813,11 @@ void TextOutputDev::fill(GfxState *state) {
   if (!doHTML) {
     return;
   }
-  path = state->getPath();
+  const GfxPath *path = state->getPath();
   if (path->getNumSubpaths() != 1) {
     return;
   }
-  subpath = path->getSubpath(0);
+  const GfxSubpath *subpath = path->getSubpath(0);
   if (subpath->getNumPoints() != 5) {
     return;
   }
diff --git a/qt5/src/ArthurOutputDev.cc b/qt5/src/ArthurOutputDev.cc
index 002b15a5..1dee1794 100644
--- a/qt5/src/ArthurOutputDev.cc
+++ b/qt5/src/ArthurOutputDev.cc
@@ -698,15 +698,14 @@ void ArthurOutputDev::updateFont(GfxState *state)
   }
 }
 
-static QPainterPath convertPath(GfxState *state, GfxPath *path, Qt::FillRule fillRule)
+static QPainterPath convertPath(GfxState *state, const GfxPath *path, Qt::FillRule fillRule)
 {
-  GfxSubpath *subpath;
   int i, j;
 
   QPainterPath qPath;
   qPath.setFillRule(fillRule);
   for (i = 0; i < path->getNumSubpaths(); ++i) {
-    subpath = path->getSubpath(i);
+    const GfxSubpath *subpath = path->getSubpath(i);
     if (subpath->getNumPoints() > 0) {
       qPath.moveTo(subpath->getX(0), subpath->getY(0));
       j = 1;


More information about the poppler mailing list