Re: gdk_draw_polygon +stipple fill has problem
- From: Tor Lillqvist <tml iki fi>
- To: "HOCHSTETLER, BRUCE W. (JSC-DV3/T) (TSI)" <bruce w hochstetler1 jsc nasa gov>
- Cc: "'gtk-app-devel-list gnome org'" <gtk-app-devel-list gnome org>
- Subject: Re: gdk_draw_polygon +stipple fill has problem
- Date: Fri, 4 Jul 2003 00:38:00 +0000
The problem was caused by a silly bug in gdk/win32... The code that
calculates the bounding box in gdk_win32_draw_lines() was like this:
for (i = 0; i < npoints; i++)
{
bounds.x = MIN (bounds.x, points[i].x);
bounds.y = MIN (bounds.y, points[i].y);
bounds.width = MAX (bounds.width, points[i].x - bounds.x);
bounds.height = MAX (bounds.height, points[i].y - bounds.y);
}
The width and height calculations are wrong. Obvioously, one cannot
calculate them before knowing what the actual minimum x and y will
be. I.e. two separate loops are needed:
for (i = 0; i < npoints; i++)
{
bounds.x = MIN (bounds.x, points[i].x);
bounds.y = MIN (bounds.y, points[i].y);
}
for (i = 0; i < npoints; i++)
{
bounds.width = MAX (bounds.width, points[i].x - bounds.x);
bounds.height = MAX (bounds.height, points[i].y - bounds.y);
}
Fixed in CVS.
--tml
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]