[poppler] Branch 'poppler-0.8' - poppler/GfxState.cc poppler/Stream.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Tue Apr 15 13:00:32 PDT 2008


 poppler/GfxState.cc |    6 ++++++
 poppler/Stream.cc   |    9 +++++++++
 2 files changed, 15 insertions(+)

New commits:
commit 78a58ab7ef018fe4353eb01bd2af4e35699a2c27
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue Apr 15 21:57:31 2008 +0200

    Hack to "support" 16 bits images
    
    Everywhere we assume a component fits in 8 bits, with this hack
    we treat 16 bit images as 8 bit ones until it's fixed correctly.
    Fixes http://bugs.kde.org/show_bug.cgi?id=158165

diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index f2f914d..371ef3d 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -3349,6 +3349,12 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
   maxPixel = (1 << bits) - 1;
   colorSpace = colorSpaceA;
 
+  // this is a hack to support 16 bits images, everywhere
+  // we assume a component fits in 8 bits, with this hack
+  // we treat 16 bit images as 8 bit ones until it's fixed correctly.
+  // The hack has another part on ImageStream::getLine
+  if (maxPixel > 255) maxPixel = 255;
+
   // initialize
   for (k = 0; k < gfxColorMaxComps; ++k) {
     lookup[k] = NULL;
diff --git a/poppler/Stream.cc b/poppler/Stream.cc
index c253129..f00587d 100644
--- a/poppler/Stream.cc
+++ b/poppler/Stream.cc
@@ -428,6 +428,15 @@ Guchar *ImageStream::getLine() {
     for (i = 0; i < nVals; ++i) {
       imgLine[i] = str->getChar();
     }
+  } else if (nBits == 16) {
+    // this is a hack to support 16 bits images, everywhere
+    // we assume a component fits in 8 bits, with this hack
+    // we treat 16 bit images as 8 bit ones until it's fixed correctly.
+    // The hack has another part on GfxImageColorMap::GfxImageColorMap
+    for (i = 0; i < nVals; ++i) {
+      imgLine[i] = str->getChar();
+      str->getChar();
+    }
   } else {
     bitMask = (1 << nBits) - 1;
     buf = 0;


More information about the poppler mailing list