iOS/buildlibs/armv7/allegro-4.4.2/addons/allegrogl/src/win.c
/* Returns a list of valid video modes */
Returns a list of valid video modes
Returns a list of valid video modes
static GFX_MODE_LIST* allegro_gl_win_fetch_mode_list(void)
{
	int c, modes_count;
	GFX_MODE_LIST *mode_list;
	DEVMODE dm;
	dm.dmSize = sizeof(DEVMODE);
	mode_list = malloc(sizeof(GFX_MODE_LIST));
	if (!mode_list) {
		return NULL;
	}
	mode_list->mode = malloc(sizeof(GFX_MODE));
	if (!mode_list->mode) {
		free(mode_list);
		return NULL;
	}
	mode_list->mode[0].width = 0;
	mode_list->mode[0].height = 0;
	mode_list->mode[0].bpp = 0;
	mode_list->num_modes = 0;
	modes_count = 0;
	c = 0;
	while (EnumDisplaySettings(NULL, c, &dm)) {
	   	mode_list->mode = realloc(mode_list->mode,
								sizeof(GFX_MODE) * (modes_count + 2));
		if (!mode_list->mode) {
			free(mode_list);
			return NULL;
		}
		if (dm.dmBitsPerPel > 8 && is_mode_entry_unique(mode_list, &dm)) {
			mode_list->mode[modes_count].width = dm.dmPelsWidth;
			mode_list->mode[modes_count].height = dm.dmPelsHeight;
			mode_list->mode[modes_count].bpp = dm.dmBitsPerPel;
			++modes_count;
			mode_list->mode[modes_count].width = 0;
			mode_list->mode[modes_count].height = 0;
			mode_list->mode[modes_count].bpp = 0;
			mode_list->num_modes = modes_count;
 		}
		++c;
	};
	return mode_list;
}
static GFX_MODE_LIST * allegro_gl_win_fetch_mode_list ( void ) { int c , modes_count ; GFX_MODE_LIST * mode_list ; DEVMODE dm ; dm . dmSize = sizeof ( DEVMODE ) ; mode_list = malloc ( sizeof ( GFX_MODE_LIST ) ) ; if ( ! mode_list ) { return NULL ; } mode_list -> mode = malloc ( sizeof ( GFX_MODE ) ) ; if ( ! mode_list -> mode ) { free ( mode_list ) ; return NULL ; } mode_list -> mode [ 0 ] . width = 0 ; mode_list -> mode [ 0 ] . height = 0 ; mode_list -> mode [ 0 ] . bpp = 0 ; mode_list -> num_modes = 0 ; modes_count = 0 ; c = 0 ; while ( EnumDisplaySettings ( NULL , c , & dm ) ) { mode_list -> mode = realloc ( mode_list -> mode , sizeof ( GFX_MODE ) * ( modes_count + 2 ) ) ; if ( ! mode_list -> mode ) { free ( mode_list ) ; return NULL ; } if ( dm . dmBitsPerPel > 8 && is_mode_entry_unique ( mode_list , & dm ) ) { mode_list -> mode [ modes_count ] . width = dm . dmPelsWidth ; mode_list -> mode [ modes_count ] . height = dm . dmPelsHeight ; mode_list -> mode [ modes_count ] . bpp = dm . dmBitsPerPel ; ++ modes_count ; mode_list -> mode [ modes_count ] . width = 0 ; mode_list -> mode [ modes_count ] . height = 0 ; mode_list -> mode [ modes_count ] . bpp = 0 ; mode_list -> num_modes = modes_count ; } ++ c ; } ; return mode_list ; }
Returns a list of valid video modes
Returns a list of valid video modes
/* Allocate space for mode list. */ /* Allocate and fill the first mode in case EnumDisplaySettings fails at
	 * first call.
	 */ /* Filter modes with bpp lower than 9, and those which are already
		 * in there.
		 */