[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] bugs in pygame.draw.circle



Hi,

been following your bug hunt. Same thing on Win95/2K.
Enclosed is a patch for "draw.c", where the bugs are.
Also a test program that shouldn't parachute.

I used cygwin to make this patch.
This should do the update :

"patch draw.c draw-patch.pat"

- Adds some parameter checks on circle().
- Added vertical line drawing special case.
- Filled circle is actually a circle now!
- Bad result from ellipse() (called by circle) fixed.
- Fixed clipping in horzlineclip()
- Corrected some of the doc strings.

--- circle(0,0) draws a single pixel
--- circle(0,1) raises exception (width greater than radius)
--- circle(1,0) draws a +
--- circle(1,1) draws a + with the center pixel missing

Note:
May have broken some rules about what a zero length line does.
The filled ellipse code isn't optimized any more.

Think of it as an emergency fix, but possibly *not* pixel perfect.
Hope this is of some use,

best regards,
John.


----- Original Message -----
From: "David Clark" <silenus@telus.net>
To: <pygame-users@seul.org>
Sent: 27 September 2001 06:15
Subject: Re: [pygame] bugs in pygame.draw.circle


> Doug Partridge writes:
>
>  >
>  > try using a radius of 0, (filled circle). I would test your code but I
am
>  > a work and don't have python here.
>
> Ah. I see what you mean.
>
> >>> retval = pygame.draw.circle(screen, (255, 255, 255), (100, 280), 50,
0)
> >>> print retval
> None
>
> So filled circles, with a WIDTH of zero, drawn anywhere on the screen,
> incorrectly return None.
>
> >>> retval = pygame.draw.circle(screen, (255, 255, 255), (100, 100), 0, 2)
> Fatal Python error: (pygame parachute) Floating Point Exception
> Aborted
>
> And here, we see that if I accidently set the RADIUS to zero, and try
> to draw anywhere on the screen, I get the parachute.  Strange.
>
> Pete, any thoughts?
>
>
> --
> David Clark
> Futility at #pygame on irc.openprojects.net
>
> ____________________________________
> pygame mailing list
> pygame-users@seul.org
> http://pygame.seul.org

draw-patch.zip