Re: [AD] Graphical corruption with bogus set_mouse_sprite_focus parameters. |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On Sun, 2004-09-05 at 18:09 +0100, Grzegorz Adam Hankiewicz wrote:
> I found out that calling set_mouse_sprite_focus(-50, -50) in exgui.c
> generated noticeable graphical corruption. Even if this is a bug in
> the mouse sprite update code, it doesn't seem logical to be able
> to set the focus of the sprite with coordinates outside of it's
> range. That's just asking for troubles. Proposed patch attached.
Good catch. The attached patch aims at fixing the bug in the mouse
sprite update code. I'm not sure we need the asserts anymore with it.
--
Elias Pschernig
Index: src/mouse.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/mouse.c,v
retrieving revision 1.21
diff -u -p -r1.21 mouse.c
--- src/mouse.c 9 Aug 2004 14:31:10 -0000 1.21
+++ src/mouse.c 5 Sep 2004 18:13:49 -0000
@@ -136,8 +136,8 @@ static void draw_mouse_doublebuffer(int
y1 = MIN(my, newy) - mouse_y_focus;
/* get width of area */
- w = MAX(mx, newx) - x1 + mouse_sprite->w+1;
- h = MAX(my, newy) - y1 + mouse_sprite->h+1;
+ w = MAX(mx, newx) - MIN(mx, newx) + mouse_sprite->w+1;
+ h = MAX(my, newy) - MIN(my, newy) + mouse_sprite->h+1;
/* make new co-ords relative to 'mtemp' bitmap co-ords */
newx -= mouse_x_focus+x1;