comparison src/video/photon/SDL_ph_video.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 8cc4dbfab9ab
children e8157fcb3114
comparison
equal deleted inserted replaced
203:c6a0a7fe9a21 204:62bad9a82022
152 int i; 152 int i;
153 unsigned long *tempptr; 153 unsigned long *tempptr;
154 int rtnval; 154 int rtnval;
155 PgDisplaySettings_t mysettings; 155 PgDisplaySettings_t mysettings;
156 PgVideoModeInfo_t my_mode_info; 156 PgVideoModeInfo_t my_mode_info;
157 PgHWCaps_t my_hwcaps;
157 158
158 if( NULL == ( event = malloc( EVENT_SIZE ) ) ) 159 if( NULL == ( event = malloc( EVENT_SIZE ) ) )
159 exit( EXIT_FAILURE ); 160 exit( EXIT_FAILURE );
160 161
161 /* Create a widget 'window' to capture events */ 162 /* Create a widget 'window' to capture events */
205 (int)BLANK_CHOTX, (int)BLANK_CHOTY); 206 (int)BLANK_CHOTX, (int)BLANK_CHOTY);
206 207
207 if(SDL_BlankCursor == NULL) 208 if(SDL_BlankCursor == NULL)
208 printf("could not create blank cursor\n"); 209 printf("could not create blank cursor\n");
209 /* Get the video mode */ 210 /* Get the video mode */
211 /*
210 if (PgGetVideoMode( &mysettings ) < 0) 212 if (PgGetVideoMode( &mysettings ) < 0)
211 { 213 {
212 fprintf(stderr,"ph_VideoInit: PgGetVideoMode failed\n"); 214 fprintf(stderr,"ph_VideoInit: PgGetVideoMode failed patch A?? \n");
213 //QNX6/Patch A always fails return code even though call succeeds. fixed Patch B 215 //QNX6/Patch A always fails return code even though call succeeds. fixed Patch B
214 } 216 }
215 217 */
216 if (PgGetVideoModeInfo(mysettings.mode, &my_mode_info) < 0) 218 if (PgGetGraphicsHWCaps(&my_hwcaps) < 0)
219 {
220 fprintf(stderr,"ph_VideoInit: GetGraphicsHWCaps failed!! \n");
221 //that HAVE to work
222 }
223 if (PgGetVideoModeInfo(my_hwcaps.current_video_mode, &my_mode_info) < 0)
217 { 224 {
218 fprintf(stderr,"ph_VideoInit: PgGetVideoModeInfo failed\n"); 225 fprintf(stderr,"ph_VideoInit: PgGetVideoModeInfo failed\n");
219 } 226 }
220 //We need to return BytesPerPixel as it in used by CreateRGBsurface 227 //We need to return BytesPerPixel as it in used by CreateRGBsurface
221 vformat->BitsPerPixel = my_mode_info.bits_per_pixel; 228 vformat->BitsPerPixel = my_mode_info.bits_per_pixel;
256 static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current, 263 static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current,
257 int width, int height, int bpp, Uint32 flags) 264 int width, int height, int bpp, Uint32 flags)
258 { 265 {
259 PhRegion_t region_info; 266 PhRegion_t region_info;
260 PgDisplaySettings_t settings; 267 PgDisplaySettings_t settings;
268 PgHWCaps_t my_hwcaps;
261 PgVideoModeInfo_t mode_info; 269 PgVideoModeInfo_t mode_info;
262 int mode, actual_width, actual_height; 270 int mode, actual_width, actual_height;
263 PtArg_t arg[5]; 271 PtArg_t arg[5];
264 PhDim_t dim; 272 PhDim_t dim;
265 int rtnval; 273 int rtnval;
293 301
294 302
295 /* Get the video mode and set it */ 303 /* Get the video mode and set it */
296 if (bpp == 0) 304 if (bpp == 0)
297 { 305 {
306 /*again same issue, same solution
298 if (PgGetVideoMode( &settings ) < 0) 307 if (PgGetVideoMode( &settings ) < 0)
299 { 308 {
300 fprintf(stderr,"error: PgGetVideoMode failed\n"); 309 fprintf(stderr,"error: PgGetVideoMode failed\n");
301 } 310 }
302 if (PgGetVideoModeInfo(settings.mode, &mode_info) < 0) 311 */
312 if (PgGetGraphicsHWCaps(&my_hwcaps) < 0)
313 {
314 fprintf(stderr,"ph_SetVideoMode: GetGraphicsHWCaps failed!! \n");
315 //that HAVE to work
316 }
317 if (PgGetVideoModeInfo(my_hwcaps.current_video_mode, &mode_info) < 0)
303 { 318 {
304 fprintf(stderr,"error: PgGetVideoModeInfo failed\n"); 319 fprintf(stderr,"ph_SetVideoMode: PgGetVideoModeInfo failed\n");
305 } 320 }
306 bpp = mode_info.bits_per_pixel; 321 bpp = mode_info.bits_per_pixel;
307 } 322 }
308 if (flags & SDL_ANYFORMAT) 323 if (flags & SDL_ANYFORMAT)
309 { 324 {
310 if ((mode = get_mode_any_format(width, height, bpp)) == 0) 325 if ((mode = get_mode_any_format(width, height, bpp)) == 0)
311 { 326 {