[gs-commits] ghostpdl branch, gs9.28-temp-for-testing, updated. gs9.28-temp-for-testing-tag-10-gf755da3
[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 f755da3d792390187244c329c16a183ef7aa1487 (commit)
via 86f6299c7f5c251b6e9f81efed923ca1e96fcfa6 (commit)
via 9a747a1caf2fe47f5c8d7a8f55009cf663b9a73f (commit)
from a6d07099578f3a4f9a5aaceb83e944382b93210d (commit)
----------------------------------------------------------------------
commit f755da3d792390187244c329c16a183ef7aa1487
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;
----------------------------------------------------------------------
commit 86f6299c7f5c251b6e9f81efed923ca1e96fcfa6
Author: Robin Watts <[email protected]>
Date: Tue Aug 27 17:45:57 2019 +0100
Bug 701446: Avoid division by zero in gx_shade_trapezoid
Remove some incorrect clipping code.
diff --git a/base/gxshade6.c b/base/gxshade6.c
index 337e79c..11fe3cc 100644
--- a/base/gxshade6.c
+++ b/base/gxshade6.c
@@ -941,41 +941,43 @@ gx_shade_trapezoid(patch_fill_state_t *pfs, const gs_fixed_point q[4],
} else if (le.start.x > xleft)
xleft = le.start.x;
+ ybot = max(ybot, min(le.start.y, re.start.y));
+ ytop = min(ytop, max(le.end.y, re.end.y));
+#if 0
+ /* RJW: I've disabled this code a) because it doesn't make any
+ * difference in the cluster tests, and b) because I think it's wrong.
+ * Taking the first case as an example; just because the le.start.x
+ * is > xright, does not mean that we can simply truncate the edge at
+ * xright, as this may throw away part of the trap between ybot and
+ * the new le.start.y. */
/* Reduce the edges to the left/right of the clipping region. */
/* Only in the 4 cases which can bring ytop/ybot closer */
if (le.start.x > xright) {
le.start.y += (fixed)((int64_t)(le.end.y-le.start.y)*
(int64_t)(le.start.x-xright)/
(int64_t)(le.start.x-le.end.x));
- if (le.start.y > ybot) {
- ybot = le.start.y;
- }
le.start.x = xright;
}
if (re.start.x < xleft) {
re.start.y += (fixed)((int64_t)(re.end.y-re.start.y)*
(int64_t)(xleft-re.start.x)/
(int64_t)(re.end.x-re.start.x));
- if (re.start.y > ybot)
- ybot = re.start.y;
re.start.x = xleft;
}
if (le.end.x > xright) {
le.end.y -= (fixed)((int64_t)(le.end.y-le.start.y)*
(int64_t)(le.end.x-xright)/
(int64_t)(le.end.x-le.start.x));
- if (le.end.y < ytop)
- ytop = le.end.y;
le.end.x = xright;
}
if (re.end.x < xleft) {
re.end.y -= (fixed)((int64_t)(re.end.y-re.start.y)*
(int64_t)(xleft-re.end.x)/
(int64_t)(re.start.x-re.end.x));
- if (re.end.y < ytop)
- ytop = re.end.y;
re.end.x = xleft;
}
+#endif
+
if (ybot >= ytop)
return 0;
/* Follow the edges in, so that le.start.y == ybot etc. */
----------------------------------------------------------------------
commit 9a747a1caf2fe47f5c8d7a8f55009cf663b9a73f
Author: Robin Watts <[email protected]>
Date: Tue Aug 27 15:54:36 2019 +0100
Exit early from gx_shade_trapezoid in more cases.
A zero height trap isn't plotted, so we can bail out early in
that case.
diff --git a/base/gxshade6.c b/base/gxshade6.c
index 890a1ac..337e79c 100644
--- a/base/gxshade6.c
+++ b/base/gxshade6.c
@@ -976,7 +976,7 @@ gx_shade_trapezoid(patch_fill_state_t *pfs, const gs_fixed_point q[4],
ytop = re.end.y;
re.end.x = xleft;
}
- if (ybot > ytop)
+ if (ybot >= ytop)
return 0;
/* Follow the edges in, so that le.start.y == ybot etc. */
if (le.start.y < ybot) {
@@ -1039,7 +1039,7 @@ gx_shade_trapezoid(patch_fill_state_t *pfs, const gs_fixed_point q[4],
(int64_t)(le.start.x-le.end.x));
le.start.x = re.start.x;
}
- if (ybot > ytop)
+ if (ybot >= ytop)
return 0;
le.start.y = ybot;
re.start.y = ybot;
@@ -1056,7 +1056,7 @@ gx_shade_trapezoid(patch_fill_state_t *pfs, const gs_fixed_point q[4],
(int64_t)(le.end.x-le.start.x));
le.end.x = re.end.x;
}
- if (ybot > ytop)
+ if (ybot >= ytop)
return 0;
le.end.y = ytop;
re.end.y = ytop;
Summary of changes:
base/gxblend.c | 11 +++++------
base/gxshade6.c | 26 ++++++++++++++------------
2 files changed, 19 insertions(+), 18 deletions(-)