summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2022-02-08 15:55:24 +0000
committerRobin Watts <Robin.Watts@artifex.com>2022-02-08 16:04:33 +0000
commitb31ad1cb820f3b43fbe2527b7e295db4bcadb537 (patch)
tree5f5049efebfdff3cec637a9b6fcb74b0abe2b6ab
parenta26a7ff99d737d42298c12afa68e2703eaad966a (diff)
downloadghostpdl-robin-test-base.tar.gz
Fix mismatch between rectangle and trap fills.robin-test-base-0ghostpdl-9.56.0-test-base-6robin-test-base
A recent commit added an optimisation to avoid gpdf pushing transparency groups around text where it was not needed. This shows various diffs. Investigating one of these showed that we were getting differ results when rendering a glyph when transparency was enabled or not. Further investigation shows that in the absence of transparency we were filling the glyph path using traps. With transparency we were filling the same path using rectangles. GS uses a 24.8 fixed point system for pixels, hence the centre of a pixel is at a horizontal coordinate of xxxx.80. If asked to fill a trap starting at an x position of xxxx.80, the trapezoid code would consider that centre covered. The rectangle code would, however, consider that centre uncovered. Thus the presence or absence of transparency was causing differences in rendering in some cases. The fix, implemented here, is to move the rectangle code into line with the trapezoid code. This will make many small diffs.
-rw-r--r--base/gxscanc.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/base/gxscanc.c b/base/gxscanc.c
index 9842b2c33..90deea69c 100644
--- a/base/gxscanc.c
+++ b/base/gxscanc.c
@@ -1056,8 +1056,8 @@ gx_fill_edgebuffer(gx_device * gs_restrict pdev,
left = *row++;
right = *row++;
rowlen -= 2;
- left = fixed2int(left + fixed_half);
- right = fixed2int(right + fixed_half);
+ left = fixed2int(left + fixed_half - fixed_epsilon);
+ right = fixed2int(right + fixed_half - fixed_epsilon);
right -= left;
if (right > 0) {
#ifdef DEBUG_OUTPUT_SC_AS_PS
@@ -2683,9 +2683,9 @@ int gx_scan_convert_tr(gx_device * gs_restrict pdev,
// if (table[0] == 0) {
// /* Zero height rectangle fills a span */
// table[0] = 2;
- // table[1] = int2fixed(fixed2int(bbox.p.x + fixed_half));
+ // table[1] = int2fixed(fixed2int(bbox.p.x + fixed_half - fixed_epsilon));
// table[2] = 0;
- // table[3] = int2fixed(fixed2int(bbox.q.x + fixed_half));
+ // table[3] = int2fixed(fixed2int(bbox.q.x + fixed_half - fixed_epsilon));
// table[4] = 1;
// }
//}
@@ -2862,8 +2862,8 @@ rowdifferent:{}
row += 4;
rowlen -= 2;
- left = fixed2int(left + fixed_half);
- right = fixed2int(right + fixed_half);
+ left = fixed2int(left + fixed_half - fixed_epsilon);
+ right = fixed2int(right + fixed_half - fixed_epsilon);
right -= left;
if (right > 0) {
#ifdef DEBUG_OUTPUT_SC_AS_PS
@@ -2901,8 +2901,8 @@ rowdifferent:{}
row2 += 4;
row2len -= 2;
- left = fixed2int(left + fixed_half);
- right = fixed2int(right + fixed_half);
+ left = fixed2int(left + fixed_half - fixed_epsilon);
+ right = fixed2int(right + fixed_half - fixed_epsilon);
right -= left;
if (right > 0) {
dlprintf("0.001 setlinewidth 1 0 0.5 setrgbcolor %%PS\n");