[poppler] cpp/poppler-page.cpp glib/poppler-page.cc poppler/CairoOutputDev.cc poppler/CairoOutputDev.h poppler/Function.cc poppler/Function.h poppler/Gfx.cc poppler/Gfx.h poppler/GfxState.cc poppler/GfxState.h poppler/MarkedContentOutputDev.cc poppler/MarkedContentOutputDev.h poppler/OutputDev.cc poppler/OutputDev.h poppler/Page.cc poppler/Page.h poppler/PDFDoc.cc poppler/PDFDoc.h poppler/PreScanOutputDev.cc poppler/PreScanOutputDev.h poppler/PSOutputDev.cc poppler/PSOutputDev.h poppler/SplashOutputDev.cc poppler/SplashOutputDev.h poppler/TextOutputDev.cc poppler/TextOutputDev.h poppler/UnicodeMap.cc poppler/UnicodeMap.h qt5/src utils/HtmlOutputDev.cc utils/ImageOutputDev.cc utils/ImageOutputDev.h utils/pdfinfo.cc utils/pdfunite.cc
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun Sep 23 23:14:01 UTC 2018
cpp/poppler-page.cpp | 10
glib/poppler-page.cc | 2
poppler/CairoOutputDev.cc | 24 +-
poppler/CairoOutputDev.h | 24 +-
poppler/Function.cc | 16 -
poppler/Function.h | 108 ++++-----
poppler/Gfx.cc | 20 -
poppler/Gfx.h | 10
poppler/GfxState.cc | 126 +++++------
poppler/GfxState.h | 412 +++++++++++++++++++-------------------
poppler/MarkedContentOutputDev.cc | 2
poppler/MarkedContentOutputDev.h | 2
poppler/OutputDev.cc | 2
poppler/OutputDev.h | 16 -
poppler/PDFDoc.cc | 6
poppler/PDFDoc.h | 2
poppler/PSOutputDev.cc | 45 +---
poppler/PSOutputDev.h | 16 -
poppler/Page.cc | 4
poppler/Page.h | 40 +--
poppler/PreScanOutputDev.cc | 15 -
poppler/PreScanOutputDev.h | 12 -
poppler/SplashOutputDev.cc | 47 +---
poppler/SplashOutputDev.h | 14 -
poppler/TextOutputDev.cc | 12 -
poppler/TextOutputDev.h | 24 +-
poppler/UnicodeMap.cc | 2
poppler/UnicodeMap.h | 6
qt5/src/ArthurOutputDev.cc | 6
qt5/src/ArthurOutputDev.h | 6
qt5/src/poppler-annotation.cc | 2
qt5/src/poppler-form.cc | 2
qt5/src/poppler-page.cc | 3
utils/HtmlOutputDev.cc | 2
utils/ImageOutputDev.cc | 6
utils/ImageOutputDev.h | 4
utils/pdfinfo.cc | 2
utils/pdfunite.cc | 2
38 files changed, 518 insertions(+), 536 deletions(-)
New commits:
commit b8b82412a8123369335c37e546cec38eaa460d05
Author: Albert Astals Cid <aacid at kde.org>
Date: Sun Sep 23 23:47:54 2018 +0200
More const
Marked some caches as mutable
Fixed an actual bug in page::text that was swapping the page cropbox in
each call
diff --git a/cpp/poppler-page.cpp b/cpp/poppler-page.cpp
index 8280c14f..35182c86 100644
--- a/cpp/poppler-page.cpp
+++ b/cpp/poppler-page.cpp
@@ -131,7 +131,7 @@ double page::duration() const
*/
rectf page::page_rect(page_box_enum box) const
{
- PDFRectangle *r = nullptr;
+ const PDFRectangle *r = nullptr;
switch (box) {
case media_box:
r = d->page->getMediaBox();
@@ -277,13 +277,13 @@ ustring page::text(const rectf &r, text_layout_enum layout_mode) const
TextOutputDev td(nullptr, gFalse, 0, use_raw_order, gFalse);
d->doc->doc->displayPage(&td, d->index + 1, 72, 72, 0, false, true, false);
if (r.is_empty()) {
- PDFRectangle *rect = d->page->getCropBox();
+ PDFRectangle rect = *d->page->getCropBox();
const int rotate = d->page->getRotate();
if (rotate == 90 || rotate == 270) {
- std::swap(rect->x1, rect->y1);
- std::swap(rect->x2, rect->y2);
+ std::swap(rect.x1, rect.y1);
+ std::swap(rect.x2, rect.y2);
}
- s.reset(td.getText(rect->x1, rect->y1, rect->x2, rect->y2));
+ s.reset(td.getText(rect.x1, rect.y1, rect.x2, rect.y2));
} else {
s.reset(td.getText(r.left(), r.top(), r.right(), r.bottom()));
}
diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index 6b511692..2934aba5 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -2099,7 +2099,7 @@ poppler_annot_mapping_free (PopplerAnnotMapping *mapping)
void
poppler_page_get_crop_box (PopplerPage *page, PopplerRectangle *rect)
{
- PDFRectangle* cropBox = page->page->getCropBox ();
+ const PDFRectangle* cropBox = page->page->getCropBox ();
rect->x1 = cropBox->x1;
rect->x2 = cropBox->x2;
diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index 8e8102e9..fc036263 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -367,7 +367,7 @@ void CairoOutputDev::updateAll(GfxState *state) {
text->updateFont(state);
}
-void CairoOutputDev::setDefaultCTM(double *ctm) {
+void CairoOutputDev::setDefaultCTM(const double *ctm) {
cairo_matrix_t matrix;
matrix.xx = ctm[0];
matrix.yx = ctm[1];
@@ -683,7 +683,7 @@ void CairoOutputDev::updateFont(GfxState *state) {
cairo_surface_has_show_text_glyphs (cairo_get_target (cairo));
double fontSize = state->getFontSize();
- double *m = state->getTextMat();
+ const double *m = state->getTextMat();
/* NOTE: adjusting by a constant is hack. The correct solution
* is probably to use user-fonts and compute the scale on a per
* glyph basis instead of for the entire font */
@@ -897,8 +897,8 @@ void CairoOutputDev::eoFill(GfxState *state) {
}
GBool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat, Object *str,
- double *pmat, int paintType, int /*tilingType*/, Dict *resDict,
- double *mat, double *bbox,
+ 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)
{
@@ -1012,10 +1012,9 @@ GBool CairoOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *sh
double y_step;
GfxColor color;
GfxRGB rgb;
- double *matrix;
cairo_matrix_t mat;
- matrix = shading->getMatrix();
+ const double *matrix = shading->getMatrix();
mat.xx = matrix[0];
mat.yx = matrix[1];
mat.xy = matrix[2];
@@ -1238,7 +1237,7 @@ GBool CairoOutputDev::patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *
fill_pattern = cairo_pattern_create_mesh ();
for (i = 0; i < shading->getNPatches(); i++) {
- GfxPatch *patch = shading->getPatch(i);
+ const GfxPatch *patch = shading->getPatch(i);
GfxColor color;
GfxRGB rgb;
@@ -1524,10 +1523,9 @@ GBool CairoOutputDev::beginType3Char(GfxState *state, double x, double y,
CharCode code, Unicode *u, int uLen) {
cairo_save (cairo);
- double *ctm;
cairo_matrix_t matrix;
- ctm = state->getCTM();
+ const double *ctm = state->getCTM();
matrix.xx = ctm[0];
matrix.yx = ctm[1];
matrix.xy = ctm[2];
@@ -1629,7 +1627,7 @@ cairo_surface_t *cairo_surface_create_similar_clip (cairo_t *cairo, cairo_conten
-void CairoOutputDev::beginTransparencyGroup(GfxState * /*state*/, double * /*bbox*/,
+void CairoOutputDev::beginTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/,
GfxColorSpace * blendingColorSpace,
GBool /*isolated*/, GBool knockout,
GBool forSoftMask) {
@@ -1692,7 +1690,7 @@ void CairoOutputDev::endTransparencyGroup(GfxState * /*state*/) {
}
}
-void CairoOutputDev::paintTransparencyGroup(GfxState * /*state*/, double * /*bbox*/) {
+void CairoOutputDev::paintTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/) {
LOG(printf ("paint transparency group\n"));
cairo_save (cairo);
@@ -1758,7 +1756,7 @@ static int luminocity(uint32_t x)
/* XXX: do we need to deal with shape here? */
-void CairoOutputDev::setSoftMask(GfxState * state, double * bbox, GBool alpha,
+void CairoOutputDev::setSoftMask(GfxState * state, const double * bbox, GBool alpha,
Function * transferFunc, GfxColor * backdropColor) {
cairo_pattern_destroy(mask);
@@ -3383,7 +3381,7 @@ void CairoImageOutputDev::saveImage(CairoImage *image)
void CairoImageOutputDev::getBBox(GfxState *state, int width, int height,
double *x1, double *y1, double *x2, double *y2)
{
- double *ctm = state->getCTM();
+ const double *ctm = state->getCTM();
cairo_matrix_t matrix;
cairo_matrix_init(&matrix,
ctm[0], ctm[1],
diff --git a/poppler/CairoOutputDev.h b/poppler/CairoOutputDev.h
index 6ee6f9e8..c6776f4a 100644
--- a/poppler/CairoOutputDev.h
+++ b/poppler/CairoOutputDev.h
@@ -146,7 +146,7 @@ public:
//----- update graphics state
void updateAll(GfxState *state) override;
- void setDefaultCTM(double *ctm) override;
+ void setDefaultCTM(const double *ctm) override;
void updateCTM(GfxState *state, double m11, double m12,
double m21, double m22, double m31, double m32) override;
void updateLineDash(GfxState *state) override;
@@ -171,8 +171,8 @@ public:
void eoFill(GfxState *state) override;
void clipToStrokePath(GfxState *state) override;
GBool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str,
- double *pmat, int paintType, int tilingType, Dict *resDict,
- double *mat, double *bbox,
+ 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;
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0)
@@ -245,14 +245,14 @@ public:
GBool maskInvert, GBool maskInterpolate) override;
//----- transparency groups and soft masks
- void beginTransparencyGroup(GfxState * /*state*/, double * /*bbox*/,
+ void beginTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/,
GfxColorSpace * /*blendingColorSpace*/,
GBool /*isolated*/, GBool /*knockout*/,
GBool /*forSoftMask*/) override;
void endTransparencyGroup(GfxState * /*state*/) override;
void popTransparencyGroup();
- void paintTransparencyGroup(GfxState * /*state*/, double * /*bbox*/) override;
- void setSoftMask(GfxState * /*state*/, double * /*bbox*/, GBool /*alpha*/,
+ void paintTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/) override;
+ void setSoftMask(GfxState * /*state*/, const double * /*bbox*/, GBool /*alpha*/,
Function * /*transferFunc*/, GfxColor * /*backdropColor*/) override;
void clearSoftMask(GfxState * /*state*/) override;
@@ -429,7 +429,7 @@ public:
//----- update graphics state
void updateAll(GfxState *state) override { }
- void setDefaultCTM(double *ctm) override { }
+ void setDefaultCTM(const double *ctm) override { }
void updateCTM(GfxState *state, double m11, double m12,
double m21, double m22, double m31, double m32) override { }
void updateLineDash(GfxState *state) override { }
@@ -453,8 +453,8 @@ public:
void eoFill(GfxState *state) override { }
void clipToStrokePath(GfxState *state) override { }
GBool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str,
- double *pmat, int paintType, int tilingType, Dict *resDict,
- double *mat, double *bbox,
+ 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 gTrue; }
GBool axialShadedFill(GfxState *state,
@@ -497,13 +497,13 @@ public:
//----- transparency groups and soft masks
- void beginTransparencyGroup(GfxState * /*state*/, double * /*bbox*/,
+ void beginTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/,
GfxColorSpace * /*blendingColorSpace*/,
GBool /*isolated*/, GBool /*knockout*/,
GBool /*forSoftMask*/) override {}
void endTransparencyGroup(GfxState * /*state*/) override {}
- void paintTransparencyGroup(GfxState * /*state*/, double * /*bbox*/) override {}
- void setSoftMask(GfxState * /*state*/, double * /*bbox*/, GBool /*alpha*/,
+ void paintTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/) override {}
+ void setSoftMask(GfxState * /*state*/, const double * /*bbox*/, GBool /*alpha*/,
Function * /*transferFunc*/, GfxColor * /*backdropColor*/) override {}
void clearSoftMask(GfxState * /*state*/) override {}
diff --git a/poppler/Function.cc b/poppler/Function.cc
index 69abe81a..b16cbfc1 100644
--- a/poppler/Function.cc
+++ b/poppler/Function.cc
@@ -199,7 +199,7 @@ IdentityFunction::IdentityFunction() {
IdentityFunction::~IdentityFunction() {
}
-void IdentityFunction::transform(double *in, double *out) {
+void IdentityFunction::transform(const double *in, double *out) const {
int i;
for (i = 0; i < funcMaxOutputs; ++i) {
@@ -440,7 +440,7 @@ SampledFunction::SampledFunction(const SampledFunction *func) : Function(func) {
ok = func->ok;
}
-void SampledFunction::transform(double *in, double *out) {
+void SampledFunction::transform(const double *in, double *out) const {
double x;
int e[funcMaxInputs];
double efrac0[funcMaxInputs];
@@ -522,12 +522,12 @@ void SampledFunction::transform(double *in, double *out) {
}
}
-GBool SampledFunction::hasDifferentResultSet(Function *func) {
+GBool SampledFunction::hasDifferentResultSet(const Function *func) const {
if (func->getType() == 0) {
SampledFunction *compTo = (SampledFunction *) func;
if (compTo->getSampleNumber() != nSamples)
return gTrue;
- double *compSamples = compTo->getSamples();
+ const double *compSamples = compTo->getSamples();
for (int i = 0; i < nSamples; i++) {
if (samples[i] != compSamples[i])
return gTrue;
@@ -630,7 +630,7 @@ ExponentialFunction::ExponentialFunction(const ExponentialFunction *func) : Func
ok = func->ok;
}
-void ExponentialFunction::transform(double *in, double *out) {
+void ExponentialFunction::transform(const double *in, double *out) const {
double x;
int i;
@@ -798,7 +798,7 @@ StitchingFunction::~StitchingFunction() {
gfree(scale);
}
-void StitchingFunction::transform(double *in, double *out) {
+void StitchingFunction::transform(const double *in, double *out) const {
double x;
int i;
@@ -1215,7 +1215,7 @@ PostScriptFunction::~PostScriptFunction() {
delete codeString;
}
-void PostScriptFunction::transform(double *in, double *out) {
+void PostScriptFunction::transform(const double *in, double *out) const {
PSStack stack;
int i;
@@ -1441,7 +1441,7 @@ void PostScriptFunction::resizeCode(int newSize) {
}
}
-void PostScriptFunction::exec(PSStack *stack, int codePtr) {
+void PostScriptFunction::exec(PSStack *stack, int codePtr) const {
int i1, i2;
double r1, r2, result;
GBool b1, b2;
diff --git a/poppler/Function.h b/poppler/Function.h
index 10adf705..5cce1b31 100644
--- a/poppler/Function.h
+++ b/poppler/Function.h
@@ -65,7 +65,7 @@ public:
// Initialize the entries common to all function types.
GBool init(Dict *dict);
- virtual Function *copy() = 0;
+ virtual Function *copy() const = 0;
// Return the function type:
// -1 : identity
@@ -73,23 +73,23 @@ public:
// 2 : exponential
// 3 : stitching
// 4 : PostScript
- virtual int getType() = 0;
+ virtual int getType() const = 0;
// Return size of input and output tuples.
- int getInputSize() { return m; }
- int getOutputSize() { return n; }
+ int getInputSize() const { return m; }
+ int getOutputSize() const { return n; }
- double getDomainMin(int i) { return domain[i][0]; }
- double getDomainMax(int i) { return domain[i][1]; }
- double getRangeMin(int i) { return range[i][0]; }
- double getRangeMax(int i) { return range[i][1]; }
- GBool getHasRange() { return hasRange; }
- virtual GBool hasDifferentResultSet(Function *func) { return gFalse; }
+ double getDomainMin(int i) const { return domain[i][0]; }
+ double getDomainMax(int i) const { return domain[i][1]; }
+ double getRangeMin(int i) const { return range[i][0]; }
+ double getRangeMax(int i) const { return range[i][1]; }
+ GBool getHasRange() const { return hasRange; }
+ virtual GBool hasDifferentResultSet(const Function *func) const { return gFalse; }
// Transform an input tuple into an output tuple.
- virtual void transform(double *in, double *out) = 0;
+ virtual void transform(const double *in, double *out) const = 0;
- virtual GBool isOk() = 0;
+ virtual GBool isOk() const = 0;
protected:
static Function *parse(Object *funcObj, std::set<int> *usedParents);
@@ -113,10 +113,10 @@ public:
IdentityFunction();
~IdentityFunction();
- Function *copy() override { return new IdentityFunction(); }
- int getType() override { return -1; }
- void transform(double *in, double *out) override;
- GBool isOk() override { return gTrue; }
+ Function *copy() const override { return new IdentityFunction(); }
+ int getType() const override { return -1; }
+ void transform(const double *in, double *out) const override;
+ GBool isOk() const override { return gTrue; }
private:
};
@@ -130,19 +130,19 @@ public:
SampledFunction(Object *funcObj, Dict *dict);
~SampledFunction();
- Function *copy() override { return new SampledFunction(this); }
- int getType() override { return 0; }
- void transform(double *in, double *out) override;
- GBool isOk() override { return ok; }
- GBool hasDifferentResultSet(Function *func) override;
-
- int getSampleSize(int i) { return sampleSize[i]; }
- double getEncodeMin(int i) { return encode[i][0]; }
- double getEncodeMax(int i) { return encode[i][1]; }
- double getDecodeMin(int i) { return decode[i][0]; }
- double getDecodeMax(int i) { return decode[i][1]; }
- double *getSamples() { return samples; }
- int getSampleNumber() { return nSamples; }
+ Function *copy() const override { return new SampledFunction(this); }
+ int getType() const override { return 0; }
+ void transform(const double *in, double *out) const override;
+ GBool isOk() const override { return ok; }
+ GBool hasDifferentResultSet(const Function *func) const override;
+
+ int getSampleSize(int i) const { return sampleSize[i]; }
+ double getEncodeMin(int i) const { return encode[i][0]; }
+ double getEncodeMax(int i) const { return encode[i][1]; }
+ double getDecodeMin(int i) const { return decode[i][0]; }
+ double getDecodeMax(int i) const { return decode[i][1]; }
+ const double *getSamples() const { return samples; }
+ int getSampleNumber() const { return nSamples; }
private:
@@ -160,8 +160,8 @@ private:
double *samples; // the samples
int nSamples; // size of the samples array
double *sBuf; // buffer for the transform function
- double cacheIn[funcMaxInputs];
- double cacheOut[funcMaxOutputs];
+ mutable double cacheIn[funcMaxInputs];
+ mutable double cacheOut[funcMaxOutputs];
GBool ok;
};
@@ -174,14 +174,14 @@ public:
ExponentialFunction(Object *funcObj, Dict *dict);
~ExponentialFunction();
- Function *copy() override { return new ExponentialFunction(this); }
- int getType() override { return 2; }
- void transform(double *in, double *out) override;
- GBool isOk() override { return ok; }
+ Function *copy() const override { return new ExponentialFunction(this); }
+ int getType() const override { return 2; }
+ void transform(const double *in, double *out) const override;
+ GBool isOk() const override { return ok; }
- double *getC0() { return c0; }
- double *getC1() { return c1; }
- double getE() { return e; }
+ const double *getC0() const { return c0; }
+ const double *getC1() const { return c1; }
+ double getE() const { return e; }
private:
@@ -203,16 +203,16 @@ public:
StitchingFunction(Object *funcObj, Dict *dict, std::set<int> *usedParents);
~StitchingFunction();
- Function *copy() override { return new StitchingFunction(this); }
- int getType() override { return 3; }
- void transform(double *in, double *out) override;
- GBool isOk() override { return ok; }
+ Function *copy() const override { return new StitchingFunction(this); }
+ int getType() const override { return 3; }
+ void transform(const double *in, double *out) const override;
+ GBool isOk() const override { return ok; }
- int getNumFuncs() { return k; }
- Function *getFunc(int i) { return funcs[i]; }
- double *getBounds() { return bounds; }
- double *getEncode() { return encode; }
- double *getScale() { return scale; }
+ int getNumFuncs() const { return k; }
+ const Function *getFunc(int i) const { return funcs[i]; }
+ const double *getBounds() const { return bounds; }
+ const double *getEncode() const { return encode; }
+ const double *getScale() const { return scale; }
private:
@@ -235,10 +235,10 @@ public:
PostScriptFunction(Object *funcObj, Dict *dict);
~PostScriptFunction();
- Function *copy() override { return new PostScriptFunction(this); }
- int getType() override { return 4; }
- void transform(double *in, double *out) override;
- GBool isOk() override { return ok; }
+ Function *copy() const override { return new PostScriptFunction(this); }
+ int getType() const override { return 4; }
+ void transform(const double *in, double *out) const override;
+ GBool isOk() const override { return ok; }
const GooString *getCodeString() const { return codeString; }
@@ -248,13 +248,13 @@ private:
GBool parseCode(Stream *str, int *codePtr);
GooString *getToken(Stream *str);
void resizeCode(int newSize);
- void exec(PSStack *stack, int codePtr);
+ void exec(PSStack *stack, int codePtr) const;
GooString *codeString;
PSObject *code;
int codeSize;
- double cacheIn[funcMaxInputs];
- double cacheOut[funcMaxOutputs];
+ mutable double cacheIn[funcMaxInputs];
+ mutable double cacheOut[funcMaxOutputs];
GBool ok;
};
diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index 1c6a5de7..c9a71822 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -532,8 +532,8 @@ Object GfxResources::lookupGStateNF(const char *name) {
//------------------------------------------------------------------------
Gfx::Gfx(PDFDoc *docA, OutputDev *outA, int pageNum, Dict *resDict,
- double hDPI, double vDPI, PDFRectangle *box,
- PDFRectangle *cropBox, int rotate,
+ double hDPI, double vDPI, const PDFRectangle *box,
+ const PDFRectangle *cropBox, int rotate,
GBool (*abortCheckCbkA)(void *data),
void *abortCheckCbkDataA, XRef *xrefA)
{
@@ -588,7 +588,7 @@ Gfx::Gfx(PDFDoc *docA, OutputDev *outA, int pageNum, Dict *resDict,
}
Gfx::Gfx(PDFDoc *docA, OutputDev *outA, Dict *resDict,
- PDFRectangle *box, PDFRectangle *cropBox,
+ const PDFRectangle *box, const PDFRectangle *cropBox,
GBool (*abortCheckCbkA)(void *data),
void *abortCheckCbkDataA, Gfx *gfxA)
{
@@ -2033,7 +2033,7 @@ void Gfx::doTilingPatternFill(GfxTilingPattern *tPat,
double xMin, yMin, xMax, yMax, x, y, x1, y1;
double cxMin, cyMin, cxMax, cyMax;
int xi0, yi0, xi1, yi1, xi, yi;
- double *ctm, *btm, *ptm;
+ const double *ctm, *btm, *ptm;
double m[6], ictm[6], m1[6], imb[6];
double det;
double xstep, ystep;
@@ -2255,7 +2255,7 @@ void Gfx::doShadingPatternFill(GfxShadingPattern *sPat,
GBool stroke, GBool eoFill, GBool text) {
GfxShading *shading;
GfxState *savedState;
- double *ctm, *btm, *ptm;
+ const double *ctm, *btm, *ptm;
double m[6], ictm[6], m1[6];
double xMin, yMin, xMax, yMax;
double det;
@@ -2482,12 +2482,11 @@ void Gfx::doFunctionShFill1(GfxFunctionShading *shading,
GfxColor fillColor;
GfxColor color0M, color1M, colorM0, colorM1, colorMM;
GfxColor colors2[4];
- double *matrix;
double xM, yM;
int nComps, i, j;
nComps = shading->getColorSpace()->getNComps();
- matrix = shading->getMatrix();
+ const double *matrix = shading->getMatrix();
// compare the four corner colors
for (i = 0; i < 4; ++i) {
@@ -2916,7 +2915,6 @@ void Gfx::doRadialShFill(GfxRadialShading *shading) {
double sz, xz, yz, sMin, sMax;
GBool enclosed;
int ia, ib, k, n;
- double *ctm;
double theta, alpha, angle, t;
GBool needExtend = gTrue;
@@ -3029,7 +3027,7 @@ void Gfx::doRadialShFill(GfxRadialShading *shading) {
// achieve a curve flatness of 0.1 pixel in device space for the
// largest circle (note that "device space" is 72 dpi when generating
// PostScript, hence the relatively small 0.1 pixel accuracy)
- ctm = state->getCTM();
+ const double *ctm = state->getCTM();
t = fabs(ctm[0]);
if (fabs(ctm[1]) > t) {
t = fabs(ctm[1]);
@@ -3478,7 +3476,7 @@ void Gfx::doPatchMeshShFill(GfxPatchMeshShading *shading) {
}
-void Gfx::fillPatch(GfxPatch *patch, int colorComps, int patchColorComps, double refineColorThreshold, int depth, GfxPatchMeshShading *shading) {
+void Gfx::fillPatch(const GfxPatch *patch, int colorComps, int patchColorComps, double refineColorThreshold, int depth, const GfxPatchMeshShading *shading) {
GfxPatch patch00, patch01, patch10, patch11;
double xx[4][8], yy[4][8];
double xxm, yym;
@@ -4773,7 +4771,7 @@ void Gfx::doForm(Object *str) {
ocState = ocSaved;
}
-void Gfx::drawForm(Object *str, Dict *resDict, double *matrix, double *bbox,
+void Gfx::drawForm(Object *str, Dict *resDict, const double *matrix, const double *bbox,
GBool transpGroup, GBool softMask,
GfxColorSpace *blendingColorSpace,
GBool isolated, GBool knockout,
diff --git a/poppler/Gfx.h b/poppler/Gfx.h
index 75efab1b..5cc2685a 100644
--- a/poppler/Gfx.h
+++ b/poppler/Gfx.h
@@ -152,14 +152,14 @@ public:
// Constructor for regular output.
Gfx(PDFDoc *docA, OutputDev *outA, int pageNum, Dict *resDict,
- double hDPI, double vDPI, PDFRectangle *box,
- PDFRectangle *cropBox, int rotate,
+ double hDPI, double vDPI, const PDFRectangle *box,
+ const PDFRectangle *cropBox, int rotate,
GBool (*abortCheckCbkA)(void *data) = NULL,
void *abortCheckCbkDataA = NULL, XRef *xrefA = NULL);
// Constructor for a sub-page object.
Gfx(PDFDoc *docA, OutputDev *outA, Dict *resDict,
- PDFRectangle *box, PDFRectangle *cropBox,
+ const PDFRectangle *box, const PDFRectangle *cropBox,
GBool (*abortCheckCbkA)(void *data) = NULL,
void *abortCheckCbkDataA = NULL, Gfx *gfxA = NULL);
#ifdef USE_CMS
@@ -197,7 +197,7 @@ public:
GBool checkTransparencyGroup(Dict *resDict);
- void drawForm(Object *str, Dict *resDict, double *matrix, double *bbox,
+ void drawForm(Object *str, Dict *resDict, const double *matrix, const double *bbox,
GBool transpGroup = gFalse, GBool softMask = gFalse,
GfxColorSpace *blendingColorSpace = NULL,
GBool isolated = gFalse, GBool knockout = gFalse,
@@ -330,7 +330,7 @@ private:
double x2, double y2, double color2,
double refineColorThreshold, int depth, GfxGouraudTriangleShading *shading, GfxState::ReusablePathIterator *path);
void doPatchMeshShFill(GfxPatchMeshShading *shading);
- void fillPatch(GfxPatch *patch, int colorComps, int patchColorComps, double refineColorThreshold, int depth, GfxPatchMeshShading *shading);
+ void fillPatch(const GfxPatch *patch, int colorComps, int patchColorComps, double refineColorThreshold, int depth, const GfxPatchMeshShading *shading);
void doEndPath();
// path clipping operators
diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index fa31c360..6cccef26 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -660,7 +660,7 @@ GfxColorSpace *GfxDeviceGrayColorSpace::copy() {
return new GfxDeviceGrayColorSpace();
}
-void GfxDeviceGrayColorSpace::getGray(GfxColor *color, GfxGray *gray) {
+void GfxDeviceGrayColorSpace::getGray(const GfxColor *color, GfxGray *gray) const {
*gray = clip01(color->c[0]);
}
@@ -668,7 +668,7 @@ void GfxDeviceGrayColorSpace::getGrayLine(Guchar *in, Guchar *out, int length) {
memcpy (out, in, length);
}
-void GfxDeviceGrayColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
+void GfxDeviceGrayColorSpace::getRGB(const GfxColor *color, GfxRGB *rgb) const {
rgb->r = rgb->g = rgb->b = clip01(color->c[0]);
}
@@ -715,12 +715,12 @@ void GfxDeviceGrayColorSpace::getDeviceNLine(Guchar *in, Guchar *out, int length
}
}
-void GfxDeviceGrayColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
+void GfxDeviceGrayColorSpace::getCMYK(const GfxColor *color, GfxCMYK *cmyk) const {
cmyk->c = cmyk->m = cmyk->y = 0;
cmyk->k = clip01(gfxColorComp1 - color->c[0]);
}
-void GfxDeviceGrayColorSpace::getDeviceN(GfxColor *color, GfxColor *deviceN) {
+void GfxDeviceGrayColorSpace::getDeviceN(const GfxColor *color, GfxColor *deviceN) const {
for (int i = 0; i < gfxColorMaxComps; i++)
deviceN->c[i] = 0;
deviceN->c[3] = clip01(gfxColorComp1 - color->c[0]);
@@ -834,8 +834,8 @@ GfxColorSpace *GfxCalGrayColorSpace::parse(Array *arr, GfxState *state) {
// convert CalGray to media XYZ color space
// (not multiply by the white point)
-void GfxCalGrayColorSpace::getXYZ(GfxColor *color,
- double *pX, double *pY, double *pZ) {
+void GfxCalGrayColorSpace::getXYZ(const GfxColor *color,
+ double *pX, double *pY, double *pZ) const {
const double A = colToDbl(color->c[0]);
const double xyzColor = pow(A,gamma);
*pX = xyzColor;
@@ -843,7 +843,7 @@ void GfxCalGrayColorSpace::getXYZ(GfxColor *color,
*pZ = xyzColor;
}
-void GfxCalGrayColorSpace::getGray(GfxColor *color, GfxGray *gray) {
+void GfxCalGrayColorSpace::getGray(const GfxColor *color, GfxGray *gray) const {
GfxRGB rgb;
#ifdef USE_CMS
@@ -867,7 +867,7 @@ void GfxCalGrayColorSpace::getGray(GfxColor *color, GfxGray *gray) {
0.114 * rgb.b + 0.5));
}
-void GfxCalGrayColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
+void GfxCalGrayColorSpace::getRGB(const GfxColor *color, GfxRGB *rgb) const {
double X, Y, Z;
double r, g, b;
@@ -899,7 +899,7 @@ void GfxCalGrayColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
rgb->b = dblToCol(sqrt(clip01(b * kb)));
}
-void GfxCalGrayColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
+void GfxCalGrayColorSpace::getCMYK(const GfxColor *color, GfxCMYK *cmyk) const {
GfxRGB rgb;
GfxColorComp c, m, y, k;
@@ -939,7 +939,7 @@ void GfxCalGrayColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
cmyk->k = k;
}
-void GfxCalGrayColorSpace::getDeviceN(GfxColor *color, GfxColor *deviceN) {
+void GfxCalGrayColorSpace::getDeviceN(const GfxColor *color, GfxColor *deviceN) const {
GfxCMYK cmyk;
for (int i = 0; i < gfxColorMaxComps; i++)
deviceN->c[i] = 0;
@@ -968,7 +968,7 @@ GfxColorSpace *GfxDeviceRGBColorSpace::copy() {
return new GfxDeviceRGBColorSpace();
}
-void GfxDeviceRGBColorSpace::getGray(GfxColor *color, GfxGray *gray) {
+void GfxDeviceRGBColorSpace::getGray(const GfxColor *color, GfxGray *gray) const {
*gray = clip01((GfxColorComp)(0.3 * color->c[0] +
0.59 * color->c[1] +
0.11 * color->c[2] + 0.5));
@@ -985,7 +985,7 @@ void GfxDeviceRGBColorSpace::getGrayLine(Guchar *in, Guchar *out, int length) {
}
}
-void GfxDeviceRGBColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
+void GfxDeviceRGBColorSpace::getRGB(const GfxColor *color, GfxRGB *rgb) const {
rgb->r = clip01(color->c[0]);
rgb->g = clip01(color->c[1]);
rgb->b = clip01(color->c[2]);
@@ -1062,7 +1062,7 @@ void GfxDeviceRGBColorSpace::getDeviceNLine(Guchar *in, Guchar *out, int length)
}
}
-void GfxDeviceRGBColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
+void GfxDeviceRGBColorSpace::getCMYK(const GfxColor *color, GfxCMYK *cmyk) const {
GfxColorComp c, m, y, k;
c = clip01(gfxColorComp1 - color->c[0]);
@@ -1081,7 +1081,7 @@ void GfxDeviceRGBColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
cmyk->k = k;
}
-void GfxDeviceRGBColorSpace::getDeviceN(GfxColor *color, GfxColor *deviceN) {
+void GfxDeviceRGBColorSpace::getDeviceN(const GfxColor *color, GfxColor *deviceN) const {
GfxCMYK cmyk;
for (int i = 0; i < gfxColorMaxComps; i++)
deviceN->c[i] = 0;
@@ -1220,8 +1220,8 @@ GfxColorSpace *GfxCalRGBColorSpace::parse(Array *arr, GfxState *state) {
}
// convert CalRGB to XYZ color space
-void GfxCalRGBColorSpace::getXYZ(GfxColor *color,
- double *pX, double *pY, double *pZ) {
+void GfxCalRGBColorSpace::getXYZ(const GfxColor *color,
+ double *pX, double *pY, double *pZ) const {
double A, B, C;
A = pow(colToDbl(color->c[0]), gammaR);
@@ -1232,7 +1232,7 @@ void GfxCalRGBColorSpace::getXYZ(GfxColor *color,
*pZ = mat[2] * A + mat[5] * B + mat[8] * C;
}
-void GfxCalRGBColorSpace::getGray(GfxColor *color, GfxGray *gray) {
+void GfxCalRGBColorSpace::getGray(const GfxColor *color, GfxGray *gray) const {
GfxRGB rgb;
#ifdef USE_CMS
@@ -1256,7 +1256,7 @@ void GfxCalRGBColorSpace::getGray(GfxColor *color, GfxGray *gray) {
0.114 * rgb.b + 0.5));
}
-void GfxCalRGBColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
+void GfxCalRGBColorSpace::getRGB(const GfxColor *color, GfxRGB *rgb) const {
double X, Y, Z;
double r, g, b;
@@ -1285,7 +1285,7 @@ void GfxCalRGBColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
rgb->b = dblToCol(sqrt(clip01(b)));
}
-void GfxCalRGBColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
+void GfxCalRGBColorSpace::getCMYK(const GfxColor *color, GfxCMYK *cmyk) const {
GfxRGB rgb;
GfxColorComp c, m, y, k;
@@ -1324,7 +1324,7 @@ void GfxCalRGBColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
cmyk->k = k;
}
-void GfxCalRGBColorSpace::getDeviceN(GfxColor *color, GfxColor *deviceN) {
+void GfxCalRGBColorSpace::getDeviceN(const GfxColor *color, GfxColor *deviceN) const {
GfxCMYK cmyk;
for (int i = 0; i < gfxColorMaxComps; i++)
deviceN->c[i] = 0;
@@ -1355,14 +1355,14 @@ GfxColorSpace *GfxDeviceCMYKColorSpace::copy() {
return new GfxDeviceCMYKColorSpace();
}
-void GfxDeviceCMYKColorSpace::getGray(GfxColor *color, GfxGray *gray) {
+void GfxDeviceCMYKColorSpace::getGray(const GfxColor *color, GfxGray *gray) const {
*gray = clip01((GfxColorComp)(gfxColorComp1 - color->c[3]
- 0.3 * color->c[0]
- 0.59 * color->c[1]
- 0.11 * color->c[2] + 0.5));
}
-void GfxDeviceCMYKColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
+void GfxDeviceCMYKColorSpace::getRGB(const GfxColor *color, GfxRGB *rgb) const {
double c, m, y, k, c1, m1, y1, k1, r, g, b;
c = colToDbl(color->c[0]);
@@ -1451,14 +1451,14 @@ void GfxDeviceCMYKColorSpace::getDeviceNLine(Guchar *in, Guchar *out, int length
}
}
-void GfxDeviceCMYKColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
+void GfxDeviceCMYKColorSpace::getCMYK(const GfxColor *color, GfxCMYK *cmyk) const {
cmyk->c = clip01(color->c[0]);
cmyk->m = clip01(color->c[1]);
cmyk->y = clip01(color->c[2]);
cmyk->k = clip01(color->c[3]);
}
-void GfxDeviceCMYKColorSpace::getDeviceN(GfxColor *color, GfxColor *deviceN) {
+void GfxDeviceCMYKColorSpace::getDeviceN(const GfxColor *color, GfxColor *deviceN) const {
for (int i = 0; i < gfxColorMaxComps; i++)
deviceN->c[i] = 0;
deviceN->c[0] = clip01(color->c[0]);
@@ -1584,7 +1584,7 @@ GfxColorSpace *GfxLabColorSpace::parse(Array *arr, GfxState *state) {
return cs;
}
-void GfxLabColorSpace::getGray(GfxColor *color, GfxGray *gray) {
+void GfxLabColorSpace::getGray(const GfxColor *color, GfxGray *gray) const {
GfxRGB rgb;
#ifdef USE_CMS
@@ -1606,8 +1606,8 @@ void GfxLabColorSpace::getGray(GfxColor *color, GfxGray *gray) {
// convert L*a*b* to media XYZ color space
// (not multiply by the white point)
-void GfxLabColorSpace::getXYZ(GfxColor *color,
- double *pX, double *pY, double *pZ) {
+void GfxLabColorSpace::getXYZ(const GfxColor *color,
+ double *pX, double *pY, double *pZ) const {
double X, Y, Z;
double t1, t2;
@@ -1634,7 +1634,7 @@ void GfxLabColorSpace::getXYZ(GfxColor *color,
*pZ = Z;
}
-void GfxLabColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
+void GfxLabColorSpace::getRGB(const GfxColor *color, GfxRGB *rgb) const {
double X, Y, Z;
getXYZ(color, &X, &Y, &Z);
@@ -1687,7 +1687,7 @@ void GfxLabColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
rgb->b = dblToCol(sqrt(clip01(b * kb)));
}
-void GfxLabColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
+void GfxLabColorSpace::getCMYK(const GfxColor *color, GfxCMYK *cmyk) const {
GfxRGB rgb;
GfxColorComp c, m, y, k;
@@ -1722,7 +1722,7 @@ void GfxLabColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
cmyk->k = k;
}
-void GfxLabColorSpace::getDeviceN(GfxColor *color, GfxColor *deviceN) {
+void GfxLabColorSpace::getDeviceN(const GfxColor *color, GfxColor *deviceN) const {
GfxCMYK cmyk;
for (int i = 0; i < gfxColorMaxComps; i++)
deviceN->c[i] = 0;
@@ -2015,7 +2015,7 @@ GfxColorSpace *GfxICCBasedColorSpace::parse(Array *arr, OutputDev *out, GfxState
return cs;
}
-void GfxICCBasedColorSpace::getGray(GfxColor *color, GfxGray *gray) {
+void GfxICCBasedColorSpace::getGray(const GfxColor *color, GfxGray *gray) const {
#ifdef USE_CMS
if (transform != nullptr && transform->getTransformPixelType() == PT_GRAY) {
Guchar in[gfxColorMaxComps];
@@ -2064,7 +2064,7 @@ void GfxICCBasedColorSpace::getGray(GfxColor *color, GfxGray *gray) {
#endif
}
-void GfxICCBasedColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
+void GfxICCBasedColorSpace::getRGB(const GfxColor *color, GfxRGB *rgb) const {
#ifdef USE_CMS
if (transform != nullptr && transform->getTransformPixelType() == PT_RGB) {
Guchar in[gfxColorMaxComps];
@@ -2322,7 +2322,7 @@ void GfxICCBasedColorSpace::getDeviceNLine(Guchar *in, Guchar *out, int length)
#endif
}
-void GfxICCBasedColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
+void GfxICCBasedColorSpace::getCMYK(const GfxColor *color, GfxCMYK *cmyk) const {
#ifdef USE_CMS
if (transform != nullptr && transform->getTransformPixelType() == PT_CMYK) {
Guchar in[gfxColorMaxComps];
@@ -2392,7 +2392,7 @@ void GfxICCBasedColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
#endif
}
-GBool GfxICCBasedColorSpace::useGetRGBLine() {
+GBool GfxICCBasedColorSpace::useGetRGBLine() const {
#ifdef USE_CMS
return lineTransform != nullptr || alt->useGetRGBLine();
#else
@@ -2400,7 +2400,7 @@ GBool GfxICCBasedColorSpace::useGetRGBLine() {
#endif
}
-GBool GfxICCBasedColorSpace::useGetCMYKLine() {
+GBool GfxICCBasedColorSpace::useGetCMYKLine() const {
#ifdef USE_CMS
return lineTransform != nullptr || alt->useGetCMYKLine();
#else
@@ -2408,7 +2408,7 @@ GBool GfxICCBasedColorSpace::useGetCMYKLine() {
#endif
}
-GBool GfxICCBasedColorSpace::useGetDeviceNLine() {
+GBool GfxICCBasedColorSpace::useGetDeviceNLine() const {
#ifdef USE_CMS
return lineTransform != nullptr || alt->useGetDeviceNLine();
#else
@@ -2416,7 +2416,7 @@ GBool GfxICCBasedColorSpace::useGetDeviceNLine() {
#endif
}
-void GfxICCBasedColorSpace::getDeviceN(GfxColor *color, GfxColor *deviceN) {
+void GfxICCBasedColorSpace::getDeviceN(const GfxColor *color, GfxColor *deviceN) const {
GfxCMYK cmyk;
for (int i = 0; i < gfxColorMaxComps; i++)
deviceN->c[i] = 0;
@@ -2553,8 +2553,8 @@ GfxColorSpace *GfxIndexedColorSpace::parse(GfxResources *res, Array *arr, Output
return nullptr;
}
-GfxColor *GfxIndexedColorSpace::mapColorToBase(GfxColor *color,
- GfxColor *baseColor) {
+GfxColor *GfxIndexedColorSpace::mapColorToBase(const GfxColor *color,
+ GfxColor *baseColor) const {
Guchar *p;
double low[gfxColorMaxComps], range[gfxColorMaxComps];
int n, i;
@@ -2575,13 +2575,13 @@ GfxColor *GfxIndexedColorSpace::mapColorToBase(GfxColor *color,
return baseColor;
}
-void GfxIndexedColorSpace::getGray(GfxColor *color, GfxGray *gray) {
+void GfxIndexedColorSpace::getGray(const GfxColor *color, GfxGray *gray) const {
GfxColor color2;
base->getGray(mapColorToBase(color, &color2), gray);
}
-void GfxIndexedColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
+void GfxIndexedColorSpace::getRGB(const GfxColor *color, GfxRGB *rgb) const {
GfxColor color2;
base->getRGB(mapColorToBase(color, &color2), rgb);
@@ -2664,13 +2664,13 @@ void GfxIndexedColorSpace::getDeviceNLine(Guchar *in, Guchar *out, int length) {
gfree (line);
}
-void GfxIndexedColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
+void GfxIndexedColorSpace::getCMYK(const GfxColor *color, GfxCMYK *cmyk) const {
GfxColor color2;
base->getCMYK(mapColorToBase(color, &color2), cmyk);
}
-void GfxIndexedColorSpace::getDeviceN(GfxColor *color, GfxColor *deviceN) {
+void GfxIndexedColorSpace::getDeviceN(const GfxColor *color, GfxColor *deviceN) const {
GfxColor color2;
base->getDeviceN(mapColorToBase(color, &color2), deviceN);
@@ -2787,7 +2787,7 @@ GfxColorSpace *GfxSeparationColorSpace::parse(GfxResources *res, Array *arr, Out
return nullptr;
}
-void GfxSeparationColorSpace::getGray(GfxColor *color, GfxGray *gray) {
+void GfxSeparationColorSpace::getGray(const GfxColor *color, GfxGray *gray) const {
double x;
double c[gfxColorMaxComps];
GfxColor color2;
@@ -2805,7 +2805,7 @@ void GfxSeparationColorSpace::getGray(GfxColor *color, GfxGray *gray) {
}
}
-void GfxSeparationColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
+void GfxSeparationColorSpace::getRGB(const GfxColor *color, GfxRGB *rgb) const {
double x;
double c[gfxColorMaxComps];
GfxColor color2;
@@ -2831,7 +2831,7 @@ void GfxSeparationColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
}
}
-void GfxSeparationColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
+void GfxSeparationColorSpace::getCMYK(const GfxColor *color, GfxCMYK *cmyk) const {
double x;
double c[gfxColorMaxComps];
GfxColor color2;
@@ -2867,7 +2867,7 @@ void GfxSeparationColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
}
}
-void GfxSeparationColorSpace::getDeviceN(GfxColor *color, GfxColor *deviceN) {
+void GfxSeparationColorSpace::getDeviceN(const GfxColor *color, GfxColor *deviceN) const {
for (int i = 0; i < gfxColorMaxComps; i++)
deviceN->c[i] = 0;
if (mapping == nullptr || mapping[0] == -1) {
@@ -3109,7 +3109,7 @@ GfxColorSpace *GfxDeviceNColorSpace::parse(GfxResources *res, Array *arr, Output
return nullptr;
}
-void GfxDeviceNColorSpace::getGray(GfxColor *color, GfxGray *gray) {
+void GfxDeviceNColorSpace::getGray(const GfxColor *color, GfxGray *gray) const {
double x[gfxColorMaxComps], c[gfxColorMaxComps];
GfxColor color2;
int i;
@@ -3124,7 +3124,7 @@ void GfxDeviceNColorSpace::getGray(GfxColor *color, GfxGray *gray) {
alt->getGray(&color2, gray);
}
-void GfxDeviceNColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
+void GfxDeviceNColorSpace::getRGB(const GfxColor *color, GfxRGB *rgb) const {
double x[gfxColorMaxComps], c[gfxColorMaxComps];
GfxColor color2;
int i;
@@ -3139,7 +3139,7 @@ void GfxDeviceNColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
alt->getRGB(&color2, rgb);
}
-void GfxDeviceNColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
+void GfxDeviceNColorSpace::getCMYK(const GfxColor *color, GfxCMYK *cmyk) const {
double x[gfxColorMaxComps], c[gfxColorMaxComps];
GfxColor color2;
int i;
@@ -3154,7 +3154,7 @@ void GfxDeviceNColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
alt->getCMYK(&color2, cmyk);
}
-void GfxDeviceNColorSpace::getDeviceN(GfxColor *color, GfxColor *deviceN) {
+void GfxDeviceNColorSpace::getDeviceN(const GfxColor *color, GfxColor *deviceN) const {
for (int i = 0; i < gfxColorMaxComps; i++)
deviceN->c[i] = 0;
if (mapping == nullptr) {
@@ -3203,7 +3203,7 @@ void GfxDeviceNColorSpace::createMapping(GooList *separationList, int maxSepComp
} else {
Guint startOverprintMask = 0x10;
GBool found = gFalse;
- Function *sepFunc = nullptr;
+ const Function *sepFunc = nullptr;
if (nComps == 1)
sepFunc = func;
else {
@@ -3309,20 +3309,20 @@ GfxColorSpace *GfxPatternColorSpace::parse(GfxResources *res, Array *arr, Output
return cs;
}
-void GfxPatternColorSpace::getGray(GfxColor *color, GfxGray *gray) {
+void GfxPatternColorSpace::getGray(const GfxColor *color, GfxGray *gray) const {
*gray = 0;
}
-void GfxPatternColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
+void GfxPatternColorSpace::getRGB(const GfxColor *color, GfxRGB *rgb) const {
rgb->r = rgb->g = rgb->b = 0;
}
-void GfxPatternColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
+void GfxPatternColorSpace::getCMYK(const GfxColor *color, GfxCMYK *cmyk) const {
cmyk->c = cmyk->m = cmyk->y = 0;
cmyk->k = 1;
}
-void GfxPatternColorSpace::getDeviceN(GfxColor *color, GfxColor *deviceN) {
+void GfxPatternColorSpace::getDeviceN(const GfxColor *color, GfxColor *deviceN) const {
for (int i = 0; i < gfxColorMaxComps; i++)
deviceN->c[i] = 0;
deviceN->c[3] = 1;
@@ -3822,7 +3822,7 @@ GfxShading *GfxFunctionShading::copy() {
return new GfxFunctionShading(this);
}
-void GfxFunctionShading::getColor(double x, double y, GfxColor *color) {
+void GfxFunctionShading::getColor(double x, double y, GfxColor *color) const {
double in[2], out[gfxColorMaxComps];
int i;
@@ -5045,7 +5045,7 @@ void GfxGouraudTriangleShading::getTriangle(
}
}
-void GfxGouraudTriangleShading::getParameterizedColor(double t, GfxColor *color) {
+void GfxGouraudTriangleShading::getParameterizedColor(double t, GfxColor *color) const {
double out[gfxColorMaxComps];
for (int j = 0; j < nFuncs; ++j) {
@@ -5672,7 +5672,7 @@ GfxPatchMeshShading *GfxPatchMeshShading::parse(GfxResources *res, int typeA, Di
return shading;
}
-void GfxPatchMeshShading::getParameterizedColor(double t, GfxColor *color) {
+void GfxPatchMeshShading::getParameterizedColor(double t, GfxColor *color) const {
double out[gfxColorMaxComps] = {};
for (int j = 0; j < nFuncs; ++j) {
@@ -5697,7 +5697,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
GfxSeparationColorSpace *sepCS;
int maxPixel, indexHigh;
Guchar *indexedLookup;
- Function *sepFunc;
+ const Function *sepFunc;
double x[gfxColorMaxComps];
double y[gfxColorMaxComps] = {};
int i, j, k;
@@ -6287,7 +6287,7 @@ GfxSubpath::~GfxSubpath() {
}
// Used for copy().
-GfxSubpath::GfxSubpath(GfxSubpath *subpath) {
+GfxSubpath::GfxSubpath(const GfxSubpath *subpath) {
size = subpath->size;
n = subpath->n;
x = (double *)gmallocn(size, sizeof(double));
@@ -6505,7 +6505,7 @@ void GfxState::ReusablePathIterator::reset() {
numCoords = curSubPath->getNumPoints();
}
-GfxState::GfxState(double hDPIA, double vDPIA, PDFRectangle *pageBox,
+GfxState::GfxState(double hDPIA, double vDPIA, const PDFRectangle *pageBox,
int rotateA, GBool upsideDown) {
double kx, ky;
@@ -6669,7 +6669,7 @@ GfxState::~GfxState() {
}
// Used for copy();
-GfxState::GfxState(GfxState *state, GBool copyPath) {
+GfxState::GfxState(const GfxState *state, GBool copyPath) {
int i;
memcpy(this, state, sizeof(GfxState));
diff --git a/poppler/GfxState.h b/poppler/GfxState.h
index a401ff09..573c4e03 100644
--- a/poppler/GfxState.h
+++ b/poppler/GfxState.h
@@ -228,10 +228,10 @@ public:
static GfxColorSpace *parse(GfxResources *res, Object *csObj, OutputDev *out, GfxState *state, int recursion = 0);
// Convert to gray, RGB, or CMYK.
- virtual void getGray(GfxColor *color, GfxGray *gray) = 0;
- virtual void getRGB(GfxColor *color, GfxRGB *rgb) = 0;
- virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk) = 0;
- virtual void getDeviceN(GfxColor *color, GfxColor *deviceN) = 0;
+ virtual void getGray(const GfxColor *color, GfxGray *gray) const = 0;
+ virtual void getRGB(const GfxColor *color, GfxRGB *rgb) const = 0;
+ virtual void getCMYK(const GfxColor *color, GfxCMYK *cmyk) const = 0;
+ virtual void getDeviceN(const GfxColor *color, GfxColor *deviceN) const = 0;
virtual void getGrayLine(Guchar * /*in*/, Guchar * /*out*/, int /*length*/) { error(errInternal, -1, "GfxColorSpace::getGrayLine this should not happen"); }
virtual void getRGBLine(Guchar * /*in*/, unsigned int * /*out*/, int /*length*/) { error(errInternal, -1, "GfxColorSpace::getRGBLine (first variant) this should not happen"); }
virtual void getRGBLine(Guchar * /*in*/, Guchar * /*out*/, int /*length*/) { error(errInternal, -1, "GfxColorSpace::getRGBLine (second variant) this should not happen"); }
@@ -243,16 +243,16 @@ public:
virtual void createMapping(GooList *separationList, int maxSepComps);
// Does this ColorSpace support getRGBLine?
- virtual GBool useGetRGBLine() { return gFalse; }
+ virtual GBool useGetRGBLine() const { return gFalse; }
// Does this ColorSpace support getGrayLine?
- virtual GBool useGetGrayLine() { return gFalse; }
+ virtual GBool useGetGrayLine() const { return gFalse; }
// Does this ColorSpace support getCMYKLine?
- virtual GBool useGetCMYKLine() { return gFalse; }
+ virtual GBool useGetCMYKLine() const { return gFalse; }
// Does this ColorSpace support getDeviceNLine?
- virtual GBool useGetDeviceNLine() { return gFalse; }
+ virtual GBool useGetDeviceNLine() const { return gFalse; }
// Return the number of color components.
- virtual int getNComps() = 0;
+ virtual int getNComps() const = 0;
// Get this color space's default color.
virtual void getDefaultColor(GfxColor *color) = 0;
@@ -264,7 +264,7 @@ public:
// Returns true if painting operations in this color space never
// mark the page (e.g., the "None" colorant).
- virtual GBool isNonMarking() { return gFalse; }
+ virtual GBool isNonMarking() const { return gFalse; }
// Return the color space's overprint mask.
Guint getOverprintMask() const { return overprintMask; }
@@ -303,10 +303,10 @@ public:
GfxColorSpace *copy() override;
GfxColorSpaceMode getMode() override { return csDeviceGray; }
- void getGray(GfxColor *color, GfxGray *gray) override;
- void getRGB(GfxColor *color, GfxRGB *rgb) override;
- void getCMYK(GfxColor *color, GfxCMYK *cmyk) override;
- void getDeviceN(GfxColor *color, GfxColor *deviceN) override;
+ void getGray(const GfxColor *color, GfxGray *gray) const override;
+ void getRGB(const GfxColor *color, GfxRGB *rgb) const override;
+ void getCMYK(const GfxColor *color, GfxCMYK *cmyk) const override;
+ void getDeviceN(const GfxColor *color, GfxColor *deviceN) const override;
void getGrayLine(Guchar *in, Guchar *out, int length) override;
void getRGBLine(Guchar *in, unsigned int *out, int length) override;
void getRGBLine(Guchar *in, Guchar *out, int length) override;
@@ -314,12 +314,12 @@ public:
void getCMYKLine(Guchar *in, Guchar *out, int length) override;
void getDeviceNLine(Guchar *in, Guchar *out, int length) override;
- GBool useGetRGBLine() override { return gTrue; }
- GBool useGetGrayLine() override { return gTrue; }
- GBool useGetCMYKLine() override { return gTrue; }
- GBool useGetDeviceNLine() override { return gTrue; }
+ GBool useGetRGBLine() const override { return gTrue; }
+ GBool useGetGrayLine() const override { return gTrue; }
+ GBool useGetCMYKLine() const override { return gTrue; }
+ GBool useGetDeviceNLine() const override { return gTrue; }
- int getNComps() override { return 1; }
+ int getNComps() const override { return 1; }
void getDefaultColor(GfxColor *color) override;
private:
@@ -340,12 +340,12 @@ public:
// Construct a CalGray color space. Returns NULL if unsuccessful.
static GfxColorSpace *parse(Array *arr, GfxState *state);
- void getGray(GfxColor *color, GfxGray *gray) override;
- void getRGB(GfxColor *color, GfxRGB *rgb) override;
- void getCMYK(GfxColor *color, GfxCMYK *cmyk) override;
- void getDeviceN(GfxColor *color, GfxColor *deviceN) override;
+ void getGray(const GfxColor *color, GfxGray *gray) const override;
+ void getRGB(const GfxColor *color, GfxRGB *rgb) const override;
+ void getCMYK(const GfxColor *color, GfxCMYK *cmyk) const override;
+ void getDeviceN(const GfxColor *color, GfxColor *deviceN) const override;
- int getNComps() override { return 1; }
+ int getNComps() const override { return 1; }
void getDefaultColor(GfxColor *color) override;
// CalGray-specific access.
@@ -363,7 +363,7 @@ private:
double blackX, blackY, blackZ; // black point
double gamma; // gamma value
double kr, kg, kb; // gamut mapping mulitpliers
- void getXYZ(GfxColor *color, double *pX, double *pY, double *pZ);
+ void getXYZ(const GfxColor *color, double *pX, double *pY, double *pZ) const;
#ifdef USE_CMS
GfxColorTransform *transform;
#endif
@@ -381,10 +381,10 @@ public:
GfxColorSpace *copy() override;
GfxColorSpaceMode getMode() override { return csDeviceRGB; }
- void getGray(GfxColor *color, GfxGray *gray) override;
- void getRGB(GfxColor *color, GfxRGB *rgb) override;
- void getCMYK(GfxColor *color, GfxCMYK *cmyk) override;
- void getDeviceN(GfxColor *color, GfxColor *deviceN) override;
+ void getGray(const GfxColor *color, GfxGray *gray) const override;
+ void getRGB(const GfxColor *color, GfxRGB *rgb) const override;
+ void getCMYK(const GfxColor *color, GfxCMYK *cmyk) const override;
+ void getDeviceN(const GfxColor *color, GfxColor *deviceN) const override;
void getGrayLine(Guchar *in, Guchar *out, int length) override;
void getRGBLine(Guchar *in, unsigned int *out, int length) override;
void getRGBLine(Guchar *in, Guchar *out, int length) override;
@@ -392,12 +392,12 @@ public:
void getCMYKLine(Guchar *in, Guchar *out, int length) override;
void getDeviceNLine(Guchar *in, Guchar *out, int length) override;
- GBool useGetRGBLine() override { return gTrue; }
- GBool useGetGrayLine() override { return gTrue; }
- GBool useGetCMYKLine() override { return gTrue; }
- GBool useGetDeviceNLine() override { return gTrue; }
+ GBool useGetRGBLine() const override { return gTrue; }
+ GBool useGetGrayLine() const override { return gTrue; }
+ GBool useGetCMYKLine() const override { return gTrue; }
+ GBool useGetDeviceNLine() const override { return gTrue; }
- int getNComps() override { return 3; }
+ int getNComps() const override { return 3; }
void getDefaultColor(GfxColor *color) override;
private:
@@ -418,25 +418,25 @@ public:
// Construct a CalRGB color space. Returns NULL if unsuccessful.
static GfxColorSpace *parse(Array *arr, GfxState *state);
- void getGray(GfxColor *color, GfxGray *gray) override;
- void getRGB(GfxColor *color, GfxRGB *rgb) override;
- void getCMYK(GfxColor *color, GfxCMYK *cmyk) override;
- void getDeviceN(GfxColor *color, GfxColor *deviceN) override;
+ void getGray(const GfxColor *color, GfxGray *gray) const override;
+ void getRGB(const GfxColor *color, GfxRGB *rgb) const override;
+ void getCMYK(const GfxColor *color, GfxCMYK *cmyk) const override;
+ void getDeviceN(const GfxColor *color, GfxColor *deviceN) const override;
- int getNComps() override { return 3; }
+ int getNComps() const override { return 3; }
void getDefaultColor(GfxColor *color) override;
// CalRGB-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 getGammaR() { return gammaR; }
- double getGammaG() { return gammaG; }
- double getGammaB() { return gammaB; }
- double *getMatrix() { return mat; }
+ 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 getGammaR() const { return gammaR; }
+ double getGammaG() const { return gammaG; }
+ double getGammaB() const { return gammaB; }
+ const double *getMatrix() const { return mat; }
private:
@@ -445,7 +445,7 @@ private:
double gammaR, gammaG, gammaB; // gamma values
double mat[9]; // ABC -> XYZ transform matrix
double kr, kg, kb; // gamut mapping mulitpliers
- void getXYZ(GfxColor *color, double *pX, double *pY, double *pZ);
+ void getXYZ(const GfxColor *color, double *pX, double *pY, double *pZ) const;
#ifdef USE_CMS
GfxColorTransform *transform;
#endif
@@ -463,20 +463,20 @@ public:
GfxColorSpace *copy() override;
GfxColorSpaceMode getMode() override { return csDeviceCMYK; }
- void getGray(GfxColor *color, GfxGray *gray) override;
- void getRGB(GfxColor *color, GfxRGB *rgb) override;
- void getCMYK(GfxColor *color, GfxCMYK *cmyk) override;
- void getDeviceN(GfxColor *color, GfxColor *deviceN) override;
+ void getGray(const GfxColor *color, GfxGray *gray) const override;
+ void getRGB(const GfxColor *color, GfxRGB *rgb) const override;
+ void getCMYK(const GfxColor *color, GfxCMYK *cmyk) const override;
+ void getDeviceN(const GfxColor *color, GfxColor *deviceN) const override;
void getRGBLine(Guchar *in, unsigned int *out, int length) override;
void getRGBLine(Guchar *, Guchar *out, int length) override;
void getRGBXLine(Guchar *in, Guchar *out, int length) override;
void getCMYKLine(Guchar *in, Guchar *out, int length) override;
void getDeviceNLine(Guchar *in, Guchar *out, int length) override;
- GBool useGetRGBLine() override { return gTrue; }
- GBool useGetCMYKLine() override { return gTrue; }
- GBool useGetDeviceNLine() override { return gTrue; }
+ GBool useGetRGBLine() const override { return gTrue; }
+ GBool useGetCMYKLine() const override { return gTrue; }
+ GBool useGetDeviceNLine() const override { return gTrue; }
- int getNComps() override { return 4; }
+ int getNComps() const override { return 4; }
void getDefaultColor(GfxColor *color) override;
private:
@@ -497,12 +497,12 @@ public:
// Construct a Lab color space. Returns NULL if unsuccessful.
static GfxColorSpace *parse(Array *arr, GfxState *state);
- void getGray(GfxColor *color, GfxGray *gray) override;
- void getRGB(GfxColor *color, GfxRGB *rgb) override;
- void getCMYK(GfxColor *color, GfxCMYK *cmyk) override;
- void getDeviceN(GfxColor *color, GfxColor *deviceN) override;
+ void getGray(const GfxColor *color, GfxGray *gray) const override;
+ void getRGB(const GfxColor *color, GfxRGB *rgb) const override;
+ void getCMYK(const GfxColor *color, GfxCMYK *cmyk) const override;
+ void getDeviceN(const GfxColor *color, GfxColor *deviceN) const override;
- int getNComps() override { return 3; }
+ int getNComps() const override { return 3; }
void getDefaultColor(GfxColor *color) override;
void getDefaultRanges(double *decodeLow, double *decodeRange,
@@ -526,7 +526,7 @@ private:
double blackX, blackY, blackZ; // black point
double aMin, aMax, bMin, bMax; // range for the a and b components
double kr, kg, kb; // gamut mapping mulitpliers
- void getXYZ(GfxColor *color, double *pX, double *pY, double *pZ);
+ void getXYZ(const GfxColor *color, double *pX, double *pY, double *pZ) const;
#ifdef USE_CMS
GfxColorTransform *transform;
#endif
@@ -548,21 +548,21 @@ public:
// Construct an ICCBased color space. Returns NULL if unsuccessful.
static GfxColorSpace *parse(Array *arr, OutputDev *out, GfxState *state, int recursion);
- void getGray(GfxColor *color, GfxGray *gray) override;
- void getRGB(GfxColor *color, GfxRGB *rgb) override;
- void getCMYK(GfxColor *color, GfxCMYK *cmyk) override;
- void getDeviceN(GfxColor *color, GfxColor *deviceN) override;
+ void getGray(const GfxColor *color, GfxGray *gray) const override;
+ void getRGB(const GfxColor *color, GfxRGB *rgb) const override;
+ void getCMYK(const GfxColor *color, GfxCMYK *cmyk) const override;
+ void getDeviceN(const GfxColor *color, GfxColor *deviceN) const override;
void getRGBLine(Guchar *in, unsigned int *out, int length) override;
void getRGBLine(Guchar *in, Guchar *out, int length) override;
void getRGBXLine(Guchar *in, Guchar *out, int length) override;
void getCMYKLine(Guchar *in, Guchar *out, int length) override;
void getDeviceNLine(Guchar *in, Guchar *out, int length) override;
- GBool useGetRGBLine() override;
- GBool useGetCMYKLine() override;
- GBool useGetDeviceNLine() override;
+ GBool useGetRGBLine() const override;
+ GBool useGetCMYKLine() const override;
+ GBool useGetDeviceNLine() const override;
- int getNComps() override { return nComps; }
+ int getNComps() const override { return nComps; }
void getDefaultColor(GfxColor *color) override;
void getDefaultRanges(double *decodeLow, double *decodeRange,
@@ -582,7 +582,7 @@ private:
int getIntent() { return (transform != NULL) ? transform->getIntent() : 0; }
GfxColorTransform *transform;
GfxColorTransform *lineTransform; // color transform for line
- std::map<unsigned int, unsigned int> cmsCache;
+ mutable std::map<unsigned int, unsigned int> cmsCache;
#endif
};
//------------------------------------------------------------------------
@@ -600,21 +600,21 @@ public:
// Construct an Indexed color space. Returns NULL if unsuccessful.
static GfxColorSpace *parse(GfxResources *res, Array *arr, OutputDev *out, GfxState *state, int recursion);
- void getGray(GfxColor *color, GfxGray *gray) override;
- void getRGB(GfxColor *color, GfxRGB *rgb) override;
- void getCMYK(GfxColor *color, GfxCMYK *cmyk) override;
- void getDeviceN(GfxColor *color, GfxColor *deviceN) override;
+ void getGray(const GfxColor *color, GfxGray *gray) const override;
+ void getRGB(const GfxColor *color, GfxRGB *rgb) const override;
+ void getCMYK(const GfxColor *color, GfxCMYK *cmyk) const override;
+ void getDeviceN(const GfxColor *color, GfxColor *deviceN) const override;
void getRGBLine(Guchar *in, unsigned int *out, int length) override;
void getRGBLine(Guchar *in, Guchar *out, int length) override;
void getRGBXLine(Guchar *in, Guchar *out, int length) override;
void getCMYKLine(Guchar *in, Guchar *out, int length) override;
void getDeviceNLine(Guchar *in, Guchar *out, int length) override;
- GBool useGetRGBLine() override { return gTrue; }
- GBool useGetCMYKLine() override { return gTrue; }
- GBool useGetDeviceNLine() override { return gTrue; }
+ GBool useGetRGBLine() const override { return gTrue; }
+ GBool useGetCMYKLine() const override { return gTrue; }
+ GBool useGetDeviceNLine() const override { return gTrue; }
- int getNComps() override { return 1; }
+ int getNComps() const override { return 1; }
void getDefaultColor(GfxColor *color) override;
void getDefaultRanges(double *decodeLow, double *decodeRange,
@@ -624,7 +624,7 @@ public:
GfxColorSpace *getBase() { return base; }
int getIndexHigh() { return indexHigh; }
Guchar *getLookup() { return lookup; }
- GfxColor *mapColorToBase(GfxColor *color, GfxColor *baseColor);
+ GfxColor *mapColorToBase(const GfxColor *color, GfxColor *baseColor) const;
Guint getOverprintMask() { return base->getOverprintMask(); }
void createMapping(GooList *separationList, int maxSepComps) override
{ base->createMapping(separationList, maxSepComps); }
@@ -653,22 +653,22 @@ public:
// Construct a Separation color space. Returns NULL if unsuccessful.
static GfxColorSpace *parse(GfxResources *res, Array *arr, OutputDev *out, GfxState *state, int recursion);
- void getGray(GfxColor *color, GfxGray *gray) override;
- void getRGB(GfxColor *color, GfxRGB *rgb) override;
- void getCMYK(GfxColor *color, GfxCMYK *cmyk) override;
- void getDeviceN(GfxColor *color, GfxColor *deviceN) override;
+ void getGray(const GfxColor *color, GfxGray *gray) const override;
+ void getRGB(const GfxColor *color, GfxRGB *rgb) const override;
+ void getCMYK(const GfxColor *color, GfxCMYK *cmyk) const override;
+ void getDeviceN(const GfxColor *color, GfxColor *deviceN) const override;
void createMapping(GooList *separationList, int maxSepComps) override;
- int getNComps() override { return 1; }
+ int getNComps() const override { return 1; }
void getDefaultColor(GfxColor *color) override;
- GBool isNonMarking() override { return nonMarking; }
+ GBool isNonMarking() const override { return nonMarking; }
// Separation-specific access.
GooString *getName() { return name; }
GfxColorSpace *getAlt() { return alt; }
- Function *getFunc() { return func; }
+ const Function *getFunc() const { return func; }
private:
@@ -698,20 +698,20 @@ public:
// Construct a DeviceN color space. Returns NULL if unsuccessful.
static GfxColorSpace *parse(GfxResources *res, Array *arr, OutputDev *out, GfxState *state, int recursion);
- void getGray(GfxColor *color, GfxGray *gray) override;
- void getRGB(GfxColor *color, GfxRGB *rgb) override;
- void getCMYK(GfxColor *color, GfxCMYK *cmyk) override;
- void getDeviceN(GfxColor *color, GfxColor *deviceN) override;
+ void getGray(const GfxColor *color, GfxGray *gray) const override;
+ void getRGB(const GfxColor *color, GfxRGB *rgb) const override;
+ void getCMYK(const GfxColor *color, GfxCMYK *cmyk) const override;
+ void getDeviceN(const GfxColor *color, GfxColor *deviceN) const override;
void createMapping(GooList *separationList, int maxSepComps) override;
- int getNComps() override { return nComps; }
+ int getNComps() const override { return nComps; }
void getDefaultColor(GfxColor *color) override;
- GBool isNonMarking() override { return nonMarking; }
+ GBool isNonMarking() const override { return nonMarking; }
// DeviceN-specific access.
- GooString *getColorantName(int i) { return names[i]; }
+ const GooString *getColorantName(int i) const { return names[i]; }
GfxColorSpace *getAlt() { return alt; }
Function *getTintTransformFunc() { return func; }
@@ -745,12 +745,12 @@ public:
// Construct a Pattern color space. Returns NULL if unsuccessful.
static GfxColorSpace *parse(GfxResources *res, Array *arr, OutputDev *out, GfxState *state, int recursion);
- void getGray(GfxColor *color, GfxGray *gray) override;
- void getRGB(GfxColor *color, GfxRGB *rgb) override;
- void getCMYK(GfxColor *color, GfxCMYK *cmyk) override;
- void getDeviceN(GfxColor *color, GfxColor *deviceN) override;
+ void getGray(const GfxColor *color, GfxGray *gray) const override;
+ void getRGB(const GfxColor *color, GfxRGB *rgb) const override;
+ void getCMYK(const GfxColor *color, GfxCMYK *cmyk) const override;
+ void getDeviceN(const GfxColor *color, GfxColor *deviceN) const override;
- int getNComps() override { return 0; }
+ int getNComps() const override { return 0; }
void getDefaultColor(GfxColor *color) override;
// Pattern-specific access.
@@ -779,7 +779,7 @@ public:
virtual GfxPattern *copy() = 0;
- int getType() { return type; }
+ int getType() const { return type; }
int getPatternRefNum() const { return patternRefNum; }
@@ -801,14 +801,14 @@ public:
GfxPattern *copy() override;
- int getPaintType() { return paintType; }
- int getTilingType() { return tilingType; }
- double *getBBox() { return bbox; }
- double getXStep() { return xStep; }
- double getYStep() { return yStep; }
+ int getPaintType() const { return paintType; }
+ int getTilingType() const { return tilingType; }
+ const double *getBBox() const { return bbox; }
+ double getXStep() const { return xStep; }
+ double getYStep() const { return yStep; }
Dict *getResDict()
{ return resDict.isDict() ? resDict.getDict() : (Dict *)NULL; }
- double *getMatrix() { return matrix; }
+ const double *getMatrix() const { return matrix; }
Object *getContentStream() { return &contentStream; }
private:
@@ -840,7 +840,7 @@ public:
GfxPattern *copy() override;
GfxShading *getShading() { return shading; }
- double *getMatrix() { return matrix; }
+ const double *getMatrix() const { return matrix; }
private:
@@ -868,13 +868,13 @@ public:
virtual GfxShading *copy() = 0;
- int getType() { return type; }
+ int getType() const { return type; }
GfxColorSpace *getColorSpace() { return colorSpace; }
- GfxColor *getBackground() { return &background; }
- GBool getHasBackground() { return hasBackground; }
- void getBBox(double *xMinA, double *yMinA, double *xMaxA, double *yMaxA)
+ const GfxColor *getBackground() const { return &background; }
+ GBool getHasBackground() const { return hasBackground; }
+ void getBBox(double *xMinA, double *yMinA, double *xMaxA, double *yMaxA) const
{ *xMinA = xMin; *yMinA = yMin; *xMaxA = xMax; *yMaxA = yMax; }
- GBool getHasBBox() { return hasBBox; }
+ GBool getHasBBox() const { return hasBBox; }
protected:
@@ -909,12 +909,12 @@ public:
GfxUnivariateShading(GfxUnivariateShading *shading);
~GfxUnivariateShading();
- double getDomain0() { return t0; }
- double getDomain1() { return t1; }
- GBool getExtend0() { return extend0; }
- GBool getExtend1() { return extend1; }
- int getNFuncs() { return nFuncs; }
- Function *getFunc(int i) { return funcs[i]; }
+ double getDomain0() const { return t0; }
+ double getDomain1() const { return t1; }
+ GBool getExtend0() const { return extend0; }
+ GBool getExtend1() const { return extend1; }
+ int getNFuncs() const { return nFuncs; }
+ const Function *getFunc(int i) const { return funcs[i]; }
// returns the nComps of the shading
// i.e. how many positions of color have been set
int getColor(double t, GfxColor *color);
@@ -960,12 +960,12 @@ public:
GfxShading *copy() override;
- void getDomain(double *x0A, double *y0A, double *x1A, double *y1A)
+ void getDomain(double *x0A, double *y0A, double *x1A, double *y1A) const
{ *x0A = x0; *y0A = y0; *x1A = x1; *y1A = y1; }
- double *getMatrix() { return matrix; }
- int getNFuncs() { return nFuncs; }
- Function *getFunc(int i) { return funcs[i]; }
- void getColor(double x, double y, GfxColor *color);
+ const double *getMatrix() const { return matrix; }
+ int getNFuncs() const { return nFuncs; }
+ const Function *getFunc(int i) const { return funcs[i]; }
+ void getColor(double x, double y, GfxColor *color) const;
private:
@@ -994,7 +994,7 @@ public:
GfxShading *copy() override;
- void getCoords(double *x0A, double *y0A, double *x1A, double *y1A)
+ void getCoords(double *x0A, double *y0A, double *x1A, double *y1A) const
{ *x0A = x0; *y0A = y0; *x1A = x1; *y1A = y1; }
void getParameterRange(double *lower, double *upper,
@@ -1028,7 +1028,7 @@ public:
GfxShading *copy() override;
void getCoords(double *x0A, double *y0A, double *r0A,
- double *x1A, double *y1A, double *r1A)
+ double *x1A, double *y1A, double *r1A) const
{ *x0A = x0; *y0A = y0; *r0A = r0; *x1A = x1; *y1A = y1; *r1A = r1; }
void getParameterRange(double *lower, double *upper,
@@ -1065,7 +1065,7 @@ public:
GfxShading *copy() override;
- int getNTriangles() { return nTriangles; }
+ int getNTriangles() const { return nTriangles; }
bool isParameterized() const { return nFuncs > 0; }
@@ -1095,7 +1095,7 @@ public:
double *x1, double *y1, double *color1,
double *x2, double *y2, double *color2);
- void getParameterizedColor(double t, GfxColor *color);
+ void getParameterizedColor(double t, GfxColor *color) const;
private:
@@ -1151,8 +1151,8 @@ public:
GfxShading *copy() override;
- int getNPatches() { return nPatches; }
- GfxPatch *getPatch(int i) { return &patches[i]; }
+ int getNPatches() const { return nPatches; }
+ const GfxPatch *getPatch(int i) const { return &patches[i]; }
bool isParameterized() const { return nFuncs > 0; }
@@ -1166,7 +1166,7 @@ public:
*/
double getParameterDomainMax() const { assert(isParameterized()); return funcs[0]->getDomainMax(0); }
- void getParameterizedColor(double t, GfxColor *color);
+ void getParameterizedColor(double t, GfxColor *color) const;
private:
@@ -1196,22 +1196,22 @@ public:
GfxImageColorMap *copy() { return new GfxImageColorMap(this); }
// Is color map valid?
- GBool isOk() { return ok; }
+ GBool isOk() const { return ok; }
// Get the color space.
GfxColorSpace *getColorSpace() { return colorSpace; }
// Get stream decoding info.
- int getNumPixelComps() { return nComps; }
- int getBits() { return bits; }
+ int getNumPixelComps() const { return nComps; }
+ int getBits() const { return bits; }
// Get decode table.
- double getDecodeLow(int i) { return decodeLow[i]; }
- double getDecodeHigh(int i) { return decodeLow[i] + decodeRange[i]; }
+ double getDecodeLow(int i) const { return decodeLow[i]; }
+ double getDecodeHigh(int i) const { return decodeLow[i] + decodeRange[i]; }
- bool useRGBLine() { return (colorSpace2 && colorSpace2->useGetRGBLine ()) || (!colorSpace2 && colorSpace->useGetRGBLine ()); }
- bool useCMYKLine() { return (colorSpace2 && colorSpace2->useGetCMYKLine ()) || (!colorSpace2 && colorSpace->useGetCMYKLine ()); }
- bool useDeviceNLine() { return (colorSpace2 && colorSpace2->useGetDeviceNLine ()) || (!colorSpace2 && colorSpace->useGetDeviceNLine ()); }
+ bool useRGBLine() const { return (colorSpace2 && colorSpace2->useGetRGBLine ()) || (!colorSpace2 && colorSpace->useGetRGBLine ()); }
+ bool useCMYKLine() const { return (colorSpace2 && colorSpace2->useGetCMYKLine ()) || (!colorSpace2 && colorSpace->useGetCMYKLine ()); }
+ bool useDeviceNLine() const { return (colorSpace2 && colorSpace2->useGetDeviceNLine ()) || (!colorSpace2 && colorSpace->useGetDeviceNLine ()); }
// Convert an image pixel to a color.
void getGray(Guchar *x, GfxGray *gray);
@@ -1227,8 +1227,8 @@ public:
void getColor(Guchar *x, GfxColor *color);
// Matte color ops
- void setMatteColor(GfxColor *color) { useMatte = gTrue; matteColor = *color; }
- GfxColor *getMatteColor() { return (useMatte) ? &matteColor : NULL; }
+ void setMatteColor(const GfxColor *color) { useMatte = gTrue; matteColor = *color; }
+ const GfxColor *getMatteColor() const { return (useMatte) ? &matteColor : NULL; }
private:
GfxImageColorMap(GfxImageColorMap *colorMap);
@@ -1269,20 +1269,20 @@ public:
GfxSubpath& operator=(const GfxSubpath &) = delete;
// Copy.
- GfxSubpath *copy() { return new GfxSubpath(this); }
+ GfxSubpath *copy() const { return new GfxSubpath(this); }
// Get points.
- int getNumPoints() { return n; }
- double getX(int i) { return x[i]; }
- double getY(int i) { return y[i]; }
- GBool getCurve(int i) { return curve[i]; }
+ int getNumPoints() const { return n; }
+ double getX(int i) const { return x[i]; }
+ double getY(int i) const { return y[i]; }
+ GBool getCurve(int i) const { return curve[i]; }
void setX(int i, double a) { x[i] = a; }
void setY(int i, double a) { y[i] = a; }
// Get last point.
- double getLastX() { return x[n-1]; }
- double getLastY() { return y[n-1]; }
+ double getLastX() const { return x[n-1]; }
+ double getLastY() const { return y[n-1]; }
// Add a line segment.
void lineTo(double x1, double y1);
@@ -1293,7 +1293,7 @@ public:
// Close the subpath.
void close();
- GBool isClosed() { return closed; }
+ GBool isClosed() const { return closed; }
// Add (<dx>, <dy>) to each point in the subpath.
void offset(double dx, double dy);
@@ -1307,7 +1307,7 @@ private:
int size; // size of x/y arrays
GBool closed; // set if path is closed
- GfxSubpath(GfxSubpath *subpath);
+ GfxSubpath(const GfxSubpath *subpath);
};
class GfxPath {
@@ -1323,22 +1323,22 @@ public:
GfxPath& operator=(const GfxPath &) = delete;
// Copy.
- GfxPath *copy()
+ GfxPath *copy() const
{ return new GfxPath(justMoved, firstX, firstY, subpaths, n, size); }
// Is there a current point?
- GBool isCurPt() { return n > 0 || justMoved; }
+ GBool isCurPt() const { return n > 0 || justMoved; }
// Is the path non-empty, i.e., is there at least one segment?
- GBool isPath() { return n > 0; }
+ GBool isPath() const { return n > 0; }
// Get subpaths.
- int getNumSubpaths() { return n; }
+ int getNumSubpaths() const { return n; }
GfxSubpath *getSubpath(int i) { return subpaths[i]; }
// Get last point on last subpath.
- double getLastX() { return subpaths[n-1]->getLastX(); }
- double getLastY() { return subpaths[n-1]->getLastY(); }
+ double getLastX() const { return subpaths[n-1]->getLastX(); }
+ double getLastY() const { return subpaths[n-1]->getLastY(); }
// Move the current point.
void moveTo(double x, double y);
@@ -1436,7 +1436,7 @@ public:
// Construct a default GfxState, for a device with resolution <hDPI>
// x <vDPI>, page box <pageBox>, page rotation <rotateA>, and
// coordinate system specified by <upsideDown>.
- GfxState(double hDPIA, double vDPIA, PDFRectangle *pageBox,
+ GfxState(double hDPIA, double vDPIA, const PDFRectangle *pageBox,
int rotateA, GBool upsideDown);
// Destructor.
@@ -1446,30 +1446,30 @@ public:
GfxState& operator=(const GfxState &) = delete;
// Copy.
- GfxState *copy(GBool copyPath = gFalse)
+ GfxState *copy(GBool copyPath = gFalse) const
{ return new GfxState(this, copyPath); }
// Accessors.
- double getHDPI() { return hDPI; }
- double getVDPI() { return vDPI; }
- double *getCTM() { return ctm; }
- void getCTM(Matrix *m) { memcpy (m->m, ctm, sizeof m->m); }
- double getX1() { return px1; }
- double getY1() { return py1; }
- double getX2() { return px2; }
- double getY2() { return py2; }
- double getPageWidth() { return pageWidth; }
- double getPageHeight() { return pageHeight; }
- int getRotate() { return rotate; }
- GfxColor *getFillColor() { return &fillColor; }
- GfxColor *getStrokeColor() { return &strokeColor; }
+ double getHDPI() const { return hDPI; }
+ double getVDPI() const { return vDPI; }
+ const double *getCTM() const { return ctm; }
+ void getCTM(Matrix *m) const { memcpy (m->m, ctm, sizeof m->m); }
+ double getX1() const { return px1; }
+ double getY1() const { return py1; }
+ double getX2() const { return px2; }
+ double getY2() const { return py2; }
+ double getPageWidth() const { return pageWidth; }
+ double getPageHeight() const { return pageHeight; }
+ int getRotate() const { return rotate; }
+ const GfxColor *getFillColor() const { return &fillColor; }
+ const GfxColor *getStrokeColor() const { return &strokeColor; }
void getFillGray(GfxGray *gray)
{ fillColorSpace->getGray(&fillColor, gray); }
void getStrokeGray(GfxGray *gray)
{ strokeColorSpace->getGray(&strokeColor, gray); }
- void getFillRGB(GfxRGB *rgb)
+ void getFillRGB(GfxRGB *rgb) const
{ fillColorSpace->getRGB(&fillColor, rgb); }
- void getStrokeRGB(GfxRGB *rgb)
+ void getStrokeRGB(GfxRGB *rgb) const
{ strokeColorSpace->getRGB(&strokeColor, rgb); }
void getFillCMYK(GfxCMYK *cmyk)
{ fillColorSpace->getCMYK(&fillColor, cmyk); }
@@ -1483,46 +1483,46 @@ public:
GfxColorSpace *getStrokeColorSpace() { return strokeColorSpace; }
GfxPattern *getFillPattern() { return fillPattern; }
GfxPattern *getStrokePattern() { return strokePattern; }
- GfxBlendMode getBlendMode() { return blendMode; }
- double getFillOpacity() { return fillOpacity; }
- double getStrokeOpacity() { return strokeOpacity; }
- GBool getFillOverprint() { return fillOverprint; }
- GBool getStrokeOverprint() { return strokeOverprint; }
- int getOverprintMode() { return overprintMode; }
+ GfxBlendMode getBlendMode() const { return blendMode; }
+ double getFillOpacity() const { return fillOpacity; }
+ double getStrokeOpacity() const { return strokeOpacity; }
+ GBool getFillOverprint() const { return fillOverprint; }
+ GBool getStrokeOverprint() const { return strokeOverprint; }
+ int getOverprintMode() const { return overprintMode; }
Function **getTransfer() { return transfer; }
- double getLineWidth() { return lineWidth; }
+ double getLineWidth() const { return lineWidth; }
void getLineDash(double **dash, int *length, double *start)
{ *dash = lineDash; *length = lineDashLength; *start = lineDashStart; }
- int getFlatness() { return flatness; }
- int getLineJoin() { return lineJoin; }
- int getLineCap() { return lineCap; }
- double getMiterLimit() { return miterLimit; }
- GBool getStrokeAdjust() { return strokeAdjust; }
- GBool getAlphaIsShape() { return alphaIsShape; }
- GBool getTextKnockout() { return textKnockout; }
+ int getFlatness() const { return flatness; }
+ int getLineJoin() const { return lineJoin; }
+ int getLineCap() const { return lineCap; }
+ double getMiterLimit() const { return miterLimit; }
+ GBool getStrokeAdjust() const { return strokeAdjust; }
+ GBool getAlphaIsShape() const { return alphaIsShape; }
+ GBool getTextKnockout() const { return textKnockout; }
GfxFont *getFont() { return font; }
- double getFontSize() { return fontSize; }
- double *getTextMat() { return textMat; }
- double getCharSpace() { return charSpace; }
- double getWordSpace() { return wordSpace; }
- double getHorizScaling() { return horizScaling; }
- double getLeading() { return leading; }
- double getRise() { return rise; }
- int getRender() { return render; }
+ double getFontSize() const { return fontSize; }
+ const double *getTextMat() const { return textMat; }
+ double getCharSpace() const { return charSpace; }
+ double getWordSpace() const { return wordSpace; }
+ double getHorizScaling() const { return horizScaling; }
+ double getLeading() const { return leading; }
+ double getRise() const { return rise; }
+ int getRender() const { return render; }
char *getRenderingIntent() { return renderingIntent; }
GfxPath *getPath() { return path; }
void setPath(GfxPath *pathA);
- double getCurX() { return curX; }
- double getCurY() { return curY; }
+ double getCurX() const { return curX; }
+ double getCurY() const { return curY; }
void getClipBBox(double *xMin, double *yMin, double *xMax, double *yMax)
{ *xMin = clipXMin; *yMin = clipYMin; *xMax = clipXMax; *yMax = clipYMax; }
void getUserClipBBox(double *xMin, double *yMin, double *xMax, double *yMax);
- double getLineX() { return lineX; }
- double getLineY() { return lineY; }
+ double getLineX() const { return lineX; }
+ double getLineY() const { return lineY; }
// Is there a current point/path?
- GBool isCurPt() { return path->isCurPt(); }
- GBool isPath() { return path->isPath(); }
+ GBool isCurPt() const { return path->isCurPt(); }
+ GBool isPath() const { return path->isPath(); }
// Transforms.
void transform(double x1, double y1, double *x2, double *y2)
@@ -1551,8 +1551,8 @@ public:
void shiftCTMAndClip(double tx, double ty);
void setFillColorSpace(GfxColorSpace *colorSpace);
void setStrokeColorSpace(GfxColorSpace *colorSpace);
- void setFillColor(GfxColor *color) { fillColor = *color; }
- void setStrokeColor(GfxColor *color) { strokeColor = *color; }
+ void setFillColor(const GfxColor *color) { fillColor = *color; }
+ void setStrokeColor(const GfxColor *color) { strokeColor = *color; }
void setFillPattern(GfxPattern *pattern);
void setStrokePattern(GfxPattern *pattern);
void setBlendMode(GfxBlendMode mode) { blendMode = mode; }
@@ -1624,7 +1624,7 @@ public:
// Push/pop GfxState on/off stack.
GfxState *save();
GfxState *restore();
- GBool hasSaves() { return saved != NULL; }
+ GBool hasSaves() const { return saved != NULL; }
GBool isParentState(GfxState *state) { return saved == state || (saved && saved->isParentState(state)); }
// Misc
@@ -1688,7 +1688,7 @@ private:
GfxState *saved; // next GfxState on stack
- GfxState(GfxState *state, GBool copyPath);
+ GfxState(const GfxState *state, GBool copyPath);
#ifdef USE_CMS
void *localDisplayProfile;
diff --git a/poppler/MarkedContentOutputDev.cc b/poppler/MarkedContentOutputDev.cc
index ddaa2d80..a1f89c7a 100644
--- a/poppler/MarkedContentOutputDev.cc
+++ b/poppler/MarkedContentOutputDev.cc
@@ -96,7 +96,7 @@ void MarkedContentOutputDev::endMarkedContent(GfxState *state)
}
-bool MarkedContentOutputDev::needFontChange(GfxFont* font) const
+bool MarkedContentOutputDev::needFontChange(const GfxFont* font) const
{
if (currentFont == font)
return gFalse;
diff --git a/poppler/MarkedContentOutputDev.h b/poppler/MarkedContentOutputDev.h
index a1b1178c..103e859a 100644
--- a/poppler/MarkedContentOutputDev.h
+++ b/poppler/MarkedContentOutputDev.h
@@ -118,7 +118,7 @@ private:
void endSpan();
bool inMarkedContent() const { return mcidStack.size() > 0; }
- bool needFontChange(GfxFont* font) const;
+ bool needFontChange(const GfxFont* font) const;
GfxFont *currentFont;
GooString *currentText;
diff --git a/poppler/OutputDev.cc b/poppler/OutputDev.cc
index 1a59d9e8..8449f9ef 100644
--- a/poppler/OutputDev.cc
+++ b/poppler/OutputDev.cc
@@ -42,7 +42,7 @@
// OutputDev
//------------------------------------------------------------------------
-void OutputDev::setDefaultCTM(double *ctm) {
+void OutputDev::setDefaultCTM(const double *ctm) {
int i;
double det;
diff --git a/poppler/OutputDev.h b/poppler/OutputDev.h
index 0a769307..48b6a8a0 100644
--- a/poppler/OutputDev.h
+++ b/poppler/OutputDev.h
@@ -132,7 +132,7 @@ public:
//----- initialization and control
// Set default transform matrix.
- virtual void setDefaultCTM(double *ctm);
+ virtual void setDefaultCTM(const double *ctm);
// Check to see if a page slice should be displayed. If this
// returns false, the page display is aborted. Typically, an
@@ -163,8 +163,8 @@ public:
virtual void cvtDevToUser(double dx, double dy, double *ux, double *uy);
virtual void cvtUserToDev(double ux, double uy, int *dx, int *dy);
- double *getDefCTM() { return defCTM; }
- double *getDefICTM() { return defICTM; }
+ const double *getDefCTM() const { return defCTM; }
+ const double *getDefICTM() const { return defICTM; }
//----- save/restore graphics state
virtual void saveState(GfxState * /*state*/) {}
@@ -222,8 +222,8 @@ public:
virtual void fill(GfxState * /*state*/) {}
virtual void eoFill(GfxState * /*state*/) {}
virtual GBool tilingPatternFill(GfxState * /*state*/, Gfx * /*gfx*/, Catalog * /*cat*/, Object * /*str*/,
- double * /*pmat*/, int /*paintType*/, int /*tilingType*/, Dict * /*resDict*/,
- double * /*mat*/, double * /*bbox*/,
+ 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*/)
{ return gFalse; }
@@ -354,13 +354,13 @@ public:
//----- transparency groups and soft masks
virtual GBool checkTransparencyGroup(GfxState * /*state*/, GBool /*knockout*/) { return gTrue; }
- virtual void beginTransparencyGroup(GfxState * /*state*/, double * /*bbox*/,
+ virtual void beginTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/,
GfxColorSpace * /*blendingColorSpace*/,
GBool /*isolated*/, GBool /*knockout*/,
GBool /*forSoftMask*/) {}
virtual void endTransparencyGroup(GfxState * /*state*/) {}
- virtual void paintTransparencyGroup(GfxState * /*state*/, double * /*bbox*/) {}
- virtual void setSoftMask(GfxState * /*state*/, double * /*bbox*/, GBool /*alpha*/,
+ virtual void paintTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/) {}
+ virtual void setSoftMask(GfxState * /*state*/, const double * /*bbox*/, GBool /*alpha*/,
Function * /*transferFunc*/, GfxColor * /*backdropColor*/) {}
virtual void clearSoftMask(GfxState * /*state*/) {}
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index c2bb2fbc..6d6e1950 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -889,7 +889,7 @@ int PDFDoc::savePageAs(GooString *name, int pageNo)
error(errInternal, -1, "Illegal pageNo: {0:d}({1:d})", pageNo, getNumPages() );
return errOpenFile;
}
- PDFRectangle *cropBox = nullptr;
+ const PDFRectangle *cropBox = nullptr;
if (getCatalog()->getPage(pageNo)->isCropped()) {
cropBox = getCatalog()->getPage(pageNo)->getCropBox();
}
@@ -1742,8 +1742,8 @@ void PDFDoc::markObject (Object* obj, XRef *xRef, XRef *countRef, Guint numOffse
}
void PDFDoc::replacePageDict(int pageNo, int rotate,
- PDFRectangle *mediaBox,
- PDFRectangle *cropBox)
+ const PDFRectangle *mediaBox,
+ const PDFRectangle *cropBox)
{
Ref *refPage = getCatalog()->getPageRef(pageNo);
Object page = getXRef()->fetch(refPage->num, refPage->gen);
diff --git a/poppler/PDFDoc.h b/poppler/PDFDoc.h
index 08b012b5..4165fbcf 100644
--- a/poppler/PDFDoc.h
+++ b/poppler/PDFDoc.h
@@ -334,7 +334,7 @@ public:
void *getGUIData() { return guiData; }
// rewrite pageDict with MediaBox, CropBox and new page CTM
- void replacePageDict(int pageNo, int rotate, PDFRectangle *mediaBox, PDFRectangle *cropBox);
+ void replacePageDict(int pageNo, int rotate, const PDFRectangle *mediaBox, const PDFRectangle *cropBox);
void markPageObjects(Dict *pageDict, XRef *xRef, XRef *countRef, Guint numOffset, int oldRefNum, int newRefNum, std::set<Dict*> *alreadyMarkedDicts = nullptr);
GBool markAnnotations(Object *annots, XRef *xRef, XRef *countRef, Guint numOffset, int oldPageNum, int newPageNum, std::set<Dict*> *alreadyMarkedDicts = nullptr);
void markAcroForm(Object *acrpForm, XRef *xRef, XRef *countRef, Guint numOffset, int oldPageNum, int newPageNum);
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 7ba28fc4..5d106c96 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1528,7 +1528,7 @@ PSOutputDev::~PSOutputDev() {
}
void PSOutputDev::writeHeader(const std::vector<int> &pages,
- PDFRectangle *mediaBox, PDFRectangle *cropBox,
+ const PDFRectangle *mediaBox, const PDFRectangle *cropBox,
int pageRotate, char *psTitle) {
PSOutPaperSize *size;
double x1, y1, x2, y2;
@@ -4073,7 +4073,6 @@ void PSOutputDev::updateStrokeColorSpace(GfxState *state) {
void PSOutputDev::updateFillColor(GfxState *state) {
GfxColor color;
- GfxColor *colorPtr;
GfxGray gray;
GfxCMYK cmyk;
GfxSeparationColorSpace *sepCS;
@@ -4091,7 +4090,7 @@ void PSOutputDev::updateFillColor(GfxState *state) {
case psLevel2:
case psLevel3:
if (state->getFillColorSpace()->getMode() != csPattern) {
- colorPtr = state->getFillColor();
+ const GfxColor *colorPtr = state->getFillColor();
writePS("[");
for (i = 0; i < state->getFillColorSpace()->getNComps(); ++i) {
if (i > 0) {
@@ -4131,7 +4130,6 @@ void PSOutputDev::updateFillColor(GfxState *state) {
void PSOutputDev::updateStrokeColor(GfxState *state) {
GfxColor color;
- GfxColor *colorPtr;
GfxGray gray;
GfxCMYK cmyk;
GfxSeparationColorSpace *sepCS;
@@ -4149,7 +4147,7 @@ void PSOutputDev::updateStrokeColor(GfxState *state) {
case psLevel2:
case psLevel3:
if (state->getStrokeColorSpace()->getMode() != csPattern) {
- colorPtr = state->getStrokeColor();
+ const GfxColor *colorPtr = state->getStrokeColor();
writePS("[");
for (i = 0; i < state->getStrokeColorSpace()->getNComps(); ++i) {
if (i > 0) {
@@ -4292,9 +4290,7 @@ void PSOutputDev::updateFont(GfxState *state) {
}
void PSOutputDev::updateTextMat(GfxState *state) {
- double *mat;
-
- mat = state->getTextMat();
+ const double *mat = state->getTextMat();
if (fabs(mat[0] * mat[3] - mat[1] * mat[2]) < 0.00001) {
// avoid a singular (or close-to-singular) matrix
writePSFmt("[0.00001 0 0 0.00001 {0:.6g} {1:.6g}] Tm\n", mat[4], mat[5]);
@@ -4379,8 +4375,8 @@ void PSOutputDev::eoFill(GfxState *state) {
}
GBool PSOutputDev::tilingPatternFillL1(GfxState *state, Catalog *cat, Object *str,
- double *pmat, int paintType, int tilingType, Dict *resDict,
- double *mat, double *bbox,
+ 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) {
PDFRectangle box;
@@ -4461,8 +4457,8 @@ GBool PSOutputDev::tilingPatternFillL1(GfxState *state, Catalog *cat, Object *st
}
GBool PSOutputDev::tilingPatternFillL2(GfxState *state, Catalog *cat, Object *str,
- double *pmat, int paintType, int tilingType, Dict *resDict,
- double *mat, double *bbox,
+ 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) {
PDFRectangle box;
@@ -4510,8 +4506,8 @@ GBool PSOutputDev::tilingPatternFillL2(GfxState *state, Catalog *cat, Object *st
}
GBool PSOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat, Object *str,
- double *pmat, int paintType, int tilingType, Dict *resDict,
- double *mat, double *bbox,
+ 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) {
if (x1 - x0 == 1 && y1 - y0 == 1) {
@@ -4549,7 +4545,6 @@ GBool PSOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat, O
GBool PSOutputDev::functionShadedFill(GfxState *state,
GfxFunctionShading *shading) {
double x0, y0, x1, y1;
- double *mat;
int i;
if (level == psLevel2Sep || level == psLevel3Sep) {
@@ -4560,7 +4555,7 @@ GBool PSOutputDev::functionShadedFill(GfxState *state,
}
shading->getDomain(&x0, &y0, &x1, &y1);
- mat = shading->getMatrix();
+ const double *mat = shading->getMatrix();
writePSFmt("/mat [{0:.6g} {1:.6g} {2:.6g} {3:.6g} {4:.6g} {5:.6g}] def\n",
mat[0], mat[1], mat[2], mat[3], mat[4], mat[5]);
writePSFmt("/n {0:d} def\n", shading->getColorSpace()->getNComps());
@@ -7248,11 +7243,11 @@ void PSOutputDev::psXObject(Stream *psStream, Stream *level1Stream) {
//~ can nextFunc be reset to 0 -- maybe at the start of each page?
//~ or maybe at the start of each color space / pattern?
-void PSOutputDev::cvtFunction(Function *func, GBool invertPSFunction) {
- SampledFunction *func0;
- ExponentialFunction *func2;
- StitchingFunction *func3;
- PostScriptFunction *func4;
+void PSOutputDev::cvtFunction(const Function *func, GBool invertPSFunction) {
+ const SampledFunction *func0;
+ const ExponentialFunction *func2;
+ const StitchingFunction *func3;
+ const PostScriptFunction *func4;
int thisFunc, m, n, nSamples, i, j, k;
switch (func->getType()) {
@@ -7262,7 +7257,7 @@ void PSOutputDev::cvtFunction(Function *func, GBool invertPSFunction) {
break;
case 0: // sampled
- func0 = (SampledFunction *)func;
+ func0 = (const SampledFunction *)func;
thisFunc = nextFunc++;
m = func0->getInputSize();
n = func0->getOutputSize();
@@ -7349,7 +7344,7 @@ void PSOutputDev::cvtFunction(Function *func, GBool invertPSFunction) {
break;
case 2: // exponential
- func2 = (ExponentialFunction *)func;
+ func2 = (const ExponentialFunction *)func;
n = func2->getOutputSize();
writePSFmt("{{ dup {0:.6g} lt {{ pop {1:.6g} }} {{ dup {2:.6g} gt {{ pop {3:.6g} }} if }} ifelse\n",
func2->getDomainMin(0), func2->getDomainMin(0),
@@ -7378,7 +7373,7 @@ void PSOutputDev::cvtFunction(Function *func, GBool invertPSFunction) {
break;
case 3: // stitching
- func3 = (StitchingFunction *)func;
+ func3 = (const StitchingFunction *)func;
thisFunc = nextFunc++;
for (i = 0; i < func3->getNumFuncs(); ++i) {
cvtFunction(func3->getFunc(i));
@@ -7414,7 +7409,7 @@ void PSOutputDev::cvtFunction(Function *func, GBool invertPSFunction) {
break;
case 4: // PostScript
- func4 = (PostScriptFunction *)func;
+ func4 = (const PostScriptFunction *)func;
if (invertPSFunction) {
GooString *codeString = new GooString(func4->getCodeString());
for (i = codeString->getLength() -1; i > 0; i--) {
diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h
index ef6106bb..c0abab04 100644
--- a/poppler/PSOutputDev.h
+++ b/poppler/PSOutputDev.h
@@ -169,7 +169,7 @@ public:
// Write the document-level header.
void writeHeader(const std::vector<int> &pages,
- PDFRectangle *mediaBox, PDFRectangle *cropBox,
+ const PDFRectangle *mediaBox, const PDFRectangle *cropBox,
int pageRotate, char *pstitle);
// Write the Xpdf procset.
@@ -242,8 +242,8 @@ public:
void fill(GfxState *state) override;
void eoFill(GfxState *state) override;
GBool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str,
- double *pmat, int paintType, int tilingType, Dict *resDict,
- double *mat, double *bbox,
+ 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;
GBool functionShadedFill(GfxState *state,
@@ -411,13 +411,13 @@ private:
GBool genXform, GBool updateColors,
GBool map01);
GBool tilingPatternFillL1(GfxState *state, Catalog *cat, Object *str,
- double *pmat, int paintType, int tilingType, Dict *resDict,
- double *mat, double *bbox,
+ 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);
GBool tilingPatternFillL2(GfxState *state, Catalog *cat, Object *str,
- double *pmat, int paintType, int tilingType, Dict *resDict,
- double *mat, double *bbox,
+ 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);
@@ -427,7 +427,7 @@ private:
void opiTransform(GfxState *state, double x0, double y0,
double *x1, double *y1);
#endif
- void cvtFunction(Function *func, GBool invertPSFunction = gFalse);
+ void cvtFunction(const Function *func, GBool invertPSFunction = gFalse);
GooString *filterPSName(const GooString *name);
// Write the document-level setup.
diff --git a/poppler/Page.cc b/poppler/Page.cc
index 7fea66c5..3fcbe6ef 100644
--- a/poppler/Page.cc
+++ b/poppler/Page.cc
@@ -480,7 +480,7 @@ Gfx *Page::createGfx(OutputDev *out, double hDPI, double vDPI,
GBool printing,
GBool (*abortCheckCbk)(void *data),
void *abortCheckCbkData, XRef *xrefA) {
- PDFRectangle *mediaBox, *cropBox;
+ const PDFRectangle *mediaBox, *cropBox;
PDFRectangle box;
Gfx *gfx;
@@ -692,7 +692,7 @@ void Page::makeBox(double hDPI, double vDPI, int rotate,
GBool useMediaBox, GBool upsideDown,
double sliceX, double sliceY, double sliceW, double sliceH,
PDFRectangle *box, GBool *crop) {
- PDFRectangle *mediaBox, *cropBox, *baseBox;
+ const PDFRectangle *mediaBox, *cropBox, *baseBox;
double kx, ky;
mediaBox = getMediaBox();
diff --git a/poppler/Page.h b/poppler/Page.h
index b5559811..c2f888d8 100644
--- a/poppler/Page.h
+++ b/poppler/Page.h
@@ -85,13 +85,13 @@ public:
~PageAttrs();
// Accessors.
- PDFRectangle *getMediaBox() { return &mediaBox; }
- PDFRectangle *getCropBox() { return &cropBox; }
- GBool isCropped() { return haveCropBox; }
- PDFRectangle *getBleedBox() { return &bleedBox; }
- PDFRectangle *getTrimBox() { return &trimBox; }
- PDFRectangle *getArtBox() { return &artBox; }
- int getRotate() { return rotate; }
+ const PDFRectangle *getMediaBox() const { return &mediaBox; }
+ const PDFRectangle *getCropBox() const { return &cropBox; }
+ GBool isCropped() const { return haveCropBox; }
+ const PDFRectangle *getBleedBox() const { return &bleedBox; }
+ const PDFRectangle *getTrimBox() const { return &trimBox; }
+ const PDFRectangle *getArtBox() const { return &artBox; }
+ int getRotate() const { return rotate; }
const GooString *getLastModified() const
{ return lastModified.isString()
? lastModified.getString() : nullptr; }
@@ -153,25 +153,25 @@ public:
Page& operator=(const Page &) = delete;
// Is page valid?
- GBool isOk() { return ok; }
+ GBool isOk() const { return ok; }
// Get page parameters.
- int getNum() { return num; }
- PDFRectangle *getMediaBox() { return attrs->getMediaBox(); }
- PDFRectangle *getCropBox() { return attrs->getCropBox(); }
- GBool isCropped() { return attrs->isCropped(); }
- double getMediaWidth()
+ int getNum() const { return num; }
+ const PDFRectangle *getMediaBox() const { return attrs->getMediaBox(); }
+ const PDFRectangle *getCropBox() const { return attrs->getCropBox(); }
+ GBool isCropped() const { return attrs->isCropped(); }
+ double getMediaWidth() const
{ return attrs->getMediaBox()->x2 - attrs->getMediaBox()->x1; }
- double getMediaHeight()
+ double getMediaHeight() const
{ return attrs->getMediaBox()->y2 - attrs->getMediaBox()->y1; }
- double getCropWidth()
+ double getCropWidth() const
{ return attrs->getCropBox()->x2 - attrs->getCropBox()->x1; }
- double getCropHeight()
+ double getCropHeight() const
{ return attrs->getCropBox()->y2 - attrs->getCropBox()->y1; }
- PDFRectangle *getBleedBox() { return attrs->getBleedBox(); }
- PDFRectangle *getTrimBox() { return attrs->getTrimBox(); }
- PDFRectangle *getArtBox() { return attrs->getArtBox(); }
- int getRotate() { return attrs->getRotate(); }
+ const PDFRectangle *getBleedBox() const { return attrs->getBleedBox(); }
+ const PDFRectangle *getTrimBox() const { return attrs->getTrimBox(); }
+ const PDFRectangle *getArtBox() const { return attrs->getArtBox(); }
+ int getRotate() const { return attrs->getRotate(); }
const GooString *getLastModified() const { return attrs->getLastModified(); }
Dict *getBoxColorInfo() { return attrs->getBoxColorInfo(); }
Dict *getGroup() { return attrs->getGroup(); }
diff --git a/poppler/PreScanOutputDev.cc b/poppler/PreScanOutputDev.cc
index b2af18d8..07920179 100644
--- a/poppler/PreScanOutputDev.cc
+++ b/poppler/PreScanOutputDev.cc
@@ -82,8 +82,8 @@ void PreScanOutputDev::eoFill(GfxState *state) {
}
GBool PreScanOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *catalog, Object *str,
- double *pmat, int paintType, int /*tilingType*/, Dict *resDict,
- double *mat, double *bbox,
+ 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) {
if (paintType == 1) {
@@ -153,7 +153,6 @@ void PreScanOutputDev::eoClip(GfxState * /*state*/) {
void PreScanOutputDev::beginStringOp(GfxState *state) {
int render;
- GfxFont *font;
double m11, m12, m21, m22;
GBool simpleTTF;
@@ -167,7 +166,7 @@ void PreScanOutputDev::beginStringOp(GfxState *state) {
state->getStrokeOpacity(), state->getBlendMode());
}
- font = state->getFont();
+ const GfxFont *font = state->getFont();
state->getFontTransMat(&m11, &m12, &m21, &m22);
//~ this should check for external fonts that are non-TrueType
simpleTTF = fabs(m11 + m22) < 0.01 &&
@@ -315,26 +314,26 @@ void PreScanOutputDev::drawSoftMaskedImage(GfxState * /*state*/, Object * /*ref*
}
void PreScanOutputDev::beginTransparencyGroup(
- GfxState * /*state*/, double * /*bbox*/,
+ GfxState * /*state*/, const double * /*bbox*/,
GfxColorSpace * /*blendingColorSpace*/,
GBool /*isolated*/, GBool /*knockout*/,
GBool /*forSoftMask*/) {
gdi = gFalse;
}
-void PreScanOutputDev::paintTransparencyGroup(GfxState *state, double * /*bbox*/)
+void PreScanOutputDev::paintTransparencyGroup(GfxState *state, const double * /*bbox*/)
{
check(state->getFillColorSpace(), state->getFillColor(),
state->getFillOpacity(), state->getBlendMode());
}
-void PreScanOutputDev::setSoftMask(GfxState * /*state*/, double * /*bbox*/, GBool /*alpha*/,
+void PreScanOutputDev::setSoftMask(GfxState * /*state*/, const double * /*bbox*/, GBool /*alpha*/,
Function * /*transferFunc*/, GfxColor * /*backdropColor*/)
{
transparency = gTrue;
}
-void PreScanOutputDev::check(GfxColorSpace *colorSpace, GfxColor *color,
+void PreScanOutputDev::check(GfxColorSpace *colorSpace, const GfxColor *color,
double opacity, GfxBlendMode blendMode) {
GfxRGB rgb;
diff --git a/poppler/PreScanOutputDev.h b/poppler/PreScanOutputDev.h
index a1fd6b50..cf0359ad 100644
--- a/poppler/PreScanOutputDev.h
+++ b/poppler/PreScanOutputDev.h
@@ -86,8 +86,8 @@ public:
void fill(GfxState *state) override;
void eoFill(GfxState *state) override;
GBool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str,
- double *pmat, int paintType, int tilingType, Dict *resDict,
- double *mat, double *bbox,
+ 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;
GBool functionShadedFill(GfxState *state,
@@ -130,12 +130,12 @@ public:
GBool maskInterpolate) override;
//----- transparency groups and soft masks
- void beginTransparencyGroup(GfxState *state, double *bbox,
+ void beginTransparencyGroup(GfxState *state, const double *bbox,
GfxColorSpace *blendingColorSpace,
GBool isolated, GBool knockout,
GBool forSoftMask) override;
- void paintTransparencyGroup(GfxState *state, double *bbox) override;
- void setSoftMask(GfxState *state, double *bbox, GBool alpha,
+ void paintTransparencyGroup(GfxState *state, const double *bbox) override;
+ void setSoftMask(GfxState *state, const double *bbox, GBool alpha,
Function *transferFunc, GfxColor *backdropColor) override;
//----- special access
@@ -166,7 +166,7 @@ public:
private:
- void check(GfxColorSpace *colorSpace, GfxColor *color,
+ void check(GfxColorSpace *colorSpace, const GfxColor *color,
double opacity, GfxBlendMode blendMode);
PDFDoc *doc;
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index 4350d908..ec5f2a26 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -240,7 +240,7 @@ SplashFunctionPattern::SplashFunctionPattern(SplashColorMode colorModeA, GfxStat
Matrix ctm;
SplashColor defaultColor;
GfxColor srcColor;
- double *matrix = shadingA->getMatrix();
+ const double *matrix = shadingA->getMatrix();
shading = shadingA;
state = stateA;
@@ -1478,7 +1478,6 @@ void SplashOutputDev::startDoc(PDFDoc *docA) {
void SplashOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) {
int w, h;
- double *ctm;
SplashCoord mat[6];
SplashColor color;
@@ -1520,7 +1519,7 @@ void SplashOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) {
splash->setThinLineMode(thinLineMode);
splash->setMinLineWidth(s_minLineWidth);
if (state) {
- ctm = state->getCTM();
+ const double *ctm = state->getCTM();
mat[0] = (SplashCoord)ctm[0];
mat[1] = (SplashCoord)ctm[1];
mat[2] = (SplashCoord)ctm[2];
@@ -1607,10 +1606,9 @@ void SplashOutputDev::updateAll(GfxState *state) {
void SplashOutputDev::updateCTM(GfxState *state, double m11, double m12,
double m21, double m22,
double m31, double m32) {
- double *ctm;
SplashCoord mat[6];
- ctm = state->getCTM();
+ const double *ctm = state->getCTM();
mat[0] = (SplashCoord)ctm[0];
mat[1] = (SplashCoord)ctm[1];
mat[2] = (SplashCoord)ctm[2];
@@ -1800,7 +1798,7 @@ SplashPattern *SplashOutputDev::getColor(GfxColor *deviceN) {
}
#endif
-void SplashOutputDev::getMatteColor(SplashColorMode colorMode, GfxImageColorMap *colorMap, GfxColor *matteColorIn, SplashColor matteColor) {
+void SplashOutputDev::getMatteColor(SplashColorMode colorMode, GfxImageColorMap *colorMap, const GfxColor *matteColorIn, SplashColor matteColor) {
GfxGray gray;
GfxRGB rgb;
#ifdef SPLASH_CMYK
@@ -1848,7 +1846,7 @@ void SplashOutputDev::getMatteColor(SplashColorMode colorMode, GfxImageColorMap
void SplashOutputDev::setOverprintMask(GfxColorSpace *colorSpace,
GBool overprintFlag,
int overprintMode,
- GfxColor *singleColor,
+ const GfxColor *singleColor,
GBool grayIndexed) {
#ifdef SPLASH_CMYK
Guint mask;
@@ -2008,7 +2006,7 @@ void SplashOutputDev::doUpdateFont(GfxState *state) {
char *tmpBuf;
int tmpBufLen;
int *codeToGID;
- double *textMat;
+ const double *textMat;
double m11, m12, m21, m22, fontSize;
int faceIndex = 0;
SplashCoord mat[4];
@@ -2650,7 +2648,6 @@ GBool SplashOutputDev::beginType3Char(GfxState *state, double x, double y,
void SplashOutputDev::endType3Char(GfxState *state) {
T3GlyphStack *t3gs;
- double *ctm;
if (t3GlyphStack->cacheTag) {
--nestCount;
@@ -2660,7 +2657,7 @@ void SplashOutputDev::endType3Char(GfxState *state) {
delete splash;
bitmap = t3GlyphStack->origBitmap;
splash = t3GlyphStack->origSplash;
- ctm = state->getCTM();
+ const double *ctm = state->getCTM();
state->setCTM(ctm[0], ctm[1], ctm[2], ctm[3],
t3GlyphStack->origCTM4, t3GlyphStack->origCTM5);
updateCTM(state, 0, 0, 0, 0, 0, 0);
@@ -2682,7 +2679,6 @@ void SplashOutputDev::type3D0(GfxState *state, double wx, double wy) {
void SplashOutputDev::type3D1(GfxState *state, double wx, double wy,
double llx, double lly, double urx, double ury) {
- double *ctm;
T3FontCache *t3Font;
SplashColor color;
double xt, yt, xMin, xMax, yMin, yMax, x1, y1;
@@ -2782,7 +2778,7 @@ void SplashOutputDev::type3D1(GfxState *state, double wx, double wy,
// save state
t3GlyphStack->origBitmap = bitmap;
t3GlyphStack->origSplash = splash;
- ctm = state->getCTM();
+ const double *ctm = state->getCTM();
t3GlyphStack->origCTM4 = ctm[4];
t3GlyphStack->origCTM5 = ctm[5];
@@ -2870,7 +2866,6 @@ GBool SplashOutputDev::imageMaskSrc(void *data, SplashColorPtr line) {
void SplashOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
int width, int height, GBool invert,
GBool interpolate, GBool inlineImg) {
- double *ctm;
SplashCoord mat[6];
SplashOutImageMaskData imgMaskData;
@@ -2880,7 +2875,7 @@ void SplashOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
setOverprintMask(state->getFillColorSpace(), state->getFillOverprint(),
state->getOverprintMode(), state->getFillColor());
- ctm = state->getCTM();
+ const double *ctm = state->getCTM();
for (int i = 0; i < 6; ++i) {
if (!std::isfinite(ctm[i])) return;
}
@@ -2915,7 +2910,7 @@ void SplashOutputDev::setSoftMaskFromImageMask(GfxState *state,
int width, int height,
GBool invert,
GBool inlineImg, double *baseMatrix) {
- double *ctm;
+ const double *ctm;
SplashCoord mat[6];
SplashOutImageMaskData imgMaskData;
Splash *maskSplash;
@@ -3487,7 +3482,6 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
GfxImageColorMap *colorMap,
GBool interpolate,
int *maskColors, GBool inlineImg) {
- double *ctm;
SplashCoord mat[6];
SplashOutImageData imgData;
SplashColorMode srcMode;
@@ -3503,7 +3497,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
Guchar pix;
int n, i;
- ctm = state->getCTM();
+ const double *ctm = state->getCTM();
for (i = 0; i < 6; ++i) {
if (!std::isfinite(ctm[i])) return;
}
@@ -3763,7 +3757,6 @@ void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref,
int maskHeight, GBool maskInvert,
GBool maskInterpolate) {
GfxImageColorMap *maskColorMap;
- double *ctm;
SplashCoord mat[6];
SplashOutMaskedImageData imgData;
SplashOutImageMaskData imgMaskData;
@@ -3832,7 +3825,7 @@ void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref,
//----- draw the source image
- ctm = state->getCTM();
+ const double *ctm = state->getCTM();
for (i = 0; i < 6; ++i) {
if (!std::isfinite(ctm[i])) {
delete maskBitmap;
@@ -3941,7 +3934,6 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object * /* ref */,
int maskWidth, int maskHeight,
GfxImageColorMap *maskColorMap,
GBool maskInterpolate) {
- double *ctm;
SplashCoord mat[6];
SplashOutImageData imgData;
SplashOutImageData imgMaskData;
@@ -3963,7 +3955,7 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object * /* ref */,
setOverprintMask(colorMap->getColorSpace(), state->getFillOverprint(),
state->getOverprintMode(), nullptr);
- ctm = state->getCTM();
+ const double *ctm = state->getCTM();
for (int i = 0; i < 6; ++i) {
if (!std::isfinite(ctm[i])) return;
}
@@ -4145,7 +4137,7 @@ GBool SplashOutputDev::checkTransparencyGroup(GfxState *state, GBool knockout) {
return transpGroupStack != nullptr && transpGroupStack->shape != nullptr;
}
-void SplashOutputDev::beginTransparencyGroup(GfxState *state, double *bbox,
+void SplashOutputDev::beginTransparencyGroup(GfxState *state, const double *bbox,
GfxColorSpace *blendingColorSpace,
GBool isolated, GBool knockout,
GBool forSoftMask) {
@@ -4316,7 +4308,7 @@ void SplashOutputDev::endTransparencyGroup(GfxState *state) {
updateCTM(state, 0, 0, 0, 0, 0, 0);
}
-void SplashOutputDev::paintTransparencyGroup(GfxState *state, double *bbox) {
+void SplashOutputDev::paintTransparencyGroup(GfxState *state, const double *bbox) {
SplashBitmap *tBitmap;
SplashTransparencyGroup *transpGroup;
GBool isolated;
@@ -4354,7 +4346,7 @@ void SplashOutputDev::paintTransparencyGroup(GfxState *state, double *bbox) {
delete tBitmap;
}
-void SplashOutputDev::setSoftMask(GfxState *state, double *bbox,
+void SplashOutputDev::setSoftMask(GfxState *state, const double *bbox,
GBool alpha, Function *transferFunc,
GfxColor *backdropColor) {
SplashBitmap *softMask, *tBitmap;
@@ -4547,8 +4539,8 @@ void SplashOutputDev::setFreeTypeHinting(GBool enable, GBool enableSlightHinting
}
GBool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *catalog, Object *str,
- double *ptm, int paintType, int /*tilingType*/, Dict *resDict,
- double *mat, double *bbox,
+ 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)
{
@@ -4561,7 +4553,8 @@ GBool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *ca
int repeatX, repeatY;
SplashCoord matc[6];
Matrix m1;
- double *ctm, savedCTM[6];
+ const double *ctm;
+ double savedCTM[6];
double kx, ky, sx, sy;
GBool retValue = gFalse;
diff --git a/poppler/SplashOutputDev.h b/poppler/SplashOutputDev.h
index 4d72d9c7..f655c760 100644
--- a/poppler/SplashOutputDev.h
+++ b/poppler/SplashOutputDev.h
@@ -274,8 +274,8 @@ public:
void fill(GfxState *state) override;
void eoFill(GfxState *state) override;
GBool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *catalog, Object *str,
- double *pmat, int paintType, int tilingType, Dict *resDict,
- double *mat, double *bbox,
+ 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;
GBool functionShadedFill(GfxState *state, GfxFunctionShading *shading) override;
@@ -334,13 +334,13 @@ public:
//----- transparency groups and soft masks
GBool checkTransparencyGroup(GfxState *state, GBool knockout) override;
- void beginTransparencyGroup(GfxState *state, double *bbox,
+ void beginTransparencyGroup(GfxState *state, const double *bbox,
GfxColorSpace *blendingColorSpace,
GBool isolated, GBool knockout,
GBool forSoftMask) override;
void endTransparencyGroup(GfxState *state) override;
- void paintTransparencyGroup(GfxState *state, double *bbox) override;
- void setSoftMask(GfxState *state, double *bbox, GBool alpha,
+ void paintTransparencyGroup(GfxState *state, const double *bbox) override;
+ void setSoftMask(GfxState *state, const double *bbox, GBool alpha,
Function *transferFunc, GfxColor *backdropColor) override;
void clearSoftMask(GfxState *state) override;
@@ -408,9 +408,9 @@ private:
SplashPattern *getColor(GfxCMYK *cmyk);
SplashPattern *getColor(GfxColor *deviceN);
#endif
- static void getMatteColor( SplashColorMode colorMode, GfxImageColorMap *colorMap, GfxColor * matteColor, SplashColor splashMatteColor);
+ static void getMatteColor( SplashColorMode colorMode, GfxImageColorMap *colorMap, const GfxColor * matteColor, SplashColor splashMatteColor);
void setOverprintMask(GfxColorSpace *colorSpace, GBool overprintFlag,
- int overprintMode, GfxColor *singleColor, GBool grayIndexed = gFalse);
+ int overprintMode, const GfxColor *singleColor, GBool grayIndexed = gFalse);
SplashPath convertPath(GfxState *state, GfxPath *path,
GBool dropEmptySubpaths);
void drawType3Glyph(GfxState *state, T3FontCache *t3Font,
diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
index f46db8bd..8995031c 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -325,23 +325,23 @@ TextFontInfo::~TextFontInfo() {
#endif
}
-GBool TextFontInfo::matches(GfxState *state) {
+GBool TextFontInfo::matches(GfxState *state) const {
return state->getFont() == gfxFont;
}
-GBool TextFontInfo::matches(TextFontInfo *fontInfo) {
+GBool TextFontInfo::matches(const TextFontInfo *fontInfo) const {
return gfxFont == fontInfo->gfxFont;
}
-double TextFontInfo::getAscent() {
+double TextFontInfo::getAscent() const {
return gfxFont ? gfxFont->getAscent() : 0.95;
}
-double TextFontInfo::getDescent() {
+double TextFontInfo::getDescent() const {
return gfxFont ? gfxFont->getDescent() : -0.35;
}
-int TextFontInfo::getWMode() {
+int TextFontInfo::getWMode() const {
return gfxFont ? gfxFont->getWMode() : 0;
}
@@ -349,7 +349,7 @@ int TextFontInfo::getWMode() {
// TextWord
//------------------------------------------------------------------------
-TextWord::TextWord(GfxState *state, int rotA, double fontSizeA) {
+TextWord::TextWord(const GfxState *state, int rotA, double fontSizeA) {
rot = rotA;
fontSize = fontSizeA;
text = nullptr;
diff --git a/poppler/TextOutputDev.h b/poppler/TextOutputDev.h
index e793401f..1af11909 100644
--- a/poppler/TextOutputDev.h
+++ b/poppler/TextOutputDev.h
@@ -84,28 +84,28 @@ public:
TextFontInfo(const TextFontInfo &) = delete;
TextFontInfo& operator=(const TextFontInfo &) = delete;
- GBool matches(GfxState *state);
- GBool matches(TextFontInfo *fontInfo);
+ GBool matches(GfxState *state) const;
+ GBool matches(const TextFontInfo *fontInfo) const;
// Get the font ascent, or a default value if the font is not set
- double getAscent();
+ double getAscent() const;
// Get the font descent, or a default value if the font is not set
- double getDescent();
+ double getDescent() const;
// Get the writing mode (0 or 1), or 0 if the font is not set
- int getWMode();
+ int getWMode() const;
#ifdef TEXTOUT_WORD_LIST
// Get the font name (which may be NULL).
- GooString *getFontName() { return fontName; }
+ const GooString *getFontName() const { return fontName; }
// Get font descriptor flags.
- GBool isFixedWidth() { return flags & fontFixedWidth; }
- GBool isSerif() { return flags & fontSerif; }
- GBool isSymbolic() { return flags & fontSymbolic; }
- GBool isItalic() { return flags & fontItalic; }
- GBool isBold() { return flags & fontBold; }
+ GBool isFixedWidth() const { return flags & fontFixedWidth; }
+ GBool isSerif() const { return flags & fontSerif; }
+ GBool isSymbolic() const { return flags & fontSymbolic; }
+ GBool isItalic() const { return flags & fontItalic; }
+ GBool isBold() const { return flags & fontBold; }
#endif
private:
@@ -129,7 +129,7 @@ class TextWord {
public:
// Constructor.
- TextWord(GfxState *state, int rotA, double fontSize);
+ TextWord(const GfxState *state, int rotA, double fontSize);
// Destructor.
~TextWord();
diff --git a/poppler/UnicodeMap.cc b/poppler/UnicodeMap.cc
index a7c59edf..3b669835 100644
--- a/poppler/UnicodeMap.cc
+++ b/poppler/UnicodeMap.cc
@@ -259,7 +259,7 @@ void UnicodeMap::decRefCnt() {
}
}
-GBool UnicodeMap::match(GooString *encodingNameA) {
+GBool UnicodeMap::match(const GooString *encodingNameA) const {
return !encodingName->cmp(encodingNameA);
}
diff --git a/poppler/UnicodeMap.h b/poppler/UnicodeMap.h
index 871c656a..34d71d7e 100644
--- a/poppler/UnicodeMap.h
+++ b/poppler/UnicodeMap.h
@@ -86,13 +86,13 @@ public:
void incRefCnt();
void decRefCnt();
- GooString *getEncodingName() { return encodingName; }
+ const GooString *getEncodingName() const { return encodingName; }
- GBool isUnicode() { return unicodeOut; }
+ GBool isUnicode() const { return unicodeOut; }
// Return true if this UnicodeMap matches the specified
// <encodingNameA>.
- GBool match(GooString *encodingNameA);
+ GBool match(const GooString *encodingNameA) const;
// Map Unicode to the target encoding. Fills in <buf> with the
// output and returns the number of bytes used. Output will be
diff --git a/qt5/src/ArthurOutputDev.cc b/qt5/src/ArthurOutputDev.cc
index e9722238..74c90790 100644
--- a/qt5/src/ArthurOutputDev.cc
+++ b/qt5/src/ArthurOutputDev.cc
@@ -252,7 +252,7 @@ void ArthurOutputDev::updateAll(GfxState *state)
}
// Set CTM (Current Transformation Matrix) to a fixed matrix
-void ArthurOutputDev::setDefaultCTM(double *ctm)
+void ArthurOutputDev::setDefaultCTM(const double *ctm)
{
m_painter.top()->setTransform(QTransform(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]));
}
@@ -1225,7 +1225,7 @@ void ArthurOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *
m_painter.top()->drawImage( QRect(0,0,1,1), image );
}
-void ArthurOutputDev::beginTransparencyGroup(GfxState * /*state*/, double * /*bbox*/,
+void ArthurOutputDev::beginTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/,
GfxColorSpace * /*blendingColorSpace*/,
GBool /*isolated*/, GBool /*knockout*/,
GBool /*forSoftMask*/)
@@ -1258,7 +1258,7 @@ void ArthurOutputDev::endTransparencyGroup(GfxState * /*state*/)
m_qpictures.pop();
}
-void ArthurOutputDev::paintTransparencyGroup(GfxState * /*state*/, double * /*bbox*/)
+void ArthurOutputDev::paintTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/)
{
// Actually draw the transparency group
m_painter.top()->drawPicture(0,0,*m_lastTransparencyGroupPicture);
diff --git a/qt5/src/ArthurOutputDev.h b/qt5/src/ArthurOutputDev.h
index b228a886..dee1f89a 100644
--- a/qt5/src/ArthurOutputDev.h
+++ b/qt5/src/ArthurOutputDev.h
@@ -99,7 +99,7 @@ public:
//----- initialization and control
// Set Current Transformation Matrix to a fixed matrix given in ctm[0],...,ctm[5]
- void setDefaultCTM(double *ctm) override;
+ void setDefaultCTM(const double *ctm) override;
// Start a page.
void startPage(int pageNum, GfxState *state, XRef *xref) override;
@@ -171,12 +171,12 @@ public:
double llx, double lly, double urx, double ury) override;
//----- transparency groups and soft masks
- virtual void beginTransparencyGroup(GfxState *state, double *bbox,
+ virtual void beginTransparencyGroup(GfxState *state, const double *bbox,
GfxColorSpace *blendingColorSpace,
GBool isolated, GBool knockout,
GBool forSoftMask) override;
virtual void endTransparencyGroup(GfxState *state) override;
- virtual void paintTransparencyGroup(GfxState *state, double *bbox) override;
+ virtual void paintTransparencyGroup(GfxState *state, const double *bbox) override;
//----- special access
diff --git a/qt5/src/poppler-annotation.cc b/qt5/src/poppler-annotation.cc
index a2a20fa1..8fc35a91 100644
--- a/qt5/src/poppler-annotation.cc
+++ b/qt5/src/poppler-annotation.cc
@@ -212,7 +212,7 @@ void AnnotationPrivate::fillNormalizationMTX(double MTX[6], int pageRotation) co
// build a normalized transform matrix for this page at 100% scale
GfxState * gfxState = new GfxState( 72.0, 72.0, pdfPage->getCropBox(), pageRotation, gTrue );
- double * gfxCTM = gfxState->getCTM();
+ const double * gfxCTM = gfxState->getCTM();
double w = pdfPage->getCropWidth();
double h = pdfPage->getCropHeight();
diff --git a/qt5/src/poppler-form.cc b/qt5/src/poppler-form.cc
index 58b2e57e..9743149f 100644
--- a/qt5/src/poppler-form.cc
+++ b/qt5/src/poppler-form.cc
@@ -77,7 +77,7 @@ FormField::FormField(FormFieldData &dd)
m_formData->fm->getRect(&left, &bottom, &right, &top);
// build a normalized transform matrix for this page at 100% scale
GfxState gfxState( 72.0, 72.0, m_formData->page->getCropBox(), rotation, gTrue );
- double * gfxCTM = gfxState.getCTM();
+ const double * gfxCTM = gfxState.getCTM();
double MTX[6];
double pageWidth = m_formData->page->getCropWidth();
double pageHeight = m_formData->page->getCropHeight();
diff --git a/qt5/src/poppler-page.cc b/qt5/src/poppler-page.cc
index 45358213..8d5995dd 100644
--- a/qt5/src/poppler-page.cc
+++ b/qt5/src/poppler-page.cc
@@ -669,7 +669,6 @@ QString Page::text(const QRectF &r, TextLayout textLayout) const
{
TextOutputDev *output_dev;
GooString *s;
- PDFRectangle *rect;
QString result;
const GBool rawOrder = textLayout == RawOrderLayout;
@@ -679,7 +678,7 @@ QString Page::text(const QRectF &r, TextLayout textLayout) const
nullptr, nullptr, nullptr, nullptr, gTrue);
if (r.isNull())
{
- rect = m_page->page->getCropBox();
+ const PDFRectangle *rect = m_page->page->getCropBox();
s = output_dev->getText(rect->x1, rect->y1, rect->x2, rect->y2);
}
else
diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc
index 076a15fe..bcef5f18 100644
--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -382,7 +382,7 @@ void HtmlPage::addChar(GfxState *state, double x, double y,
//if ((UnicodeMap::getDirection(u[0]) != curStr->dir) ||
// XXX
if (debug) {
- double *text_mat = state->getTextMat();
+ const double *text_mat = state->getTextMat();
// rotation is (cos q, sin q, -sin q, cos q, 0, 0)
// sin q is zero iff there is no rotation, or 180 deg. rotation;
// for 180 rotation, cos q will be negative
diff --git a/utils/ImageOutputDev.cc b/utils/ImageOutputDev.cc
index 75650e5b..e96f774d 100644
--- a/utils/ImageOutputDev.cc
+++ b/utils/ImageOutputDev.cc
@@ -232,7 +232,7 @@ void ImageOutputDev::listImage(GfxState *state, Object *ref, Stream *str,
printf("[none] ");
}
- double *mat = state->getCTM();
+ const double *mat = state->getCTM();
double width2 = mat[0] + mat[2];
double height2 = mat[1] + mat[3];
double xppi = fabs(width*72.0/width2) + 0.5;
@@ -679,8 +679,8 @@ void ImageOutputDev::writeImage(GfxState *state, Object *ref, Stream *str,
}
GBool ImageOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str,
- double *pmat, int paintType, int tilingType, Dict *resDict,
- double *mat, double *bbox,
+ 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) {
return gTrue;
diff --git a/utils/ImageOutputDev.h b/utils/ImageOutputDev.h
index baccd8ef..310d3bd1 100644
--- a/utils/ImageOutputDev.h
+++ b/utils/ImageOutputDev.h
@@ -120,8 +120,8 @@ public:
//----- path painting
GBool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str,
- double *pmat, int paintType, int tilingType, Dict *resDict,
- double *mat, double *bbox,
+ 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;
diff --git a/utils/pdfinfo.cc b/utils/pdfinfo.cc
index 913a6c05..7e1701fa 100644
--- a/utils/pdfinfo.cc
+++ b/utils/pdfinfo.cc
@@ -216,7 +216,7 @@ static void printISODate(Dict *infoDict, const char *key, const char *text)
}
}
-static void printBox(const char *text, PDFRectangle *box) {
+static void printBox(const char *text, const PDFRectangle *box) {
printf("%s%8.2f %8.2f %8.2f %8.2f\n",
text, box->x1, box->y1, box->x2, box->y2);
}
diff --git a/utils/pdfunite.cc b/utils/pdfunite.cc
index ccbf7d6e..1125aa62 100644
--- a/utils/pdfunite.cc
+++ b/utils/pdfunite.cc
@@ -280,7 +280,7 @@ int main (int argc, char *argv[])
continue;
}
- PDFRectangle *cropBox = nullptr;
+ const PDFRectangle *cropBox = nullptr;
if (docs[i]->getCatalog()->getPage(j)->isCropped())
cropBox = docs[i]->getCatalog()->getPage(j)->getCropBox();
docs[i]->replacePageDict(j,
More information about the poppler
mailing list