comparison src/video/photon/SDL_ph_modes.c @ 204:62bad9a82022

Added photon fixes submitted by Luca Barbato
author Sam Lantinga <slouken@libsdl.org>
date Mon, 08 Oct 2001 18:54:06 +0000
parents 74212992fb08
children e8157fcb3114
comparison
equal deleted inserted replaced
203:c6a0a7fe9a21 204:62bad9a82022
203 return ph_SupportedVisual( format); 203 return ph_SupportedVisual( format);
204 } 204 }
205 205
206 void ph_FreeVideoModes(_THIS) 206 void ph_FreeVideoModes(_THIS)
207 { 207 {
208 int i; 208 // int i;
209 209
210 // if ( SDL_modelist ) { 210 // if ( SDL_modelist ) {
211 // for ( i=0; SDL_modelist[i]; ++i ) { 211 // for ( i=0; SDL_modelist[i]; ++i ) {
212 // free(SDL_modelist[i]); 212 // free(SDL_modelist[i]);
213 // } 213 // }
220 { 220 {
221 221
222 if ( use_vidmode ) { 222 if ( use_vidmode ) {
223 PgDisplaySettings_t settings; 223 PgDisplaySettings_t settings;
224 PgVideoModeInfo_t current_mode_info; 224 PgVideoModeInfo_t current_mode_info;
225 PgHWCaps_t my_hwcaps;
225 unsigned short current_bpp; 226 unsigned short current_bpp;
226 int i; 227 int i;
227 228 /*
228 if (PgGetVideoMode( &settings ) < 0) 229 if (PgGetVideoMode( &settings ) < 0)
229 { 230 {
230 fprintf(stderr,"error: PgGetVideoMode failed\n"); 231 fprintf(stderr,"error: PgGetVideoMode failed\n");
231 return; 232 return;
232 } 233 }
233 if (PgGetVideoModeInfo( settings.mode, &current_mode_info ) < 0) 234 if (PgGetVideoModeInfo( settings.mode, &current_mode_info ) < 0)
234 { 235 {
235 fprintf(stderr,"error: PgGetVideoModeInfo failed\n"); 236 fprintf(stderr,"error: PgGetVideoModeInfo failed\n");
236 return; 237 return;
237 } 238 }
239 */
240 //lu_zero
241 if (PgGetGraphicsHWCaps(&my_hwcaps) < 0)
242 {
243 fprintf(stderr,"set_best_resolution: GetGraphicsHWCaps failed!! \n");
244 //that HAVE to work
245 }
246 if (PgGetVideoModeInfo(my_hwcaps.current_video_mode, &current_mode_info) < 0)
247 {
248 fprintf(stderr,"set_best_resolution: PgGetVideoModeInfo failed\n");
249 }
238 current_bpp = current_mode_info.bits_per_pixel; 250 current_bpp = current_mode_info.bits_per_pixel;
239 251
240 if (PgGetVideoModeList(&mode_list) >= 0) 252 if (PgGetVideoModeList(&mode_list) >= 0)
241 { 253 {
242 qsort(mode_list.modes, mode_list.num_modes, sizeof(unsigned short), compare_modes_by_res); 254 qsort(mode_list.modes, mode_list.num_modes, sizeof(unsigned short), compare_modes_by_res);
277 289
278 static void get_real_resolution(_THIS, int* w, int* h) 290 static void get_real_resolution(_THIS, int* w, int* h)
279 { 291 {
280 292
281 if ( use_vidmode ) { 293 if ( use_vidmode ) {
282 PgDisplaySettings_t settings; 294 //PgDisplaySettings_t settings;
295 PgVideoModeInfo_t current_mode_info;
296 PgHWCaps_t my_hwcaps;
283 int unused; 297 int unused;
284 298 /*
285 if (PgGetVideoMode( &settings ) >= 0) { 299 if (PgGetVideoMode( &settings ) >= 0) {
286 *w = settings.xres; 300 *w = settings.xres;
287 *h = settings.yres; 301 *h = settings.yres;
288 return; 302 return;
289 } 303 }*/
304 if (PgGetGraphicsHWCaps(&my_hwcaps) >= 0)
305 {
306 if (PgGetVideoModeInfo(my_hwcaps.current_video_mode, &current_mode_info) < 0)
307 {
308 fprintf(stderr,"get_real_resolution: PgGetVideoModeInfo failed\n");
309 }
310 *w = current_mode_info.width;
311 *h = current_mode_info.height;
312 }
290 } 313 }
291 // *w = DisplayWidth(SDL_Display, SDL_Screen); 314 // *w = DisplayWidth(SDL_Display, SDL_Screen);
292 // *h = DisplayHeight(SDL_Display, SDL_Screen); 315 // *h = DisplayHeight(SDL_Display, SDL_Screen);
293 } 316 }
294 317