]> www.fi.muni.cz Git - evince.git/blobdiff - pdf/xpdf/ImageOutputDev.cc
Synched with Xpdf 0.92
[evince.git] / pdf / xpdf / ImageOutputDev.cc
index 93d1c31237d2e7d7ad243f0f8a0f0eb6f97f9288..9cd128002ea2f0fb2d140ab2667b0ce15e983489 100644 (file)
@@ -35,7 +35,7 @@ ImageOutputDev::~ImageOutputDev() {
   gfree(fileRoot);
 }
 
-void ImageOutputDev::drawImageMask(GfxState *state, Stream *str,
+void ImageOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
                                   int width, int height, GBool invert,
                                   GBool inlineImg) {
   FILE *f;
@@ -86,18 +86,19 @@ void ImageOutputDev::drawImageMask(GfxState *state, Stream *str,
   }
 }
 
-void ImageOutputDev::drawImage(GfxState *state, Stream *str, int width,
-                              int height, GfxImageColorMap *colorMap,
-                              GBool inlineImg) {
+void ImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
+                              int width, int height,
+                              GfxImageColorMap *colorMap, GBool inlineImg) {
   FILE *f;
   ImageStream *imgStr;
   Guchar pixBuf[4];
-  GfxColor color;
+  GfxRGB rgb;
   int x, y;
   int c;
 
   // dump JPEG file
-  if (dumpJPEG && str->getKind() == strDCT) {
+  if (dumpJPEG && str->getKind() == strDCT &&
+      colorMap->getNumPixelComps() == 3) {
 
     // open the image file
     sprintf(fileName, "%s-%03d.jpg", fileRoot, imgNum);
@@ -142,10 +143,10 @@ void ImageOutputDev::drawImage(GfxState *state, Stream *str, int width,
       // write the line
       for (x = 0; x < width; ++x) {
        imgStr->getPixel(pixBuf);
-       colorMap->getColor(pixBuf, &color);
-       fputc((int)(color.getR() * 255 + 0.5), f);
-       fputc((int)(color.getG() * 255 + 0.5), f);
-       fputc((int)(color.getB() * 255 + 0.5), f);
+       colorMap->getRGB(pixBuf, &rgb);
+       fputc((int)(rgb.r * 255 + 0.5), f);
+       fputc((int)(rgb.g * 255 + 0.5), f);
+       fputc((int)(rgb.b * 255 + 0.5), f);
       }
     }
     delete imgStr;