[gs-cvs] rev 7175 - trunk/gs/src
leonardo at ghostscript.com
leonardo at ghostscript.com
Wed Nov 8 04:30:45 PST 2006
Author: leonardo
Date: 2006-11-08 04:30:45 -0800 (Wed, 08 Nov 2006)
New Revision: 7175
Modified:
trunk/gs/src/gxshade1.c
Log:
Fix (shadings) : Improving radial gradients.
DETAILS :
1. Extend was missed sumetimes due to a wrong formula in R_outer_circle.
2. Must paint nothing when both radii are zero.
EXPECTED DIFFERENCES :
None.
Modified: trunk/gs/src/gxshade1.c
===================================================================
--- trunk/gs/src/gxshade1.c 2006-11-07 23:30:31 UTC (rev 7174)
+++ trunk/gs/src/gxshade1.c 2006-11-08 12:30:45 UTC (rev 7175)
@@ -403,17 +403,27 @@
so it's not an exact contact, sorry. */
if (any_abs(dx) > any_abs(dy)) {
/* Solving :
- x0 + (x1 - x0) * s - r0 - (r1 - r0) * s == bbox_x
- (x1 - x0) * s - (r1 - r0) * s == bbox_x - x0 + r0
- s = (bbox_x - x0 + r0) / (x1 - x0 - r1 + r0)
+ x0 + (x1 - x0) * sq + r0 + (r1 - r0) * sq == bbox_px
+ (x1 - x0) * sp + (r1 - r0) * sp == bbox_px - x0 - r0
+ sp = (bbox_px - x0 - r0) / (x1 - x0 + r1 - r0)
+
+ x0 + (x1 - x0) * sq - r0 - (r1 - r0) * sq == bbox_qx
+ (x1 - x0) * sq - (r1 - r0) * sq == bbox_x - x0 + r0
+ sq = (bbox_x - x0 + r0) / (x1 - x0 - r1 + r0)
*/
if (x1 - x0 + r1 - r0 == 0) /* We checked for obtuse cone. */
return_error(gs_error_unregistered); /* Must not happen. */
- sp = (rect->p.x - x0 + r0) / (x1 - x0 - r1 + r0);
+ if (x1 - x0 - r1 + r0 == 0) /* We checked for obtuse cone. */
+ return_error(gs_error_unregistered); /* Must not happen. */
+ sp = (rect->p.x - x0 - r0) / (x1 - x0 + r1 - r0);
sq = (rect->q.x - x0 + r0) / (x1 - x0 - r1 + r0);
} else {
/* Same by Y. */
- sp = (rect->p.y - y0 + r0) / (y1 - y0 - r1 + r0);
+ if (y1 - y0 + r1 - r0 == 0) /* We checked for obtuse cone. */
+ return_error(gs_error_unregistered); /* Must not happen. */
+ if (y1 - y0 - r1 + r0 == 0) /* We checked for obtuse cone. */
+ return_error(gs_error_unregistered); /* Must not happen. */
+ sp = (rect->p.y - y0 - r0) / (y1 - y0 + r1 - r0);
sq = (rect->q.y - y0 + r0) / (y1 - y0 - r1 + r0);
}
if (sp >= 1 && sq >= 1)
@@ -687,6 +697,8 @@
gs_point dev_dr;
patch_fill_state_t pfs1;
+ if (r0 == 0 && r1 == 0)
+ return 0; /* PLRM requires to paint nothing. */
shade_init_fill_state((shading_fill_state_t *)&state, psh0, dev, pis);
state.psh = psh;
state.rect = *rect;
More information about the gs-cvs
mailing list