[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Re: BUG: dirty rect from draw.line too small.



I found out that the draw.line functions do not take the line width
into account when figuring out the size of the dirty rect.

You can work around it by growing the dirty rect by the size of the
line width.  However this will not give you an optimal dirty rect.


Here is some code for a work around from Magick on irc.

temprect= pygame.draw.line(screen,(255, 0, 0),firstpos,newpos,width)
temprect.inflate_ip(width*2, width*2)




On 11/23/05, Rene Dudfield <renesd@xxxxxxxxx> wrote:
> There is a possible bug with the rect returned from draw.line().
>
> The code below seems to show the bug.  However, I haven't looked into
> it too closely...
>
>
>
>
> # possible line bug.
> #
> #  BUG: dirty rect from draw.line too small.
>
> import pygame
> from pygame.locals import *
>
>
> screen = pygame.display.set_mode((800, 600))
>
> while 1:
>     pass
>     events = pygame.event.get()
>
>     dirty=pygame.draw.line(screen,(255, 0, 0),(10,600),(600,50),50)
>     pygame.display.update(dirty)
>     pygame.time.wait(1000) #or whatever the wait comand is.
>     pygame.display.update()
>