[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1618-g25f7cb4

[email protected] (Robin Watts)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, master has been updated
       via  25f7cb4da347610dd49bd8001746605f1a29caa8 (commit)
      from  b9e4b4e4d97a2f0c32596fed0342fb83773a56c2 (commit)

----------------------------------------------------------------------
commit 25f7cb4da347610dd49bd8001746605f1a29caa8
Author: Robin Watts <[email protected]>
Date:   Tue Aug 27 20:13:02 2019 +0100

    Fix deep color transparency saturation blending.
    
    Problem seen with:
    
       tests_private/pdf/PDF_1.7_FTS/fts_25_2513.pdf.psdcmyk16.300.1

diff --git a/base/gxblend.c b/base/gxblend.c
index 6d7db5e..485c4e0 100644
--- a/base/gxblend.c
+++ b/base/gxblend.c
@@ -744,10 +744,9 @@ art_blend_saturation_rgb_16(int n_chan, uint16_t *gs_restrict dst, const uint16_
     int minb, maxb;
     int mins, maxs;
     int y;
-    int scale;
+    int64_t scale;
     int r, g, b;
 
-    /* FIXME: Check this! */
     minb = rb < gb ? rb : gb;
     minb = minb < bb ? minb : bb;
     maxb = rb > gb ? rb : gb;
@@ -765,14 +764,14 @@ art_blend_saturation_rgb_16(int n_chan, uint16_t *gs_restrict dst, const uint16_
     maxs = rs > gs ? rs : gs;
     maxs = maxs > bs ? maxs : bs;
 
-    scale = ((maxs - mins) << 16) / (maxb - minb);
+    scale = (((int64_t)(maxs - mins)) << 16) / (maxb - minb);
     y = (rb * 77 + gb * 151 + bb * 28 + 0x80) >> 8;
     r = y + ((((rb - y) * scale) + 0x8000) >> 16);
     g = y + ((((gb - y) * scale) + 0x8000) >> 16);
     b = y + ((((bb - y) * scale) + 0x8000) >> 16);
 
     if ((r | g | b) & 0x10000) {
-        int scalemin, scalemax;
+        int64_t scalemin, scalemax;
         int min, max;
 
         min = r < g ? r : g;
@@ -781,12 +780,12 @@ art_blend_saturation_rgb_16(int n_chan, uint16_t *gs_restrict dst, const uint16_
         max = max > b ? max : b;
 
         if (min < 0)
-            scalemin = (y << 16) / (y - min);
+            scalemin = ((int64_t)(y << 16)) / (y - min);
         else
             scalemin = 0x10000;
 
         if (max > 65535)
-            scalemax = ((65535 - y) << 16) / (max - y);
+            scalemax = (((int64_t)(65535 - y)) << 16) / (max - y);
         else
             scalemax = 0x10000;
 


Summary of changes:
 base/gxblend.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.