[poppler] 3 commits - poppler/Catalog.cc poppler/SplashOutputDev.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Thu Jul 16 15:41:23 PDT 2015


 poppler/Catalog.cc         |    2 -
 poppler/SplashOutputDev.cc |   57 ++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 57 insertions(+), 2 deletions(-)

New commits:
commit 1aa2f6e8a41a6a86dc02bf7c5cbc62355e780961
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Jul 17 00:40:56 2015 +0200

    Silly micro optimization: Move vars inside case {}

diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index cb82ba0..d9d5699 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -154,40 +154,45 @@ static inline void convertGfxShortColor(SplashColorPtr dest,
                                    SplashColorMode colorMode,
                                    GfxColorSpace *colorSpace,
                                    GfxColor *src) {
-  GfxGray gray;
-  GfxRGB rgb;
-#if SPLASH_CMYK
-  GfxCMYK cmyk;
-  GfxColor deviceN;
-#endif
-
   switch (colorMode) {
     case splashModeMono1:
     case splashModeMono8:
+    {
+      GfxGray gray;
       colorSpace->getGray(src, &gray);
       dest[0] = colToByte(gray);
+    }
     break;
     case splashModeXBGR8:
       dest[3] = 255;
     case splashModeBGR8:
     case splashModeRGB8:
+    {
+      GfxRGB rgb;
       colorSpace->getRGB(src, &rgb);
       dest[0] = colToByte(rgb.r);
       dest[1] = colToByte(rgb.g);
       dest[2] = colToByte(rgb.b);
+    }
     break;
 #if SPLASH_CMYK
     case splashModeCMYK8:
+    {
+      GfxCMYK cmyk;
       colorSpace->getCMYK(src, &cmyk);
       dest[0] = colToByte(cmyk.c);
       dest[1] = colToByte(cmyk.m);
       dest[2] = colToByte(cmyk.y);
       dest[3] = colToByte(cmyk.k);
+    }
     break;
     case splashModeDeviceN8:
+    {
+      GfxColor deviceN;
       colorSpace->getDeviceN(src, &deviceN);
       for (int i = 0; i < SPOT_NCOMPS + 4; i++)
         dest[i] = colToByte(deviceN.c[i]);
+    }
     break;
 #endif
   }
commit 705615f7569bbadb555bbf45c15c7c01f1690db5
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Jul 17 00:38:58 2015 +0200

    More typo fix

diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc
index 44a972e..04caa1c 100644
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@ -825,7 +825,7 @@ int Catalog::getNumPages()
 	Object pageRootRef;
 	catDict.dictLookupNF("Pages", &pageRootRef);
 
-	error(errSyntaxError, -1, "Pages top-level is a single Page. The document is mal-formed, trying to recover...");
+	error(errSyntaxError, -1, "Pages top-level is a single Page. The document is malformed, trying to recover...");
 
 	Dict *pageDict = pagesDict.getDict();
 	if (pageRootRef.isRef()) {
commit 3b6b3fefe97b885e42966fece84a123fc4671b20
Author: William Bader <williambader at hotmail.com>
Date:   Fri Jul 17 00:37:46 2015 +0200

    [Splash] Fix wrong writes on non rgb outputs
    
    Bug #90570

diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index 9ca756e..cb82ba0 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -143,6 +143,56 @@ static inline void convertGfxColor(SplashColorPtr dest,
   splashColorCopy(dest, color);
 }
 
+// Copy a color according to the color mode.
+// Use convertGfxShortColor() below when the destination is a bitmap
+// to avoid overwriting cells.
+// Calling this in SplashGouraudPattern::getParameterizedColor() fixes bug 90570.
+// Use convertGfxColor() above when the destination is an array of SPOT_NCOMPS+4 bytes,
+// to ensure that everything is initialized.
+
+static inline void convertGfxShortColor(SplashColorPtr dest,
+                                   SplashColorMode colorMode,
+                                   GfxColorSpace *colorSpace,
+                                   GfxColor *src) {
+  GfxGray gray;
+  GfxRGB rgb;
+#if SPLASH_CMYK
+  GfxCMYK cmyk;
+  GfxColor deviceN;
+#endif
+
+  switch (colorMode) {
+    case splashModeMono1:
+    case splashModeMono8:
+      colorSpace->getGray(src, &gray);
+      dest[0] = colToByte(gray);
+    break;
+    case splashModeXBGR8:
+      dest[3] = 255;
+    case splashModeBGR8:
+    case splashModeRGB8:
+      colorSpace->getRGB(src, &rgb);
+      dest[0] = colToByte(rgb.r);
+      dest[1] = colToByte(rgb.g);
+      dest[2] = colToByte(rgb.b);
+    break;
+#if SPLASH_CMYK
+    case splashModeCMYK8:
+      colorSpace->getCMYK(src, &cmyk);
+      dest[0] = colToByte(cmyk.c);
+      dest[1] = colToByte(cmyk.m);
+      dest[2] = colToByte(cmyk.y);
+      dest[3] = colToByte(cmyk.k);
+    break;
+    case splashModeDeviceN8:
+      colorSpace->getDeviceN(src, &deviceN);
+      for (int i = 0; i < SPOT_NCOMPS + 4; i++)
+        dest[i] = colToByte(deviceN.c[i]);
+    break;
+#endif
+  }
+}
+
 //------------------------------------------------------------------------
 // SplashGouraudPattern
 //------------------------------------------------------------------------
@@ -179,7 +229,7 @@ void SplashGouraudPattern::getParameterizedColor(double colorinterp, SplashColor
     for (int m = 0; m < colorComps; ++m)
       dest[m] = colToByte(src.c[m]);
   } else {
-    convertGfxColor(dest, mode, srcColorSpace, &src);
+    convertGfxShortColor(dest, mode, srcColorSpace, &src);
   }
 }
 


More information about the poppler mailing list