summaryrefslogtreecommitdiff
path: root/xpdf/ImageOutputDev.cc
diff options
context:
space:
mode:
authorJames Cloos <cloos@freedesktop.org>2011-08-30 03:37:38 -0700
committerJames Cloos <cloos@freedesktop.org>2011-08-30 03:37:38 -0700
commit3ed3a482f75317f50821f6a43e4afc9997d0ae83 (patch)
tree058e7cfd31d145296f7a443f29da52ea5857efb8 /xpdf/ImageOutputDev.cc
parentf2a102d2e974ad0b6f7bd548b04c6fc39601d173 (diff)
xpdf-3.03xpdf-3.03
Diffstat (limited to 'xpdf/ImageOutputDev.cc')
-rw-r--r--xpdf/ImageOutputDev.cc41
1 files changed, 28 insertions, 13 deletions
diff --git a/xpdf/ImageOutputDev.cc b/xpdf/ImageOutputDev.cc
index 3c0f478..a5c9314 100644
--- a/xpdf/ImageOutputDev.cc
+++ b/xpdf/ImageOutputDev.cc
@@ -26,7 +26,7 @@
ImageOutputDev::ImageOutputDev(char *fileRootA, GBool dumpJPEGA) {
fileRoot = copyString(fileRootA);
- fileName = (char *)gmalloc(strlen(fileRoot) + 20);
+ fileName = (char *)gmalloc((int)strlen(fileRoot) + 20);
dumpJPEG = dumpJPEGA;
imgNum = 0;
ok = gTrue;
@@ -37,6 +37,14 @@ ImageOutputDev::~ImageOutputDev() {
gfree(fileRoot);
}
+void ImageOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx, Object *str,
+ int paintType, Dict *resDict,
+ double *mat, double *bbox,
+ int x0, int y0, int x1, int y1,
+ double xStep, double yStep) {
+ // do nothing -- this avoids the potentially slow loop in Gfx.cc
+}
+
void ImageOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
int width, int height, GBool invert,
GBool inlineImg) {
@@ -51,7 +59,7 @@ void ImageOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
sprintf(fileName, "%s-%03d.jpg", fileRoot, imgNum);
++imgNum;
if (!(f = fopen(fileName, "wb"))) {
- error(-1, "Couldn't open image file '%s'", fileName);
+ error(errIO, -1, "Couldn't open image file '{0:s}'", fileName);
return;
}
@@ -73,7 +81,7 @@ void ImageOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
sprintf(fileName, "%s-%03d.pbm", fileRoot, imgNum);
++imgNum;
if (!(f = fopen(fileName, "wb"))) {
- error(-1, "Couldn't open image file '%s'", fileName);
+ error(errIO, -1, "Couldn't open image file '{0:s}'", fileName);
return;
}
fprintf(f, "P4\n");
@@ -115,7 +123,7 @@ void ImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
sprintf(fileName, "%s-%03d.jpg", fileRoot, imgNum);
++imgNum;
if (!(f = fopen(fileName, "wb"))) {
- error(-1, "Couldn't open image file '%s'", fileName);
+ error(errIO, -1, "Couldn't open image file '{0:s}'", fileName);
return;
}
@@ -138,7 +146,7 @@ void ImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
sprintf(fileName, "%s-%03d.pbm", fileRoot, imgNum);
++imgNum;
if (!(f = fopen(fileName, "wb"))) {
- error(-1, "Couldn't open image file '%s'", fileName);
+ error(errIO, -1, "Couldn't open image file '{0:s}'", fileName);
return;
}
fprintf(f, "P4\n");
@@ -163,7 +171,7 @@ void ImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
sprintf(fileName, "%s-%03d.ppm", fileRoot, imgNum);
++imgNum;
if (!(f = fopen(fileName, "wb"))) {
- error(-1, "Couldn't open image file '%s'", fileName);
+ error(errIO, -1, "Couldn't open image file '{0:s}'", fileName);
return;
}
fprintf(f, "P6\n");
@@ -179,13 +187,20 @@ void ImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
for (y = 0; y < height; ++y) {
// write the line
- p = imgStr->getLine();
- for (x = 0; x < width; ++x) {
- colorMap->getRGB(p, &rgb);
- fputc(colToByte(rgb.r), f);
- fputc(colToByte(rgb.g), f);
- fputc(colToByte(rgb.b), f);
- p += colorMap->getNumPixelComps();
+ if ((p = imgStr->getLine())) {
+ for (x = 0; x < width; ++x) {
+ colorMap->getRGB(p, &rgb);
+ fputc(colToByte(rgb.r), f);
+ fputc(colToByte(rgb.g), f);
+ fputc(colToByte(rgb.b), f);
+ p += colorMap->getNumPixelComps();
+ }
+ } else {
+ for (x = 0; x < width; ++x) {
+ fputc(0, f);
+ fputc(0, f);
+ fputc(0, f);
+ }
}
}
delete imgStr;