[poppler] Splash CMYK merge error

Thomas Freitag Thomas.Freitag at kabelmail.de
Mon Apr 9 11:47:38 PDT 2012


Hi,

playing around with the attached PDF to get a better CMYK support for 
the blend mode soft light, I encountered that I made a big mistake 
during merge in the CMYK part of splash. I fixed that. The attached 
patch also includes the small enhancement I made in soft light routine.

Cheers,
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: transparency.pdf
Type: application/pdf
Size: 2436 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20120409/cda03605/attachment.pdf>
-------------- next part --------------
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index 88b53ab..807e23a 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -661,6 +661,11 @@ static void splashOutBlendSoftLight(SplashColorPtr src, SplashColorPtr dest,
     SplashColor rgbSrc;
     SplashColor rgbDest;
     SplashColor rgbBlend;
+    for (i = 0; i < 4; i++) {
+      // convert back to subtractive (s. Splash.cc)
+      src[i] = 0xff - src[i];
+      dest[i] = 0xff - dest[i];
+    }
     cmykToRGB(src, rgbSrc);
     cmykToRGB(dest, rgbDest);
     for (i = 0; i < 3; ++i) {
@@ -676,6 +681,10 @@ static void splashOutBlendSoftLight(SplashColorPtr src, SplashColorPtr dest,
       }
     }
     rgbToCMYK(rgbBlend, blend);
+    for (i = 0; i < 4; i++) {
+      // convert back to additive (s. Splash.cc)
+      blend[i] = 0xff - blend[i];
+    }
   } else
 #endif
   {
diff --git a/splash/Splash.cc b/splash/Splash.cc
index 76a80f7..0e2058c 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -5260,7 +5260,7 @@ SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc,
   case splashModeCMYK8:
     for (y = 0; y < h; ++y) {
       p = &bitmap->data[(yDest + y) * bitmap->rowSize + 4 * xDest];
-      sp = &src->data[(ySrc + y) * bitmap->rowSize + 4 * xSrc];
+      sp = &src->data[(ySrc + y) * src->rowSize + 4 * xSrc];
       for (x = 0; x < w; ++x) {
 	*p++ = *sp++;
 	*p++ = *sp++;


More information about the poppler mailing list