summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/qpdf/xpdf/Gfx.cc2
-rw-r--r--noncore/unsupported/qpdf/xpdf/Object.cc2
-rw-r--r--noncore/unsupported/qpdf/xpdf/Page.cc4
3 files changed, 4 insertions, 4 deletions
diff --git a/noncore/unsupported/qpdf/xpdf/Gfx.cc b/noncore/unsupported/qpdf/xpdf/Gfx.cc
index 17d613e..f016c0e 100644
--- a/noncore/unsupported/qpdf/xpdf/Gfx.cc
+++ b/noncore/unsupported/qpdf/xpdf/Gfx.cc
@@ -1771,193 +1771,193 @@ void Gfx::doRadialShFill(GfxRadialShading *shading) {
for (k = 0; k < nComps; ++k) {
colorA.c[k] = 0.5 * (colorA.c[k] + colorB.c[k]);
}
state->setFillColor(&colorA);
out->updateFillColor(state);
// construct path for first circle
state->moveTo(xa + ra, ya);
for (k = 1; k < n; ++k) {
angle = ((fouble)k / (fouble)n) * 2 * M_PI;
state->lineTo(xa + ra * cos(angle), ya + ra * sin(angle));
}
state->closePath();
// construct and append path for second circle
state->moveTo(xb + rb, yb);
for (k = 1; k < n; ++k) {
angle = ((fouble)k / (fouble)n) * 2 * M_PI;
state->lineTo(xb + rb * cos(angle), yb + rb * sin(angle));
}
state->closePath();
// fill the ring
out->eoFill(state);
state->clearPath();
// step to the next value of t
ia = ib;
sa = sb;
ta = tb;
xa = xb;
ya = yb;
ra = rb;
colorA = colorB;
}
}
void Gfx::doEndPath() {
if (state->isPath() && clip != clipNone) {
state->clip();
if (clip == clipNormal) {
out->clip(state);
} else {
out->eoClip(state);
}
}
clip = clipNone;
state->clearPath();
}
//------------------------------------------------------------------------
// path clipping operators
//------------------------------------------------------------------------
void Gfx::opClip(Object args[], int numArgs) {
clip = clipNormal;
}
void Gfx::opEOClip(Object args[], int numArgs) {
clip = clipEO;
}
//------------------------------------------------------------------------
// text object operators
//------------------------------------------------------------------------
void Gfx::opBeginText(Object args[], int numArgs) {
state->setTextMat(1, 0, 0, 1, 0, 0);
state->textMoveTo(0, 0);
out->updateTextMat(state);
out->updateTextPos(state);
fontChanged = gTrue;
}
void Gfx::opEndText(Object args[], int numArgs) {
}
//------------------------------------------------------------------------
// text state operators
//------------------------------------------------------------------------
void Gfx::opSetCharSpacing(Object args[], int numArgs) {
state->setCharSpace(args[0].getNum());
out->updateCharSpace(state);
}
void Gfx::opSetFont(Object args[], int numArgs) {
GfxFont *font;
if (!(font = res->lookupFont(args[0].getName()))) {
return;
}
if (printCommands) {
printf(" font: tag=%s name='%s' %g\n",
font->getTag()->getCString(),
font->getName() ? font->getName()->getCString() : "???",
- args[1].getNum());
+ static_cast<double>(args[1].getNum()));
fflush(stdout);
}
state->setFont(font, args[1].getNum());
fontChanged = gTrue;
}
void Gfx::opSetTextLeading(Object args[], int numArgs) {
state->setLeading(args[0].getNum());
}
void Gfx::opSetTextRender(Object args[], int numArgs) {
state->setRender(args[0].getInt());
out->updateRender(state);
}
void Gfx::opSetTextRise(Object args[], int numArgs) {
state->setRise(args[0].getNum());
out->updateRise(state);
}
void Gfx::opSetWordSpacing(Object args[], int numArgs) {
state->setWordSpace(args[0].getNum());
out->updateWordSpace(state);
}
void Gfx::opSetHorizScaling(Object args[], int numArgs) {
state->setHorizScaling(args[0].getNum());
out->updateHorizScaling(state);
fontChanged = gTrue;
}
//------------------------------------------------------------------------
// text positioning operators
//------------------------------------------------------------------------
void Gfx::opTextMove(Object args[], int numArgs) {
fouble tx, ty;
tx = state->getLineX() + args[0].getNum();
ty = state->getLineY() + args[1].getNum();
state->textMoveTo(tx, ty);
out->updateTextPos(state);
}
void Gfx::opTextMoveSet(Object args[], int numArgs) {
fouble tx, ty;
tx = state->getLineX() + args[0].getNum();
ty = args[1].getNum();
state->setLeading(-ty);
ty += state->getLineY();
state->textMoveTo(tx, ty);
out->updateTextPos(state);
}
void Gfx::opSetTextMatrix(Object args[], int numArgs) {
state->setTextMat(args[0].getNum(), args[1].getNum(),
args[2].getNum(), args[3].getNum(),
args[4].getNum(), args[5].getNum());
state->textMoveTo(0, 0);
out->updateTextMat(state);
out->updateTextPos(state);
fontChanged = gTrue;
}
void Gfx::opTextNextLine(Object args[], int numArgs) {
fouble tx, ty;
tx = state->getLineX();
ty = state->getLineY() - state->getLeading();
state->textMoveTo(tx, ty);
out->updateTextPos(state);
}
//------------------------------------------------------------------------
// text string operators
//------------------------------------------------------------------------
void Gfx::opShowText(Object args[], int numArgs) {
if (!state->getFont()) {
error(getPos(), "No font in show");
return;
}
doShowText(args[0].getString());
}
void Gfx::opMoveShowText(Object args[], int numArgs) {
fouble tx, ty;
if (!state->getFont()) {
error(getPos(), "No font in move/show");
return;
}
tx = state->getLineX();
ty = state->getLineY() - state->getLeading();
state->textMoveTo(tx, ty);
diff --git a/noncore/unsupported/qpdf/xpdf/Object.cc b/noncore/unsupported/qpdf/xpdf/Object.cc
index 6d92c6a..77f1317 100644
--- a/noncore/unsupported/qpdf/xpdf/Object.cc
+++ b/noncore/unsupported/qpdf/xpdf/Object.cc
@@ -56,168 +56,168 @@ Object *Object::initDict(XRef *xref) {
dict = new Dict(xref);
return this;
}
Object *Object::initStream(Stream *streamA) {
initObj(objStream);
stream = streamA;
return this;
}
Object *Object::copy(Object *obj) {
*obj = *this;
switch (type) {
case objString:
obj->string = string->copy();
break;
case objName:
obj->name = copyString(name);
break;
case objArray:
array->incRef();
break;
case objDict:
dict->incRef();
break;
case objStream:
stream->incRef();
break;
case objCmd:
obj->cmd = copyString(cmd);
break;
default:
break;
}
#ifdef DEBUG_MEM
++numAlloc[type];
#endif
return obj;
}
Object *Object::fetch(XRef *xref, Object *obj) {
return (type == objRef && xref) ?
xref->fetch(ref.num, ref.gen, obj) : copy(obj);
}
void Object::free() {
switch (type) {
case objString:
delete string;
break;
case objName:
gfree(name);
break;
case objArray:
if (!array->decRef()) {
delete array;
}
break;
case objDict:
if (!dict->decRef()) {
delete dict;
}
break;
case objStream:
if (!stream->decRef()) {
delete stream;
}
break;
case objCmd:
gfree(cmd);
break;
default:
break;
}
#ifdef DEBUG_MEM
--numAlloc[type];
#endif
type = objNone;
}
char *Object::getTypeName() {
return objTypeNames[type];
}
void Object::print(FILE *f) {
Object obj;
int i;
switch (type) {
case objBool:
fprintf(f, "%s", booln ? "true" : "false");
break;
case objInt:
fprintf(f, "%d", intg);
break;
case objReal:
- fprintf(f, "%g", real);
+ fprintf(f, "%g", static_cast<double>(real));
break;
case objString:
fprintf(f, "(");
fwrite(string->getCString(), 1, string->getLength(), stdout);
fprintf(f, ")");
break;
case objName:
fprintf(f, "/%s", name);
break;
case objNull:
fprintf(f, "null");
break;
case objArray:
fprintf(f, "[");
for (i = 0; i < arrayGetLength(); ++i) {
if (i > 0)
fprintf(f, " ");
arrayGetNF(i, &obj);
obj.print(f);
obj.free();
}
fprintf(f, "]");
break;
case objDict:
fprintf(f, "<<");
for (i = 0; i < dictGetLength(); ++i) {
fprintf(f, " /%s ", dictGetKey(i));
dictGetValNF(i, &obj);
obj.print(f);
obj.free();
}
fprintf(f, " >>");
break;
case objStream:
fprintf(f, "<stream>");
break;
case objRef:
fprintf(f, "%d %d R", ref.num, ref.gen);
break;
case objCmd:
fprintf(f, "%s", cmd);
break;
case objError:
fprintf(f, "<error>");
break;
case objEOF:
fprintf(f, "<EOF>");
break;
case objNone:
fprintf(f, "<none>");
break;
}
}
void Object::memCheck(FILE *f) {
#ifdef DEBUG_MEM
int i;
int t;
t = 0;
for (i = 0; i < numObjTypes; ++i)
t += numAlloc[i];
if (t > 0) {
fprintf(f, "Allocated objects:\n");
for (i = 0; i < numObjTypes; ++i) {
if (numAlloc[i] > 0)
fprintf(f, " %-20s: %6d\n", objTypeNames[i], numAlloc[i]);
}
}
#endif
}
diff --git a/noncore/unsupported/qpdf/xpdf/Page.cc b/noncore/unsupported/qpdf/xpdf/Page.cc
index 9cc08c4..aead7da 100644
--- a/noncore/unsupported/qpdf/xpdf/Page.cc
+++ b/noncore/unsupported/qpdf/xpdf/Page.cc
@@ -137,145 +137,145 @@ GBool PageAttrs::readBox(Dict *dict, char *key, PDFRectangle *box) {
obj2.free();
obj1.arrayGet(1, &obj2);
if (obj2.isNum()) {
tmp.y1 = obj2.getNum();
} else {
ok = gFalse;
}
obj2.free();
obj1.arrayGet(2, &obj2);
if (obj2.isNum()) {
tmp.x2 = obj2.getNum();
} else {
ok = gFalse;
}
obj2.free();
obj1.arrayGet(3, &obj2);
if (obj2.isNum()) {
tmp.y2 = obj2.getNum();
} else {
ok = gFalse;
}
obj2.free();
if (ok) {
*box = tmp;
}
} else {
ok = gFalse;
}
obj1.free();
return ok;
}
//------------------------------------------------------------------------
// Page
//------------------------------------------------------------------------
Page::Page(XRef *xrefA, int numA, Dict *pageDict, PageAttrs *attrsA,
GBool printCommandsA) {
ok = gTrue;
xref = xrefA;
num = numA;
printCommands = printCommandsA;
// get attributes
attrs = attrsA;
// annotations
pageDict->lookupNF("Annots", &annots);
if (!(annots.isRef() || annots.isArray() || annots.isNull())) {
error(-1, "Page annotations object (page %d) is wrong type (%s)",
num, annots.getTypeName());
annots.free();
goto err2;
}
// contents
pageDict->lookupNF("Contents", &contents);
if (!(contents.isRef() || contents.isArray() ||
contents.isNull())) {
error(-1, "Page contents object (page %d) is wrong type (%s)",
num, contents.getTypeName());
contents.free();
goto err1;
}
return;
err2:
annots.initNull();
err1:
contents.initNull();
ok = gFalse;
}
Page::~Page() {
delete attrs;
annots.free();
contents.free();
}
void Page::display(OutputDev *out, fouble dpi, int rotate,
Links *links, Catalog *catalog) {
#ifndef PDF_PARSER_ONLY
PDFRectangle *box, *cropBox;
Gfx *gfx;
Object obj;
Link *link;
int i;
Annots *annotList;
box = getBox();
cropBox = getCropBox();
if (printCommands) {
printf("***** MediaBox = ll:%g,%g ur:%g,%g\n",
- box->x1, box->y1, box->x2, box->y2);
+ static_cast<double>(box->x1), static_cast<double>(box->y1), static_cast<double>(box->x2), static_cast<double>(box->y2));
if (isCropped()) {
printf("***** CropBox = ll:%g,%g ur:%g,%g\n",
- cropBox->x1, cropBox->y1, cropBox->x2, cropBox->y2);
+ static_cast<double>(cropBox->x1), static_cast<double>(cropBox->y1), static_cast<double>(cropBox->x2), static_cast<double>(cropBox->y2));
}
printf("***** Rotate = %d\n", attrs->getRotate());
}
rotate += getRotate();
if (rotate >= 360) {
rotate -= 360;
} else if (rotate < 0) {
rotate += 360;
}
gfx = new Gfx(xref, out, num, attrs->getResourceDict(),
dpi, box, isCropped(), cropBox, rotate, printCommands);
contents.fetch(xref, &obj);
if (!obj.isNull()) {
gfx->display(&obj);
}
obj.free();
// draw links
if (links) {
for (i = 0; i < links->getNumLinks(); ++i) {
link = links->getLink(i);
out->drawLink(link, catalog);
}
out->dump();
}
// draw non-link annotations
//~ need to reset CTM ???
annotList = new Annots(xref, annots.fetch(xref, &obj));
obj.free();
if (annotList->getNumAnnots() > 0) {
if (printCommands) {
printf("***** Annotations\n");
}
for (i = 0; i < annotList->getNumAnnots(); ++i) {
annotList->getAnnot(i)->draw(gfx);
}
out->dump();
}
delete annotList;
delete gfx;
#endif
}