[gs-commits] ghostpdl branch, gs9.28-temp-for-testing, updated. gs9.28-temp-for-testing-tag-2-g5e538ae

[email protected] (Robin Watts)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, gs9.28-temp-for-testing has been updated
       via  5e538ae744ce9b0089b67b846a52802099ec0f40 (commit)
      from  72e3efc7d0b732060b2507bfa4d859c79ebc420e (commit)

----------------------------------------------------------------------
commit 5e538ae744ce9b0089b67b846a52802099ec0f40
Author: Robin Watts <[email protected]>
Date:   Fri Aug 23 15:06:17 2019 +0100

    Fix deep color transparency issue.
    
    Fix overflow in art_pdf_composite_knockout_16, seen in:
    
       tests_private/comparefiles/Bug690546.pdf.psdcmyk16.72.0

diff --git a/base/gxblend.c b/base/gxblend.c
index f3bf38d..38c27cb 100644
--- a/base/gxblend.c
+++ b/base/gxblend.c
@@ -2542,14 +2542,16 @@ art_pdf_composite_knockout_16(uint16_t *gs_restrict dst,
             tmp = (65535 - dst_alpha) * src_shape + 0x8000;
             result_alpha = dst_alpha + ((tmp + (tmp >> 16)) >> 16);
 
-            if (result_alpha != 0)
+            if (result_alpha != 0) {
+                dst_alpha += dst_alpha>>15;
                 for (i = 0; i < n_chan; i++) {
                     /* todo: optimize this - can strength-reduce so that
                        inner loop is a single interpolation */
-                    tmp = dst[i] * dst_alpha * (65535 - src_shape) +
-                        ((int)src[i]) * 65535 * src_shape + (result_alpha << 15);
-                    dst[i] = tmp / (result_alpha * 65535);
+                    tmp = ((dst[i] * dst_alpha)>>16) * (65535 - src_shape) +
+                        ((int)src[i]) * src_shape + (result_alpha>>1);
+                    dst[i] = tmp / result_alpha;
                 }
+            }
             dst[n_chan] = result_alpha;
         }
     } else {


Summary of changes:
 base/gxblend.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 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.