[AD] [fwd] 4.2rc2 BUG: d_clear_proc behaviour is wrong with gui_set_screen |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
See http://www.allegro.cc/forums/view_thread.php?_id=533520#target for a
description.
Actually, the proposed patch is not correct, but the attached one should
be. Already commited to CVS.
Evert
Index: src/guiproc.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/guiproc.c,v
retrieving revision 1.31
diff -u -r1.31 guiproc.c
--- src/guiproc.c 14 Sep 2005 11:19:42 -0000 1.31
+++ src/guiproc.c 27 Oct 2005 22:23:40 -0000
@@ -161,7 +161,16 @@
if (msg == MSG_DRAW) {
BITMAP *gui_bmp = gui_get_screen();
- set_clip_rect(gui_bmp, 0, 0, SCREEN_W-1, SCREEN_H-1);
+ int w, h;
+
+ /* Get width and height of target bitmap. We can't use SCREEN_W and
+ * SCREEN_H because the target might not be the screen, but we cannot use
+ * bmp->w and bmp->h either because if it is the screen these are actually
+ * wrong. Ugh!
+ */
+ w = (gui_bmp == screen) ? SCREEN_W: gui_bmp->w;
+ h = (gui_bmp == screen) ? SCREEN_H: gui_bmp->h;
+ set_clip_rect(gui_bmp, 0, 0, w-1, h-1);
set_clip_state(gui_bmp, TRUE);
clear_to_color(gui_bmp, d->bg);
}