Partial fix for 687029, Different results on Alpha, installment 3
Alex Cherepanov <[email protected]>
| Newsgroups | gmane.comp.printing.ghostscript.patches |
|---|---|
| Organization | Coscript Software |
| Message-ID | <[email protected]> |
Avoid floating point exception. Use BBox only when it is initialized. _______________________________________________ gs-code-review mailing list [email protected] http://www.ghostscript.com/mailman/listinfo/gs-code-review
gxshare1.c.diff
(text/plain, 1.5 KB)
Index: gs/src/gxshade1.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gxshade1.c,v
retrieving revision 1.19
diff -b -u -r1.19 gxshade1.c
--- gs/src/gxshade1.c 30 Dec 2002 05:51:05 -0000 1.19
+++ gs/src/gxshade1.c 22 Nov 2003 06:45:03 -0000
@@ -836,6 +836,18 @@
coord[3][1] = coord[2][1] + (y0-y1) / dis * max_ext;
}
+private inline floatp
+calc_max_extension(const gs_shading_R_t *psh, const gs_rect *rect)
+{ gs_point p, q;
+
+ if (psh->params.have_BBox) {
+ p = psh->params.BBox.p; q = psh->params.BBox.q;
+ } else {
+ p = rect->p; q = rect->q;
+ }
+ return hypot(p.x-q.x, p.y-q.y)*2;
+}
+
int
gs_shading_R_fill_rectangle(const gs_shading_t * psh0, const gs_rect * rect,
gx_device * dev, gs_imager_state * pis)
@@ -886,10 +898,7 @@
state.dd = dd;
if (psh->params.Extend[0]) {
- floatp max_extension;
- gs_point p, q;
- p = psh->params.BBox.p; q = psh->params.BBox.q;
- max_extension = hypot(p.x-q.x, p.y-q.y)*2;
+ floatp max_extension = calc_max_extension(psh, rect);
if (r0 < r1) {
if ( (r1-r0) < dist_between_circles) {
@@ -944,10 +953,7 @@
state.frames[0].t1 = (t[1] - d0) / dd;
code = R_fill_region(&state);
if (psh->params.Extend[1]) {
- floatp max_extension;
- gs_point p, q;
- p = psh->params.BBox.p; q = psh->params.BBox.q;
- max_extension = hypot(p.x-q.x, p.y-q.y)*2;
+ floatp max_extension = calc_max_extension(psh, rect);
if (code < 0)
return code;