[EMAIL PROTECTED] wrote:
> In this case, t_width = 1 and t_height = 18.
> Since it subtracts 1 from t_width, it ends up with w=0. Then t_scale
> = 0. Then the division dies.
>
> The fix eludes me right now...did Sir Boris write this too, or just
> the Y Gradient?
He did and here's a patch that I think fixes it. It works over the small
number ranges and I guess it works over large ones too but I'm not a
mathematician. The original gradient codes in Graphics.c were designed
to have fixed pixmap sizes to draw in, they were later generalized to
work with arbitrary sizes and this core dump is the result. A square
gradient in a 18x1 pixmap does not make sense. I think you can have a
similar core dump with Cgrads and YGrads.
Cheers,
Tim.
Index: libs/Graphics.c
===================================================================
RCS file: /u/phippst/cvsroot/fvwm/libs/Graphics.c,v
retrieving revision 1.3
diff -u -r1.3 Graphics.c
--- libs/Graphics.c 2001/05/08 10:50:30 1.3
+++ libs/Graphics.c 2001/05/14 15:13:00
@@ -654,7 +654,6 @@
/* create space for drawing the image locally */
image->data = safemalloc(image->bytes_per_line * t_height);
/* now do the fancy drawing */
- /* draw one pixel further than expected in case line style is CapNotLast */
switch (type)
{
case H_GRADIENT:
@@ -696,14 +695,12 @@
}
case S_GRADIENT:
{
- register int w = t_width - 1;
- register int h = t_height - 1;
- register int t_scale = w * h;
+ register int t_scale = t_width * t_height;
register int myncolors = ncolors * 2;
- for (i = 0; i <= w; i++) {
- register int pi = min(i, w - i) * h;
- for (j = 0; j <= h; j++) {
- register int pj = min(j, h - j) * w;
+ for (i = 0; i < t_width; i++) {
+ register int pi = min(i, t_width - 1 - i) * t_height;
+ for (j = 0; j < t_height; j++) {
+ register int pj = min(j, t_height - 1 - j) * t_width;
XPutPixel(image, i, j,
pixels[(min(pi, pj) * myncolors - 1) / t_scale]);
}