Added photon fixes submitted by Luca Barbato
authorSam Lantinga <slouken@libsdl.org>
Mon, 08 Oct 2001 18:54:06 +0000
changeset 20462bad9a82022
parent 203 c6a0a7fe9a21
child 205 13161d3d349d
Added photon fixes submitted by Luca Barbato
src/video/photon/SDL_ph_modes.c
src/video/photon/SDL_ph_video.c
     1.1 --- a/src/video/photon/SDL_ph_modes.c	Sun Sep 30 20:23:55 2001 +0000
     1.2 +++ b/src/video/photon/SDL_ph_modes.c	Mon Oct 08 18:54:06 2001 +0000
     1.3 @@ -205,7 +205,7 @@
     1.4  
     1.5  void ph_FreeVideoModes(_THIS)
     1.6  {
     1.7 -    int i;
     1.8 +//    int i;
     1.9  
    1.10   //   if ( SDL_modelist ) {
    1.11   //       for ( i=0; SDL_modelist[i]; ++i ) {
    1.12 @@ -222,9 +222,10 @@
    1.13      if ( use_vidmode ) {
    1.14  		PgDisplaySettings_t 	settings;
    1.15  		PgVideoModeInfo_t		current_mode_info;
    1.16 +		PgHWCaps_t my_hwcaps;
    1.17  		unsigned short			current_bpp;
    1.18          int i;
    1.19 -
    1.20 +	/*
    1.21  		if (PgGetVideoMode( &settings ) < 0)
    1.22  		{
    1.23  			fprintf(stderr,"error: PgGetVideoMode failed\n");
    1.24 @@ -235,6 +236,17 @@
    1.25  			fprintf(stderr,"error: PgGetVideoModeInfo failed\n");
    1.26  			return;
    1.27  		}
    1.28 +		*/
    1.29 +		//lu_zero 
    1.30 +         if (PgGetGraphicsHWCaps(&my_hwcaps) < 0)
    1.31 +         	{
    1.32 +                fprintf(stderr,"set_best_resolution:  GetGraphicsHWCaps failed!! \n");
    1.33 +      			//that HAVE to work
    1.34 +            }
    1.35 +         if (PgGetVideoModeInfo(my_hwcaps.current_video_mode, &current_mode_info) < 0)
    1.36 +            {
    1.37 +                fprintf(stderr,"set_best_resolution:  PgGetVideoModeInfo failed\n");
    1.38 +            }
    1.39  		current_bpp = current_mode_info.bits_per_pixel;
    1.40  
    1.41          if (PgGetVideoModeList(&mode_list) >= 0)
    1.42 @@ -279,14 +291,25 @@
    1.43  {
    1.44  
    1.45      if ( use_vidmode ) {
    1.46 -        PgDisplaySettings_t settings;
    1.47 +        //PgDisplaySettings_t settings;
    1.48 +	    PgVideoModeInfo_t		current_mode_info;
    1.49 +	    	PgHWCaps_t my_hwcaps;
    1.50          int unused;
    1.51 -
    1.52 +		/*
    1.53          if (PgGetVideoMode( &settings ) >= 0) {
    1.54  			*w = settings.xres;
    1.55  			*h = settings.yres;
    1.56              return;
    1.57 -        }
    1.58 +        }*/
    1.59 +            if (PgGetGraphicsHWCaps(&my_hwcaps) >= 0)
    1.60 +         	{
    1.61 +                 if (PgGetVideoModeInfo(my_hwcaps.current_video_mode, &current_mode_info) < 0)
    1.62 +           		 {
    1.63 +                fprintf(stderr,"get_real_resolution:  PgGetVideoModeInfo failed\n");
    1.64 +            		 }
    1.65 +				*w = current_mode_info.width;
    1.66 +				*h = current_mode_info.height;            
    1.67 +            }
    1.68      }
    1.69  //    *w = DisplayWidth(SDL_Display, SDL_Screen);
    1.70  //    *h = DisplayHeight(SDL_Display, SDL_Screen);
     2.1 --- a/src/video/photon/SDL_ph_video.c	Sun Sep 30 20:23:55 2001 +0000
     2.2 +++ b/src/video/photon/SDL_ph_video.c	Mon Oct 08 18:54:06 2001 +0000
     2.3 @@ -154,6 +154,7 @@
     2.4  	int rtnval;
     2.5  	PgDisplaySettings_t mysettings;
     2.6  	PgVideoModeInfo_t my_mode_info;
     2.7 +	PgHWCaps_t my_hwcaps;
     2.8  	
     2.9       if( NULL == ( event = malloc( EVENT_SIZE ) ) )
    2.10            exit( EXIT_FAILURE );
    2.11 @@ -207,13 +208,19 @@
    2.12  	if(SDL_BlankCursor == NULL)
    2.13  	  printf("could not create blank cursor\n");
    2.14       /* Get the video mode */
    2.15 +     /*    
    2.16           if (PgGetVideoMode( &mysettings ) < 0)
    2.17              {
    2.18 -                fprintf(stderr,"ph_VideoInit:  PgGetVideoMode failed\n");
    2.19 +                fprintf(stderr,"ph_VideoInit:  PgGetVideoMode failed patch A?? \n");
    2.20        			//QNX6/Patch A always fails return code even though call succeeds. fixed Patch B
    2.21              }
    2.22 -        
    2.23 -         if (PgGetVideoModeInfo(mysettings.mode, &my_mode_info) < 0)
    2.24 +       */
    2.25 +         if (PgGetGraphicsHWCaps(&my_hwcaps) < 0)
    2.26 +         	{
    2.27 +                fprintf(stderr,"ph_VideoInit:  GetGraphicsHWCaps failed!! \n");
    2.28 +      			//that HAVE to work
    2.29 +            }
    2.30 +         if (PgGetVideoModeInfo(my_hwcaps.current_video_mode, &my_mode_info) < 0)
    2.31              {
    2.32                  fprintf(stderr,"ph_VideoInit:  PgGetVideoModeInfo failed\n");
    2.33              }
    2.34 @@ -258,6 +265,7 @@
    2.35  {
    2.36      PhRegion_t region_info;
    2.37      PgDisplaySettings_t settings;
    2.38 +    PgHWCaps_t my_hwcaps;
    2.39  	PgVideoModeInfo_t mode_info;
    2.40      int mode, actual_width, actual_height;
    2.41  	PtArg_t arg[5];
    2.42 @@ -295,15 +303,22 @@
    2.43          /* Get the video mode and set it */
    2.44          if (bpp == 0)
    2.45          {
    2.46 +            /*again same issue, same solution
    2.47              if (PgGetVideoMode( &settings ) < 0)
    2.48              {
    2.49                  fprintf(stderr,"error: PgGetVideoMode failed\n");
    2.50              }
    2.51 -            if (PgGetVideoModeInfo(settings.mode, &mode_info) < 0)
    2.52 +            */
    2.53 +         if (PgGetGraphicsHWCaps(&my_hwcaps) < 0)
    2.54 +         	{
    2.55 +                fprintf(stderr,"ph_SetVideoMode:  GetGraphicsHWCaps failed!! \n");
    2.56 +      			//that HAVE to work
    2.57 +            }
    2.58 +         if (PgGetVideoModeInfo(my_hwcaps.current_video_mode, &mode_info) < 0)
    2.59              {
    2.60 -                fprintf(stderr,"error: PgGetVideoModeInfo failed\n");
    2.61 +                fprintf(stderr,"ph_SetVideoMode:  PgGetVideoModeInfo failed\n");
    2.62              }
    2.63 -            bpp = mode_info.bits_per_pixel;
    2.64 +           bpp = mode_info.bits_per_pixel;
    2.65          }
    2.66          if (flags & SDL_ANYFORMAT)
    2.67          {