iOS/buildlibs/armv7/allegro-4.4.2/addons/allegrogl/src/x.c
/* allegro_gl_x_fetch_mode_list:
 *  Generates a list of valid video modes (made after 
 *  _xvidmode_private_fetch_mode_list of Allegro)
 */
Generates a list of valid video modes (made after
_xvidmode_private_fetch_mode_list of Allegro)
Generates a list of valid video modes ( made after _xvidmode_private_fetch_mode_list of Allegro )
static GFX_MODE_LIST* allegro_gl_x_fetch_mode_list(void)
{
	int num_modes = 0;
	XF86VidModeModeInfo **modesinfo = NULL;
	GFX_MODE_LIST *mode_list;
	int i;
	XLOCK();
	if (get_xf86_modes(&modesinfo, &num_modes)) {
		XUNLOCK();
		return NULL;
	}
	mode_list = malloc(sizeof(GFX_MODE_LIST));
	if (!mode_list) {
		free_modelines(modesinfo, num_modes);
		XUNLOCK();
		return NULL;
	}
	mode_list->mode = malloc(sizeof(GFX_MODE) * (num_modes + 1));
	if (!mode_list->mode) {
		free(mode_list);
		free_modelines(modesinfo, num_modes);
		XUNLOCK();
		return NULL;
	}
	for (i = 0; i < num_modes; i++) {
		mode_list->mode[i].width = modesinfo[i]->hdisplay;
		mode_list->mode[i].height = modesinfo[i]->vdisplay;
		mode_list->mode[i].bpp = desktop_color_depth();
	}
	mode_list->mode[num_modes].width = 0;
	mode_list->mode[num_modes].height = 0;
	mode_list->mode[num_modes].bpp = 0;
	mode_list->num_modes = num_modes;
	free_modelines(modesinfo, num_modes);
	XUNLOCK();
	return mode_list;
}
static GFX_MODE_LIST * allegro_gl_x_fetch_mode_list ( void ) { int num_modes = 0 ; XF86VidModeModeInfo * * modesinfo = NULL ; GFX_MODE_LIST * mode_list ; int i ; XLOCK ( ) ; if ( get_xf86_modes ( & modesinfo , & num_modes ) ) { XUNLOCK ( ) ; return NULL ; } mode_list = malloc ( sizeof ( GFX_MODE_LIST ) ) ; if ( ! mode_list ) { free_modelines ( modesinfo , num_modes ) ; XUNLOCK ( ) ; return NULL ; } mode_list -> mode = malloc ( sizeof ( GFX_MODE ) * ( num_modes + 1 ) ) ; if ( ! mode_list -> mode ) { free ( mode_list ) ; free_modelines ( modesinfo , num_modes ) ; XUNLOCK ( ) ; return NULL ; } for ( i = 0 ; i < num_modes ; i ++ ) { mode_list -> mode [ i ] . width = modesinfo [ i ] -> hdisplay ; mode_list -> mode [ i ] . height = modesinfo [ i ] -> vdisplay ; mode_list -> mode [ i ] . bpp = desktop_color_depth ( ) ; } mode_list -> mode [ num_modes ] . width = 0 ; mode_list -> mode [ num_modes ] . height = 0 ; mode_list -> mode [ num_modes ] . bpp = 0 ; mode_list -> num_modes = num_modes ; free_modelines ( modesinfo , num_modes ) ; XUNLOCK ( ) ; return mode_list ; }
allegro_gl_x_fetch_mode_list:
  Generates a list of valid video modes (made after
  _xvidmode_private_fetch_mode_list of Allegro)
allegro_gl_x_fetch_mode_list : Generates a list of valid video modes ( made after _xvidmode_private_fetch_mode_list of Allegro )
/* Allocate space for mode list.  */ /* Fill in mode list.  */ /* Since XF86VidMode can not change the color depth of
		 * the screen, there is no need to define modes for other
		 * color depth than the desktop's.
		 */