[poppler] poppler/Gfx.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Fri Nov 20 17:43:52 PST 2009


 poppler/Gfx.cc |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit b905caf1785ee207cc0480953da69be302d3d4e9
Author: David Benjamin <davidben at mit.edu>
Date:   Sat Nov 21 02:43:21 2009 +0100

    Be more lenient with /Decode key on images
    
    The spec requires the field be [1 0] or [0 1]. Adobe accepts floating point
    values as well. This fixes bug #17439.

diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index eeabd87..2a4c9b8 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -30,6 +30,7 @@
 // Copyright (C) 2009 M Joonas Pihlaja <jpihlaja at cc.helsinki.fi>
 // Copyright (C) 2009 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2009 William Bader <williambader at hotmail.com>
+// Copyright (C) 2009 David Benjamin <davidben at mit.edu>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -3875,7 +3876,9 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) {
     }
     if (obj1.isArray()) {
       obj1.arrayGet(0, &obj2);
-      if (obj2.isInt() && obj2.getInt() == 1)
+      // Table 4.39 says /Decode must be [1 0] or [0 1]. Adobe
+      // accepts [1.0 0.0] as well.
+      if (obj2.isNum() && obj2.getNum() >= 0.9)
 	invert = gTrue;
       obj2.free();
     } else if (!obj1.isNull()) {
@@ -4097,7 +4100,9 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) {
       }
       if (obj1.isArray()) {
 	obj1.arrayGet(0, &obj2);
-	if (obj2.isInt() && obj2.getInt() == 1) {
+	// Table 4.39 says /Decode must be [1 0] or [0 1]. Adobe
+	// accepts [1.0 0.0] as well.
+	if (obj2.isNum() && obj2.getNum() >= 0.9) {
 	  maskInvert = gTrue;
 	}
 	obj2.free();


More information about the poppler mailing list