Re: [AD] mode select dlg patch |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
> I haven't tried with all posibilities though.
The fix looks ok to me. I've commited it to trunk and branch in the attached
form. Thanks for spotting this!
--
Eric Botcazou
Index: src/modesel.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/modesel.c,v
retrieving revision 1.28
diff -u -p -r1.28 modesel.c
--- src/modesel.c 10 Feb 2003 09:23:21 -0000 1.28
+++ src/modesel.c 14 Mar 2003 08:53:41 -0000
@@ -511,7 +511,7 @@ static AL_CONST char *gfx_depth_getter(i
{
static char *bpp_string_list[N_COLOR_DEPTH] = {"256", "32K", "64K", "16M", "16M"};
MODE_LIST *mode;
- int bpp_count, card_entry, mode_entry, bpp_entry;
+ int card_entry, mode_entry, bpp_entry, bpp_count, bpp_index;
char tmp[128];
card_entry = what_dialog[GFX_DRIVERLIST].d1;
@@ -520,22 +520,23 @@ static AL_CONST char *gfx_depth_getter(i
if (index < 0) {
if (list_size) {
- bpp_count = 0;
- for (bpp_entry = 0; bpp_entry < N_COLOR_DEPTH; bpp_entry++) {
+ /* Count the number of BPP entries for the mode. */
+ for (bpp_count = 0, bpp_entry = 0; bpp_entry < N_COLOR_DEPTH; bpp_entry++) {
if (mode->has_bpp[bpp_entry])
bpp_count++;
}
+
*list_size = bpp_count;
return NULL;
}
}
- bpp_entry = 0;
- bpp_count = 0;
- while (bpp_count < index) {
- bpp_entry++;
- if (mode->has_bpp[bpp_entry])
- bpp_count++;
+ /* Find the BPP entry for the mode corresponding to the zero-based index. */
+ bpp_index = -1;
+ bpp_entry = -1;
+ while (bpp_index < index) {
+ if (mode->has_bpp[++bpp_entry])
+ bpp_index++;
}
uszprintf(mode_string,