You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
inkscape/SOURCES/inkscape-poppler-20.11.0.patch

1042 lines
37 KiB

--- inkscape-0.92.3/src/extension/internal/pdfinput/pdf-input.cpp
+++ inkscape-0.92.3/src/extension/internal/pdfinput/pdf-input.cpp
@@ -319,7 +319,7 @@ PdfImportDialog::PdfImportDialog(PDFDoc
_render_thumb = true;
// Create PopplerDocument
- Glib::ustring filename = _pdf_doc->getFileName()->getCString();
+ Glib::ustring filename = _pdf_doc->getFileName()->c_str();
if (!Glib::path_is_absolute(filename)) {
filename = Glib::build_filename(Glib::get_current_dir(),filename);
}
@@ -694,7 +694,7 @@ PdfInput::open(::Inkscape::Extension::In
globalParams = new GlobalParams();
}
#else
- globalParams = new GlobalParams();
+ globalParams.reset(new GlobalParams());
#endif // ENABLE_OSX_APP_LOCATIONS
}
@@ -793,7 +793,7 @@ PdfInput::open(::Inkscape::Extension::In
dlg->getImportSettings(prefs);
// Apply crop settings
- PDFRectangle *clipToBox = NULL;
+ const PDFRectangle *clipToBox = NULL;
double crop_setting;
sp_repr_get_double(prefs, "cropTo", &crop_setting);
--- inkscape-0.92.3/src/extension/internal/pdfinput/pdf-parser.cpp
+++ inkscape-0.92.3/src/extension/internal/pdfinput/pdf-parser.cpp
@@ -270,8 +270,8 @@ public:
// Manipulate clip path stack
ClipHistoryEntry *save();
ClipHistoryEntry *restore();
- GBool hasSaves() { return saved != NULL; }
- void setClip(GfxPath *newClipPath, GfxClipType newClipType = clipNormal);
+ bool hasSaves() { return saved != NULL; }
+ void setClip(const GfxPath *newClipPath, GfxClipType newClipType = clipNormal);
GfxPath *getClipPath() { return clipPath; }
GfxClipType getClipType() { return clipType; }
@@ -294,15 +294,15 @@ PdfParser::PdfParser(XRef *xrefA,
int /*pageNum*/,
int rotate,
Dict *resDict,
- PDFRectangle *box,
- PDFRectangle *cropBox) :
+ const PDFRectangle *box,
+ const PDFRectangle *cropBox) :
xref(xrefA),
builder(builderA),
- subPage(gFalse),
+ subPage(false),
printCommands(false),
res(new GfxResources(xref, resDict, NULL)), // start the resource stack
- state(new GfxState(72.0, 72.0, box, rotate, gTrue)),
- fontChanged(gFalse),
+ state(new GfxState(72.0, 72.0, box, rotate, true)),
+ fontChanged(false),
clip(clipNone),
ignoreUndef(0),
baseMatrix(),
@@ -317,7 +317,7 @@ PdfParser::PdfParser(XRef *xrefA,
builder->setDocumentSize(Inkscape::Util::Quantity::convert(state->getPageWidth(), "pt", "px"),
Inkscape::Util::Quantity::convert(state->getPageHeight(), "pt", "px"));
- double *ctm = state->getCTM();
+ const double *ctm = state->getCTM();
double scaledCTM[6];
for (int i = 0; i < 6; ++i) {
baseMatrix[i] = ctm[i];
@@ -352,14 +352,14 @@ PdfParser::PdfParser(XRef *xrefA,
PdfParser::PdfParser(XRef *xrefA,
Inkscape::Extension::Internal::SvgBuilder *builderA,
Dict *resDict,
- PDFRectangle *box) :
+ const PDFRectangle *box) :
xref(xrefA),
builder(builderA),
- subPage(gTrue),
+ subPage(true),
printCommands(false),
res(new GfxResources(xref, resDict, NULL)), // start the resource stack
- state(new GfxState(72, 72, box, 0, gFalse)),
- fontChanged(gFalse),
+ state(new GfxState(72, 72, box, 0, false)),
+ fontChanged(false),
clip(clipNone),
ignoreUndef(0),
baseMatrix(),
@@ -408,7 +408,7 @@ PdfParser::~PdfParser() {
}
}
-void PdfParser::parse(Object *obj, GBool topLevel) {
+void PdfParser::parse(Object *obj, bool topLevel) {
Object obj2;
if (obj->isArray()) {
@@ -433,13 +433,13 @@ void PdfParser::parse(Object *obj, GBool
error(errInternal, -1, "Weird page contents");
return;
}
- parser = new Parser(xref, new Lexer(xref, obj), gFalse);
+ parser = new Parser(xref, obj, false);
go(topLevel);
delete parser;
parser = NULL;
}
-void PdfParser::go(GBool /*topLevel*/)
+void PdfParser::go(bool /*topLevel*/)
{
Object obj;
Object args[maxArgs];
@@ -571,7 +571,7 @@ const char *PdfParser::getPreviousOperat
void PdfParser::execOp(Object *cmd, Object args[], int numArgs) {
PdfOperator *op;
- char *name;
+ const char *name;
Object *argPtr;
int i;
@@ -619,7 +619,7 @@ void PdfParser::execOp(Object *cmd, Obje
(this->*op->func)(argPtr, numArgs);
}
-PdfOperator* PdfParser::findOp(char *name) {
+PdfOperator* PdfParser::findOp(const char *name) {
int a = -1;
int b = numOps;
int cmp = -1;
@@ -639,7 +639,7 @@ PdfOperator* PdfParser::findOp(char *nam
return &opTab[a];
}
-GBool PdfParser::checkArg(Object *arg, TchkType type) {
+bool PdfParser::checkArg(Object *arg, TchkType type) {
switch (type) {
case tchkBool: return arg->isBool();
case tchkInt: return arg->isInt();
@@ -649,9 +649,9 @@ GBool PdfParser::checkArg(Object *arg, T
case tchkArray: return arg->isArray();
case tchkProps: return arg->isDict() || arg->isName();
case tchkSCN: return arg->isNum() || arg->isName();
- case tchkNone: return gFalse;
+ case tchkNone: return false;
}
- return gFalse;
+ return false;
}
int PdfParser::getPos() {
@@ -706,7 +706,7 @@ void PdfParser::opConcat(Object args[],
builder->pushGroup();
builder->setTransform(a0, a1, a2, a3, a4, a5);
}
- fontChanged = gTrue;
+ fontChanged = true;
}
// TODO not good that numArgs is ignored but args[] is used:
@@ -772,8 +772,8 @@ void PdfParser::opSetExtGState(Object ar
Object obj1, obj2, obj3, obj4, obj5;
Function *funcs[4] = {0, 0, 0, 0};
GfxColor backdropColor;
- GBool haveBackdropColor = gFalse;
- GBool alpha = gFalse;
+ bool haveBackdropColor = false;
+ bool alpha = false;
#if defined(POPPLER_NEW_OBJECT_API)
if ((obj1 = res->lookupGState(args[0].getName())).isNull()) {
@@ -829,7 +829,7 @@ void PdfParser::opSetExtGState(Object ar
#endif
// fill/stroke overprint
- GBool haveFillOP = gFalse;
+ bool haveFillOP = false;
#if defined(POPPLER_NEW_OBJECT_API)
if ((haveFillOP = (obj2 = obj1.dictLookup(const_cast<char*>("op"))).isBool())) {
#else
@@ -924,9 +924,9 @@ void PdfParser::opSetExtGState(Object ar
#else
if (obj2.dictLookup(const_cast<char*>("S"), &obj3)->isName(const_cast<char*>("Alpha"))) {
#endif
- alpha = gTrue;
+ alpha = true;
} else { // "Luminosity"
- alpha = gFalse;
+ alpha = false;
}
#if !defined(POPPLER_NEW_OBJECT_API)
obj3.free();
@@ -977,8 +977,8 @@ void PdfParser::opSetExtGState(Object ar
if (obj3.streamGetDict()->lookup(const_cast<char*>("Group"), &obj4)->isDict()) {
#endif
GfxColorSpace *blendingColorSpace = 0;
- GBool isolated = gFalse;
- GBool knockout = gFalse;
+ bool isolated = false;
+ bool knockout = false;
#if defined(POPPLER_NEW_OBJECT_API)
if (!((obj5 = obj4.dictLookup(const_cast<char*>("CS"))).isNull())) {
#else
@@ -1049,9 +1049,9 @@ void PdfParser::opSetExtGState(Object ar
#endif
}
-void PdfParser::doSoftMask(Object *str, GBool alpha,
+void PdfParser::doSoftMask(Object *str, bool alpha,
GfxColorSpace *blendingColorSpace,
- GBool isolated, GBool knockout,
+ bool isolated, bool knockout,
Function *transferFunc, GfxColor *backdropColor) {
Dict *dict, *resDict;
double m[6], bbox[4];
@@ -1144,7 +1144,7 @@ void PdfParser::doSoftMask(Object *str,
// draw it
++formDepth;
- doForm1(str, resDict, m, bbox, gTrue, gTrue,
+ doForm1(str, resDict, m, bbox, true, true,
blendingColorSpace, isolated, knockout,
alpha, transferFunc, backdropColor);
--formDepth;
@@ -1614,7 +1614,7 @@ void PdfParser::opFill(Object /*args*/[]
if (state->isPath()) {
if (state->getFillColorSpace()->getMode() == csPattern &&
!builder->isPatternTypeSupported(state->getFillPattern())) {
- doPatternFillFallback(gFalse);
+ doPatternFillFallback(false);
} else {
builder->addPath(state, true, false);
}
@@ -1631,7 +1631,7 @@ void PdfParser::opEOFill(Object /*args*/
if (state->isPath()) {
if (state->getFillColorSpace()->getMode() == csPattern &&
!builder->isPatternTypeSupported(state->getFillPattern())) {
- doPatternFillFallback(gTrue);
+ doPatternFillFallback(true);
} else {
builder->addPath(state, true, false, true);
}
@@ -1646,7 +1646,7 @@ void PdfParser::opFillStroke(Object /*ar
return;
}
if (state->isPath()) {
- doFillAndStroke(gFalse);
+ doFillAndStroke(false);
} else {
builder->addPath(state, true, true);
}
@@ -1661,7 +1661,7 @@ void PdfParser::opCloseFillStroke(Object
}
if (state->isPath()) {
state->closePath();
- doFillAndStroke(gFalse);
+ doFillAndStroke(false);
}
doEndPath();
}
@@ -1673,7 +1673,7 @@ void PdfParser::opEOFillStroke(Object /*
return;
}
if (state->isPath()) {
- doFillAndStroke(gTrue);
+ doFillAndStroke(true);
}
doEndPath();
}
@@ -1686,20 +1686,20 @@ void PdfParser::opCloseEOFillStroke(Obje
}
if (state->isPath()) {
state->closePath();
- doFillAndStroke(gTrue);
+ doFillAndStroke(true);
}
doEndPath();
}
-void PdfParser::doFillAndStroke(GBool eoFill) {
- GBool fillOk = gTrue, strokeOk = gTrue;
+void PdfParser::doFillAndStroke(bool eoFill) {
+ bool fillOk = true, strokeOk = true;
if (state->getFillColorSpace()->getMode() == csPattern &&
!builder->isPatternTypeSupported(state->getFillPattern())) {
- fillOk = gFalse;
+ fillOk = false;
}
if (state->getStrokeColorSpace()->getMode() == csPattern &&
!builder->isPatternTypeSupported(state->getStrokePattern())) {
- strokeOk = gFalse;
+ strokeOk = false;
}
if (fillOk && strokeOk) {
builder->addPath(state, true, true, eoFill);
@@ -1709,7 +1709,7 @@ void PdfParser::doFillAndStroke(GBool eo
}
}
-void PdfParser::doPatternFillFallback(GBool eoFill) {
+void PdfParser::doPatternFillFallback(bool eoFill) {
GfxPattern *pattern;
if (!(pattern = state->getFillPattern())) {
@@ -1719,7 +1719,7 @@ void PdfParser::doPatternFillFallback(GB
case 1:
break;
case 2:
- doShadingPatternFillFallback(static_cast<GfxShadingPattern *>(pattern), gFalse, eoFill);
+ doShadingPatternFillFallback(static_cast<GfxShadingPattern *>(pattern), false, eoFill);
break;
default:
error(errUnimplemented, getPos(), "Unimplemented pattern type (%d) in fill",
@@ -1738,7 +1738,7 @@ void PdfParser::doPatternStrokeFallback(
case 1:
break;
case 2:
- doShadingPatternFillFallback(static_cast<GfxShadingPattern *>(pattern), gTrue, gFalse);
+ doShadingPatternFillFallback(static_cast<GfxShadingPattern *>(pattern), true, false);
break;
default:
error(errUnimplemented, getPos(), "Unimplemented pattern type ({0:d}) in stroke",
@@ -1748,10 +1748,10 @@ void PdfParser::doPatternStrokeFallback(
}
void PdfParser::doShadingPatternFillFallback(GfxShadingPattern *sPat,
- GBool stroke, GBool eoFill) {
+ bool stroke, bool eoFill) {
GfxShading *shading;
GfxPath *savedPath;
- double *ctm, *btm, *ptm;
+ const double *ctm, *btm, *ptm;
double m[6], ictm[6], m1[6];
double xMin, yMin, xMax, yMax;
double det;
@@ -1862,7 +1862,7 @@ void PdfParser::opShFill(Object args[],
double xTemp, yTemp;
double gradientTransform[6];
double *matrix = NULL;
- GBool savedState = gFalse;
+ bool savedState = false;
#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
if (!(shading = res->lookupShading(args[0].getName(), NULL, NULL))) {
@@ -1878,13 +1878,13 @@ void PdfParser::opShFill(Object args[],
if (shading->getType() != 2 && shading->getType() != 3) {
savedPath = state->getPath()->copy();
saveState();
- savedState = gTrue;
+ savedState = true;
} else { // get gradient transform if possible
// check proper operator sequence
// first there should be one W(*) and then one 'cm' somewhere before 'sh'
- GBool seenClip, seenConcat;
+ bool seenClip, seenConcat;
seenClip = (clipHistory->getClipPath() != NULL);
- seenConcat = gFalse;
+ seenConcat = false;
int i = 1;
while (i <= maxOperatorHistoryDepth) {
const char *opName = getPreviousOperator(i);
@@ -1892,7 +1892,7 @@ void PdfParser::opShFill(Object args[],
if (seenConcat) { // more than one 'cm'
break;
} else {
- seenConcat = gTrue;
+ seenConcat = true;
}
}
i++;
@@ -1993,7 +1993,7 @@ void PdfParser::doFunctionShFill1(GfxFun
GfxColor color0M, color1M, colorM0, colorM1, colorMM;
GfxColor colors2[4];
double functionColorDelta = colorDeltas[pdfFunctionShading-1];
- double *matrix;
+ const double *matrix;
double xM, yM;
int nComps, i, j;
@@ -2173,7 +2173,7 @@ void PdfParser::doPatchMeshShFill(GfxPat
}
}
-void PdfParser::fillPatch(GfxPatch *patch, int nComps, int depth) {
+void PdfParser::fillPatch(const GfxPatch *patch, int nComps, int depth) {
GfxPatch patch00 = blankPatch();
GfxPatch patch01 = blankPatch();
GfxPatch patch10 = blankPatch();
@@ -2347,7 +2347,7 @@ void PdfParser::opBeginText(Object /*arg
state->setTextMat(1, 0, 0, 1, 0, 0);
state->textMoveTo(0, 0);
builder->updateTextPosition(0.0, 0.0);
- fontChanged = gTrue;
+ fontChanged = true;
builder->beginTextObject(state);
}
@@ -2375,20 +2375,20 @@ void PdfParser::opSetFont(Object args[],
// unsetting the font (drawing no text) is better than using the
// previous one and drawing random glyphs from it
state->setFont(NULL, args[1].getNum());
- fontChanged = gTrue;
+ fontChanged = true;
return;
}
if (printCommands) {
printf(" font: tag=%s name='%s' %g\n",
- font->getTag()->getCString(),
- font->getName() ? font->getName()->getCString() : "???",
+ font->getTag()->c_str(),
+ font->getName() ? font->getName()->c_str() : "???",
args[1].getNum());
fflush(stdout);
}
font->incRefCnt();
state->setFont(font, args[1].getNum());
- fontChanged = gTrue;
+ fontChanged = true;
}
// TODO not good that numArgs is ignored but args[] is used:
@@ -2421,7 +2421,7 @@ void PdfParser::opSetHorizScaling(Object
{
state->setHorizScaling(args[0].getNum());
builder->updateTextMatrix(state);
- fontChanged = gTrue;
+ fontChanged = true;
}
//------------------------------------------------------------------------
@@ -2461,7 +2461,7 @@ void PdfParser::opSetTextMatrix(Object a
state->textMoveTo(0, 0);
builder->updateTextMatrix(state);
builder->updateTextPosition(0.0, 0.0);
- fontChanged = gTrue;
+ fontChanged = true;
}
void PdfParser::opTextNextLine(Object /*args*/[], int /*numArgs*/)
@@ -2487,7 +2487,7 @@ void PdfParser::opShowText(Object args[]
}
if (fontChanged) {
builder->updateFont(state);
- fontChanged = gFalse;
+ fontChanged = false;
}
doShowText(args[0].getString());
}
@@ -2504,7 +2504,7 @@ void PdfParser::opMoveShowText(Object ar
}
if (fontChanged) {
builder->updateFont(state);
- fontChanged = gFalse;
+ fontChanged = false;
}
tx = state->getLineX();
ty = state->getLineY() - state->getLeading();
@@ -2525,7 +2525,7 @@ void PdfParser::opMoveSetShowText(Object
}
if (fontChanged) {
builder->updateFont(state);
- fontChanged = gFalse;
+ fontChanged = false;
}
state->setWordSpace(args[0].getNum());
state->setCharSpace(args[1].getNum());
@@ -2549,7 +2549,7 @@ void PdfParser::opShowSpaceText(Object a
}
if (fontChanged) {
builder->updateFont(state);
- fontChanged = gFalse;
+ fontChanged = false;
}
wMode = state->getFont()->getWMode();
a = args[0].getArray();
@@ -2586,11 +2586,11 @@ void PdfParser::doShowText(const GooStri
int wMode;
double riseX, riseY;
CharCode code;
- Unicode *u = NULL;
+ Unicode const *u = NULL;
double x, y, dx, dy, tdx, tdy;
double originX, originY, tOriginX, tOriginY;
double oldCTM[6], newCTM[6];
- double *mat;
+ const double *mat;
Object charProc;
Dict *resDict;
Parser *oldParser;
@@ -2630,7 +2630,7 @@ void PdfParser::doShowText(const GooStri
double lineX = state->getLineX();
double lineY = state->getLineY();
oldParser = parser;
- p = g_strdup(s->getCString());
+ p = g_strdup(s->c_str());
len = s->getLength();
while (len > 0) {
n = font->getNextChar(p, len, &code,
@@ -2659,7 +2659,7 @@ void PdfParser::doShowText(const GooStri
pushResources(resDict);
}
if (charProc.isStream()) {
- //parse(&charProc, gFalse); // TODO: parse into SVG font
+ //parse(&charProc, false); // TODO: parse into SVG font
} else {
error(errSyntaxError, getPos(), "Missing or bad Type3 CharProc entry");
}
@@ -2685,7 +2685,7 @@ void PdfParser::doShowText(const GooStri
} else {
state->textTransformDelta(0, state->getRise(), &riseX, &riseY);
- p = g_strdup(s->getCString());
+ p = g_strdup(s->c_str());
len = s->getLength();
while (len > 0) {
n = font->getNextChar(p, len, &code,
@@ -2757,7 +2757,7 @@ void PdfParser::opXObject(Object args[],
#else
res->lookupXObjectNF(name, &refObj);
#endif
- doImage(&refObj, obj1.getStream(), gFalse);
+ doImage(&refObj, obj1.getStream(), false);
#if !defined(POPPLER_NEW_OBJECT_API)
refObj.free();
#endif
@@ -2782,19 +2782,19 @@ void PdfParser::opXObject(Object args[],
#endif
}
-void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg)
+void PdfParser::doImage(Object * /*ref*/, Stream *str, bool inlineImg)
{
Dict *dict;
int width, height;
int bits;
- GBool interpolate;
+ bool interpolate;
StreamColorSpaceMode csMode;
- GBool mask;
- GBool invert;
+ bool mask;
+ bool invert;
Object maskObj, smaskObj;
- GBool haveColorKeyMask, haveExplicitMask, haveSoftMask;
- GBool maskInvert;
- GBool maskInterpolate;
+ bool haveColorKeyMask, haveExplicitMask, haveSoftMask;
+ bool maskInvert;
+ bool maskInterpolate;
Object obj1, obj2;
// get info from the stream
@@ -2872,11 +2872,11 @@ void PdfParser::doImage(Object * /*ref*/
if (obj1.isBool())
interpolate = obj1.getBool();
else
- interpolate = gFalse;
+ interpolate = false;
#if !defined(POPPLER_NEW_OBJECT_API)
obj1.free();
#endif
- maskInterpolate = gFalse;
+ maskInterpolate = false;
// image or mask?
#if defined(POPPLER_NEW_OBJECT_API)
@@ -2892,7 +2892,7 @@ void PdfParser::doImage(Object * /*ref*/
dict->lookup(const_cast<char*>("IM"), &obj1);
#endif
}
- mask = gFalse;
+ mask = false;
if (obj1.isBool()) {
mask = obj1.getBool();
}
@@ -2936,7 +2936,7 @@ void PdfParser::doImage(Object * /*ref*/
if (bits != 1) {
goto err1;
}
- invert = gFalse;
+ invert = false;
#if defined(POPPLER_NEW_OBJECT_API)
obj1 = dict->lookup(const_cast<char*>("Decode"));
#else
@@ -2957,7 +2957,7 @@ void PdfParser::doImage(Object * /*ref*/
obj1.arrayGet(0, &obj2);
#endif
if (obj2.isInt() && obj2.getInt() == 1) {
- invert = gTrue;
+ invert = true;
}
#if !defined(POPPLER_NEW_OBJECT_API)
obj2.free();
@@ -3054,11 +3054,11 @@ void PdfParser::doImage(Object * /*ref*/
// get the mask
int maskColors[2*gfxColorMaxComps];
- haveColorKeyMask = haveExplicitMask = haveSoftMask = gFalse;
+ haveColorKeyMask = haveExplicitMask = haveSoftMask = false;
Stream *maskStr = NULL;
int maskWidth = 0;
int maskHeight = 0;
- maskInvert = gFalse;
+ maskInvert = false;
GfxImageColorMap *maskColorMap = NULL;
#if defined(POPPLER_NEW_OBJECT_API)
maskObj = dict->lookup(const_cast<char*>("Mask"));
@@ -3145,7 +3145,7 @@ void PdfParser::doImage(Object * /*ref*/
if (obj1.isBool())
maskInterpolate = obj1.getBool();
else
- maskInterpolate = gFalse;
+ maskInterpolate = false;
#if defined(POPPLER_NEW_OBJECT_API)
obj1 = maskDict->lookup(const_cast<char*>("ColorSpace"));
#else
@@ -3214,7 +3214,7 @@ void PdfParser::doImage(Object * /*ref*/
goto err1;
}
//~ handle the Matte entry
- haveSoftMask = gTrue;
+ haveSoftMask = true;
} else if (maskObj.isArray()) {
// color key mask
int i;
@@ -3229,7 +3229,7 @@ void PdfParser::doImage(Object * /*ref*/
obj1.free();
#endif
}
- haveColorKeyMask = gTrue;
+ haveColorKeyMask = true;
} else if (maskObj.isStream()) {
// explicit mask
if (inlineImg) {
@@ -3306,11 +3306,11 @@ void PdfParser::doImage(Object * /*ref*/
if (obj1.isBool())
maskInterpolate = obj1.getBool();
else
- maskInterpolate = gFalse;
+ maskInterpolate = false;
#if !defined(POPPLER_NEW_OBJECT_API)
obj1.free();
#endif
- maskInvert = gFalse;
+ maskInvert = false;
#if defined(POPPLER_NEW_OBJECT_API)
obj1 = maskDict->lookup(const_cast<char*>("Decode"));
#else
@@ -3331,7 +3331,7 @@ void PdfParser::doImage(Object * /*ref*/
obj1.arrayGet(0, &obj2);
#endif
if (obj2.isInt() && obj2.getInt() == 1) {
- maskInvert = gTrue;
+ maskInvert = true;
}
#if !defined(POPPLER_NEW_OBJECT_API)
obj2.free();
@@ -3342,7 +3342,7 @@ void PdfParser::doImage(Object * /*ref*/
#if !defined(POPPLER_NEW_OBJECT_API)
obj1.free();
#endif
- haveExplicitMask = gTrue;
+ haveExplicitMask = true;
}
// draw it
@@ -3377,7 +3377,7 @@ void PdfParser::doImage(Object * /*ref*/
void PdfParser::doForm(Object *str) {
Dict *dict;
- GBool transpGroup, isolated, knockout;
+ bool transpGroup, isolated, knockout;
GfxColorSpace *blendingColorSpace;
Object matrixObj, bboxObj;
double m[6], bbox[4];
@@ -3471,7 +3471,7 @@ void PdfParser::doForm(Object *str) {
resDict = resObj.isDict() ? resObj.getDict() : (Dict *)NULL;
// check for a transparency group
- transpGroup = isolated = knockout = gFalse;
+ transpGroup = isolated = knockout = false;
blendingColorSpace = NULL;
#if defined(POPPLER_NEW_OBJECT_API)
if ((obj1 = dict->lookup(const_cast<char*>("Group"))).isDict()) {
@@ -3480,7 +3480,7 @@ void PdfParser::doForm(Object *str) {
if (dict->lookup(const_cast<char*>("Group"), &obj1)->isDict()) {
if (obj1.dictLookup(const_cast<char*>("S"), &obj2)->isName(const_cast<char*>("Transparency"))) {
#endif
- transpGroup = gTrue;
+ transpGroup = true;
#if defined(POPPLER_NEW_OBJECT_API)
if (!((obj3 = obj1.dictLookup(const_cast<char*>("CS"))).isNull())) {
#else
@@ -3524,7 +3524,7 @@ void PdfParser::doForm(Object *str) {
// draw it
++formDepth;
doForm1(str, resDict, m, bbox,
- transpGroup, gFalse, blendingColorSpace, isolated, knockout);
+ transpGroup, false, blendingColorSpace, isolated, knockout);
--formDepth;
if (blendingColorSpace) {
@@ -3536,10 +3536,10 @@ void PdfParser::doForm(Object *str) {
}
void PdfParser::doForm1(Object *str, Dict *resDict, double *matrix, double *bbox,
- GBool transpGroup, GBool softMask,
+ bool transpGroup, bool softMask,
GfxColorSpace *blendingColorSpace,
- GBool isolated, GBool knockout,
- GBool alpha, Function *transferFunc,
+ bool isolated, bool knockout,
+ bool alpha, Function *transferFunc,
GfxColor *backdropColor) {
Parser *oldParser;
double oldBaseMatrix[6];
@@ -3600,7 +3600,7 @@ void PdfParser::doForm1(Object *str, Dic
}
// draw the form
- parse(str, gFalse);
+ parse(str, false);
// restore base matrix
for (i = 0; i < 6; ++i) {
@@ -3640,7 +3640,7 @@ void PdfParser::opBeginImage(Object /*ar
// display the image
if (str) {
- doImage(NULL, str, gTrue);
+ doImage(NULL, str, true);
// skip 'EI' tag
int c1 = str->getUndecodedStream()->getChar();
@@ -3686,7 +3686,7 @@ Stream *PdfParser::buildImageStream() {
break;
}
#if defined(POPPLER_NEW_OBJECT_API)
- dict.dictAdd(key, std::move(obj));
+ dict.dictAdd((const char *) key, std::move(obj));
}
obj = parser->getObj();
#else
@@ -3709,10 +3709,10 @@ Stream *PdfParser::buildImageStream() {
// make stream
#if defined(POPPLER_NEW_OBJECT_API)
- str = new EmbedStream(parser->getStream(), dict.copy(), gFalse, 0);
+ str = new EmbedStream(parser->getStream(), dict.copy(), false, 0);
str = str->addFilters(dict.getDict());
#else
- str = new EmbedStream(parser->getStream(), &dict, gFalse, 0);
+ str = new EmbedStream(parser->getStream(), &dict, false, 0);
str = str->addFilters(&dict);
#endif
@@ -3875,7 +3875,7 @@ ClipHistoryEntry::~ClipHistoryEntry()
}
}
-void ClipHistoryEntry::setClip(GfxPath *clipPathA, GfxClipType clipTypeA) {
+void ClipHistoryEntry::setClip(const GfxPath *clipPathA, GfxClipType clipTypeA) {
// Free previous clip path
if (clipPath) {
delete clipPath;
--- inkscape-0.92.3/src/extension/internal/pdfinput/pdf-parser.h
+++ inkscape-0.92.3/src/extension/internal/pdfinput/pdf-parser.h
@@ -25,7 +25,7 @@ namespace Inkscape {
// TODO clean up and remove using:
using Inkscape::Extension::Internal::SvgBuilder;
-#include "goo/gtypes.h"
+/*#include "goo/gtypes.h"*/
#include "Object.h"
class GooString;
@@ -96,7 +96,7 @@ struct PdfOperator {
struct OpHistoryEntry {
const char *name; // operator's name
GfxState *state; // saved state, NULL if none
- GBool executed; // whether the operator has been executed
+ bool executed; // whether the operator has been executed
OpHistoryEntry *next; // next entry on stack
unsigned depth; // total number of entries descending from this
@@ -127,16 +127,16 @@ public:
// Constructor for regular output.
PdfParser(XRef *xrefA, SvgBuilder *builderA, int pageNum, int rotate,
- Dict *resDict, PDFRectangle *box, PDFRectangle *cropBox);
+ Dict *resDict, const PDFRectangle *box, const PDFRectangle *cropBox);
// Constructor for a sub-page object.
PdfParser(XRef *xrefA, Inkscape::Extension::Internal::SvgBuilder *builderA,
- Dict *resDict, PDFRectangle *box);
+ Dict *resDict, const PDFRectangle *box);
virtual ~PdfParser();
// Interpret a stream or array of streams.
- void parse(Object *obj, GBool topLevel = gTrue);
+ void parse(Object *obj, bool topLevel = true);
// Save graphics state.
void saveState();
@@ -154,12 +154,12 @@ private:
XRef *xref; // the xref table for this PDF file
SvgBuilder *builder; // SVG generator
- GBool subPage; // is this a sub-page object?
- GBool printCommands; // print the drawing commands (for debugging)
+ bool subPage; // is this a sub-page object?
+ bool printCommands; // print the drawing commands (for debugging)
GfxResources *res; // resource stack
GfxState *state; // current graphics state
- GBool fontChanged; // set if font or text matrix has changed
+ bool fontChanged; // set if font or text matrix has changed
GfxClipType clip; // do a clip?
int ignoreUndef; // current BX/EX nesting level
double baseMatrix[6]; // default matrix for most recent
@@ -183,10 +183,10 @@ private:
OpHistoryEntry *popOperator();
const char *getPreviousOperator(unsigned int look_back=1); // returns the nth previous operator's name
- void go(GBool topLevel);
+ void go(bool topLevel);
void execOp(Object *cmd, Object args[], int numArgs);
- PdfOperator *findOp(char *name);
- GBool checkArg(Object *arg, TchkType type);
+ PdfOperator *findOp(const char *name);
+ bool checkArg(Object *arg, TchkType type);
int getPos();
// graphics state operators
@@ -200,9 +200,9 @@ private:
void opSetMiterLimit(Object args[], int numArgs);
void opSetLineWidth(Object args[], int numArgs);
void opSetExtGState(Object args[], int numArgs);
- void doSoftMask(Object *str, GBool alpha,
+ void doSoftMask(Object *str, bool alpha,
GfxColorSpace *blendingColorSpace,
- GBool isolated, GBool knockout,
+ bool isolated, bool knockout,
Function *transferFunc, GfxColor *backdropColor);
void opSetRenderingIntent(Object args[], int numArgs);
@@ -239,11 +239,11 @@ private:
void opCloseFillStroke(Object args[], int numArgs);
void opEOFillStroke(Object args[], int numArgs);
void opCloseEOFillStroke(Object args[], int numArgs);
- void doFillAndStroke(GBool eoFill);
- void doPatternFillFallback(GBool eoFill);
+ void doFillAndStroke(bool eoFill);
+ void doPatternFillFallback(bool eoFill);
void doPatternStrokeFallback();
void doShadingPatternFillFallback(GfxShadingPattern *sPat,
- GBool stroke, GBool eoFill);
+ bool stroke, bool eoFill);
void opShFill(Object args[], int numArgs);
void doFunctionShFill(GfxFunctionShading *shading);
void doFunctionShFill1(GfxFunctionShading *shading,
@@ -256,7 +256,7 @@ private:
double x2, double y2, GfxColor *color2,
int nComps, int depth);
void doPatchMeshShFill(GfxPatchMeshShading *shading);
- void fillPatch(GfxPatch *patch, int nComps, int depth);
+ void fillPatch(const GfxPatch *patch, int nComps, int depth);
void doEndPath();
// path clipping operators
@@ -291,13 +291,13 @@ private:
// XObject operators
void opXObject(Object args[], int numArgs);
- void doImage(Object *ref, Stream *str, GBool inlineImg);
+ void doImage(Object *ref, Stream *str, bool inlineImg);
void doForm(Object *str);
void doForm1(Object *str, Dict *resDict, double *matrix, double *bbox,
- GBool transpGroup = gFalse, GBool softMask = gFalse,
+ bool transpGroup = false, bool softMask = false,
GfxColorSpace *blendingColorSpace = NULL,
- GBool isolated = gFalse, GBool knockout = gFalse,
- GBool alpha = gFalse, Function *transferFunc = NULL,
+ bool isolated = false, bool knockout = false,
+ bool alpha = false, Function *transferFunc = NULL,
GfxColor *backdropColor = NULL);
// in-line image operators
--- inkscape-0.92.3/src/extension/internal/pdfinput/svg-builder.cpp
+++ inkscape-0.92.3/src/extension/internal/pdfinput/svg-builder.cpp
@@ -264,10 +264,10 @@ static void svgSetTransform(Inkscape::XM
/**
* \brief Generates a SVG path string from poppler's data structure
*/
-static gchar *svgInterpretPath(GfxPath *path) {
+static gchar *svgInterpretPath(const GfxPath *path) {
Inkscape::SVG::PathString pathString;
for (int i = 0 ; i < path->getNumSubpaths() ; ++i ) {
- GfxSubpath *subpath = path->getSubpath(i);
+ const GfxSubpath *subpath = path->getSubpath(i);
if (subpath->getNumPoints() > 0) {
pathString.moveTo(subpath->getX(0), subpath->getY(0));
int j = 1;
@@ -625,7 +625,7 @@ gchar *SvgBuilder::_createPattern(GfxPat
if ( pattern != NULL ) {
if ( pattern->getType() == 2 ) { // Shading pattern
GfxShadingPattern *shading_pattern = static_cast<GfxShadingPattern *>(pattern);
- double *ptm;
+ const double *ptm;
double m[6] = {1, 0, 0, 1, 0, 0};
double det;
@@ -672,7 +672,7 @@ gchar *SvgBuilder::_createTilingPattern(
Inkscape::XML::Node *pattern_node = _xml_doc->createElement("svg:pattern");
// Set pattern transform matrix
- double *p2u = tiling_pattern->getMatrix();
+ const double *p2u = tiling_pattern->getMatrix();
double m[6] = {1, 0, 0, 1, 0, 0};
double det;
det = _ttm[0] * _ttm[3] - _ttm[1] * _ttm[2]; // see LP Bug 1168908
@@ -698,7 +698,7 @@ gchar *SvgBuilder::_createTilingPattern(
pattern_node->setAttribute("patternUnits", "userSpaceOnUse");
// Set pattern tiling
// FIXME: don't ignore XStep and YStep
- double *bbox = tiling_pattern->getBBox();
+ const double *bbox = tiling_pattern->getBBox();
sp_repr_set_svg_double(pattern_node, "x", 0.0);
sp_repr_set_svg_double(pattern_node, "y", 0.0);
sp_repr_set_svg_double(pattern_node, "width", bbox[2] - bbox[0]);
@@ -751,7 +751,7 @@ gchar *SvgBuilder::_createTilingPattern(
*/
gchar *SvgBuilder::_createGradient(GfxShading *shading, double *matrix, bool for_shading) {
Inkscape::XML::Node *gradient;
- Function *func;
+ const Function *func;
int num_funcs;
bool extend0, extend1;
@@ -865,7 +865,7 @@ static bool svgGetShadingColorRGB(GfxSha
#define INT_EPSILON 8
bool SvgBuilder::_addGradientStops(Inkscape::XML::Node *gradient, GfxShading *shading,
- Function *func) {
+ const Function *func) {
int type = func->getType();
if ( type == 0 || type == 2 ) { // Sampled or exponential function
GfxRGB stop1, stop2;
@@ -877,9 +877,9 @@ bool SvgBuilder::_addGradientStops(Inksc
_addStopToGradient(gradient, 1.0, &stop2, 1.0);
}
} else if ( type == 3 ) { // Stitching
- StitchingFunction *stitchingFunc = static_cast<StitchingFunction*>(func);
- double *bounds = stitchingFunc->getBounds();
- double *encode = stitchingFunc->getEncode();
+ auto stitchingFunc = static_cast<const StitchingFunction*>(func);
+ const double *bounds = stitchingFunc->getBounds();
+ const double *encode = stitchingFunc->getEncode();
int num_funcs = stitchingFunc->getNumFuncs();
// Add stops from all the stitched functions
@@ -890,7 +890,7 @@ bool SvgBuilder::_addGradientStops(Inksc
svgGetShadingColorRGB(shading, bounds[i + 1], &color);
// Add stops
if (stitchingFunc->getFunc(i)->getType() == 2) { // process exponential fxn
- double expE = (static_cast<ExponentialFunction*>(stitchingFunc->getFunc(i)))->getE();
+ double expE = (static_cast<const ExponentialFunction*>(stitchingFunc->getFunc(i)))->getE();
if (expE > 1.0) {
expE = (bounds[i + 1] - bounds[i])/expE; // approximate exponential as a single straight line at x=1
if (encode[2*i] == 0) { // normal sequence
@@ -1020,7 +1020,7 @@ void SvgBuilder::updateFont(GfxState *st
GfxFont *font = state->getFont();
// Store original name
if (font->getName()) {
- _font_specification = g_strdup(font->getName()->getCString());
+ _font_specification = g_strdup(font->getName()->c_str());
} else {
_font_specification = (char*) "Arial";
}
@@ -1047,7 +1047,7 @@ void SvgBuilder::updateFont(GfxState *st
// Font family
if (font->getFamily()) { // if font family is explicitly given use it.
- sp_repr_css_set_property(_font_style, "font-family", font->getFamily()->getCString());
+ sp_repr_css_set_property(_font_style, "font-family", font->getFamily()->c_str());
} else {
int attr_value = 1;
sp_repr_get_int(_preferences, "localFonts", &attr_value);
@@ -1148,7 +1148,7 @@ void SvgBuilder::updateFont(GfxState *st
Inkscape::CSSOStringStream os_font_size;
double css_font_size = _font_scaling * state->getFontSize();
if ( font->getType() == fontType3 ) {
- double *font_matrix = font->getFontMatrix();
+ const double *font_matrix = font->getFontMatrix();
if ( font_matrix[0] != 0.0 ) {
css_font_size *= font_matrix[3] / font_matrix[0];
}
@@ -1193,7 +1193,7 @@ void SvgBuilder::updateTextPosition(doub
void SvgBuilder::updateTextMatrix(GfxState *state) {
_flushText();
// Update text matrix
- double *text_matrix = state->getTextMat();
+ const double *text_matrix = state->getTextMat();
double w_scale = sqrt( text_matrix[0] * text_matrix[0] + text_matrix[2] * text_matrix[2] );
double h_scale = sqrt( text_matrix[1] * text_matrix[1] + text_matrix[3] * text_matrix[3] );
double max_scale;
@@ -1379,7 +1379,7 @@ void SvgBuilder::beginString(GfxState *s
void SvgBuilder::addChar(GfxState *state, double x, double y,
double dx, double dy,
double originX, double originY,
- CharCode /*code*/, int /*nBytes*/, Unicode *u, int uLen) {
+ CharCode /*code*/, int /*nBytes*/, Unicode const *u, int uLen) {
bool is_space = ( uLen == 1 && u[0] == 32 );
--- inkscape-0.92.3/src/extension/internal/pdfinput/svg-builder.h
+++ inkscape-0.92.3/src/extension/internal/pdfinput/svg-builder.h
@@ -140,7 +140,7 @@ public:
void addChar(GfxState *state, double x, double y,
double dx, double dy,
double originX, double originY,
- CharCode code, int nBytes, Unicode *u, int uLen);
+ CharCode code, int nBytes, Unicode const *u, int uLen);
void beginTextObject(GfxState *state);
void endTextObject(GfxState *state);
@@ -174,7 +174,7 @@ private:
void _addStopToGradient(Inkscape::XML::Node *gradient, double offset,
GfxRGB *color, double opacity);
bool _addGradientStops(Inkscape::XML::Node *gradient, GfxShading *shading,
- Function *func);
+ const Function *func);
gchar *_createTilingPattern(GfxTilingPattern *tiling_pattern, GfxState *state,
bool is_stroke=false);
// Image/mask creation