[gs-cvs] rev 7510 - in trunk/gs: doc src
leonardo at ghostscript.com
leonardo at ghostscript.com
Thu Dec 14 17:58:03 PST 2006
Author: leonardo
Date: 2006-12-14 17:58:02 -0800 (Thu, 14 Dec 2006)
New Revision: 7510
Modified:
trunk/gs/doc/pscet_status.txt
trunk/gs/src/gdevddrw.c
trunk/gs/src/gdevdsha.c
Log:
Fix (shadings) : A fixed overflow happened while computing a color.
THIS IS INCOMPATIBLE CHANGE : The device virtual method
fill_linear_color_scanline now gets half color values
as the gradient parameters.
DETAILS :
Debugged with CET 12-14O.PS SpecialTestJ02Test12.
A scanline gradient could overflow because
the pixel span may be few wider than the spot span
due to pixel rounding.
Rather the expansion is always pretty small, it could cause
an int32_t overflow when storing the right limit pixel color
(which actually is never riched, because the filling algorithm
never paints the right boundary). However it caused a wrong
result in some cases.
See comments in code.
EXPECTED DIFFERENCES :
Most differences are unimportant single pixel difference in shadings.
Few progressions in shadings are marked below.
pdfwrite 72dpi :
"442-01.ps" (progression)
"446-01-fixed.ps"
"483-01.ps" (progression)
"483-05-fixed.ps"
"Clarke Tate Manns Chinese.ai"
"SmoothShading.pdf"
pdfwrite 300dpi :
"442-01.ps"
"446-01-fixed.ps"
"464-01-fixed.ps"
"478-01.ps"
"483-01.ps"
"483-05-fixed.ps"
"Altona-Testsuite_p2_S_x3.pdf"
"Altona_Visual_bb_1v1_x3.pdf"
"Altona_Visual_sb_1v1_x3.pdf"
"Clarke Tate Manns Chinese.ai"
"gradmesh.ai"
"S2_Digitalproof-Forum_x3k.pdf"
"shading_prob_800.ps"
"SmoothShading.pdf"
"STEUER-RollingMesh 1(linear).ai"
normal 72dpi :
"442-01.ps" (progression)
"446-01-fixed.ps"
"483-01.ps" (progression)
"483-05-fixed.ps"
"Clarke Tate Manns Chinese.ai"
"SmoothShading.pdf"
"STEUER-RollingMesh 2(radial).ai"
"STEUER-RollingMesh 3(Final).ai"
normal 300dpi :
"442-01.ps"
"446-01-fixed.ps"
"464-01-fixed.ps"
"483-01.ps"
"483-05-fixed.ps"
"Altona-Testsuite_p2_S_x3.pdf"
"Altona_Visual_bb_1v1_x3.pdf"
"Altona_Visual_sb_1v1_x3.pdf"
"Clarke Tate Manns Chinese.ai"
"gradmesh.ai"
"S2_Digitalproof-Forum_x3k.pdf"
Modified: trunk/gs/doc/pscet_status.txt
===================================================================
--- trunk/gs/doc/pscet_status.txt 2006-12-14 21:40:07 UTC (rev 7509)
+++ trunk/gs/doc/pscet_status.txt 2006-12-15 01:58:02 UTC (rev 7510)
@@ -2674,8 +2674,7 @@
12-14O-1 OK Minor differences in positions and character shapes - ADC
-12-14O-2 DIFF test12: The yellow horizontal bar must not appear.
- Assigned to Igor.
+12-14O-2 OK
12-14O-3 OK Fixed with rev 7211.
Modified: trunk/gs/src/gdevddrw.c
===================================================================
--- trunk/gs/src/gdevddrw.c 2006-12-14 21:40:07 UTC (rev 7509)
+++ trunk/gs/src/gdevddrw.c 2006-12-15 01:58:02 UTC (rev 7510)
@@ -272,8 +272,9 @@
which drops the fraction anyway. */
int32_t cl = lg->c[i];
int32_t cr = rg->c[i];
- int32_t c0 = (int32_t)(cl + ((int64_t)cr - cl) * (x0 - xl) / (xr - xl));
- int32_t c1 = (int32_t)(cl + ((int64_t)cr - cl) * (x1 - xl) / (xr - xl));
+ /* Use half color values against c1 overflow : */
+ int32_t c0 = (int32_t)((cl + ((int64_t)cr - cl) * (x0 - xl) / (xr - xl)) / 2);
+ int32_t c1 = (int32_t)((cl + ((int64_t)cr - cl) * (x1 - xl) / (xr - xl)) / 2);
xg->c[i] = c0;
xg->f[i] = 0; /* Insufficient bits to compute it better.
@@ -297,7 +298,9 @@
xg->den = 1;
for (i = 0; i < num_components; i++) {
- xg->c[i] = (lg->den == 0 ? rg->c[i] : lg->c[i]);
+ /* set_x_gradient_nowedge passes half color values against an overflow.
+ Set half value here for compatibility. */
+ xg->c[i] = (lg->den == 0 ? rg->c[i] : lg->c[i]) / 2;
xg->f[i] = 0; /* Compatible to set_x_gradient_nowedge. */
xg->num[i] = 0;
}
Modified: trunk/gs/src/gdevdsha.c
===================================================================
--- trunk/gs/src/gdevdsha.c 2006-12-14 21:40:07 UTC (rev 7509)
+++ trunk/gs/src/gdevdsha.c 2006-12-15 01:58:02 UTC (rev 7510)
@@ -41,13 +41,15 @@
if (j < fixed2int(fa->clip->p.y) ||
j > fixed2int_ceiling(fa->clip->q.y)) /* Must be compatible to the clipping logic. */
return 0;
+ /* set_x_gradient_nowedge passes half color values against an overflow.
+ Compensate that here with subtracting 1 from the bits shift below (2 occurances). */
for (k = 0; k < n; k++) {
int shift = cinfo->comp_shift[k];
int bits = cinfo->comp_bits[k];
c[k] = c0[k];
f[k] = c0f[k];
- ci0 |= (gx_color_index)(c[k] >> (sizeof(c[k]) * 8 - 1 - bits)) << shift;
+ ci0 |= (gx_color_index)(c[k] >> (sizeof(c[k]) * 8 - 2 - bits)) << shift;
}
for (i = i0 + 1; i < i1; i++) {
ci1 = 0;
@@ -63,7 +65,7 @@
m += cg_den;
}
f[k] = m;
- ci1 |= (gx_color_index)(c[k] >> (sizeof(c[k]) * 8 - 1 - bits)) << shift;
+ ci1 |= (gx_color_index)(c[k] >> (sizeof(c[k]) * 8 - 2 - bits)) << shift;
}
if (ci1 != ci0) {
si = max(bi, fixed2int(fa->clip->p.x)); /* Must be compatible to the clipping logic. */
More information about the gs-cvs
mailing list