diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2019-08-27 20:13:02 +0100 |
---|---|---|
committer | Robin Watts <Robin.Watts@artifex.com> | 2019-08-27 20:13:50 +0100 |
commit | 25f7cb4da347610dd49bd8001746605f1a29caa8 (patch) | |
tree | 392e949e2fa922774285c308eae0522b6a4ebf2d /base/gxblend.c | |
parent | b9e4b4e4d97a2f0c32596fed0342fb83773a56c2 (diff) | |
download | ghostpdl-25f7cb4da347610dd49bd8001746605f1a29caa8.tar.gz |
Fix deep color transparency saturation blending.
Problem seen with:
tests_private/pdf/PDF_1.7_FTS/fts_25_2513.pdf.psdcmyk16.300.1
Diffstat (limited to 'base/gxblend.c')
-rw-r--r-- | base/gxblend.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/base/gxblend.c b/base/gxblend.c index 6d7db5ef9..485c4e010 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; |