src/video/photon/SDL_ph_modes.c
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
     1.1 --- a/src/video/photon/SDL_ph_modes.c	Mon May 29 03:53:21 2006 +0000
     1.2 +++ b/src/video/photon/SDL_ph_modes.c	Mon May 29 04:04:35 2006 +0000
     1.3 @@ -31,16 +31,16 @@
     1.4  SDL_Rect *SDL_modearray[PH_MAX_VIDEOMODES];
     1.5  
     1.6  static int
     1.7 -compare_modes_by_res (const void *mode1, const void *mode2)
     1.8 +compare_modes_by_res(const void *mode1, const void *mode2)
     1.9  {
    1.10      PgVideoModeInfo_t mode1_info;
    1.11      PgVideoModeInfo_t mode2_info;
    1.12  
    1.13 -    if (PgGetVideoModeInfo (*(unsigned short *) mode1, &mode1_info) < 0) {
    1.14 +    if (PgGetVideoModeInfo(*(unsigned short *) mode1, &mode1_info) < 0) {
    1.15          return 0;
    1.16      }
    1.17  
    1.18 -    if (PgGetVideoModeInfo (*(unsigned short *) mode2, &mode2_info) < 0) {
    1.19 +    if (PgGetVideoModeInfo(*(unsigned short *) mode2, &mode2_info) < 0) {
    1.20          return 0;
    1.21      }
    1.22  
    1.23 @@ -52,7 +52,7 @@
    1.24  }
    1.25  
    1.26  SDL_Rect **
    1.27 -ph_ListModes (_THIS, SDL_PixelFormat * format, Uint32 flags)
    1.28 +ph_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags)
    1.29  {
    1.30      int i = 0;
    1.31      int j = 0;
    1.32 @@ -62,7 +62,7 @@
    1.33          SDL_modearray[i] = &SDL_modelist[i];
    1.34      }
    1.35  
    1.36 -    if (PgGetVideoModeList (&mode_list) < 0) {
    1.37 +    if (PgGetVideoModeList(&mode_list) < 0) {
    1.38          SDL_SetError
    1.39              ("ph_ListModes(): PgGetVideoModeList() function failed !\n");
    1.40          return NULL;
    1.41 @@ -71,7 +71,7 @@
    1.42      mode_info.bits_per_pixel = 0;
    1.43  
    1.44      for (i = 0; i < mode_list.num_modes; i++) {
    1.45 -        if (PgGetVideoModeInfo (mode_list.modes[i], &mode_info) < 0) {
    1.46 +        if (PgGetVideoModeInfo(mode_list.modes[i], &mode_info) < 0) {
    1.47              SDL_SetError
    1.48                  ("ph_ListModes(): PgGetVideoModeInfo() function failed on mode: 0x%X.\n",
    1.49                   mode_list.modes[i]);
    1.50 @@ -100,7 +100,7 @@
    1.51  }
    1.52  
    1.53  void
    1.54 -ph_FreeVideoModes (_THIS)
    1.55 +ph_FreeVideoModes(_THIS)
    1.56  {
    1.57      return;
    1.58  }
    1.59 @@ -108,13 +108,13 @@
    1.60  /* return the mode associated with width, height and bpp */
    1.61  /* if there is no mode then zero is returned             */
    1.62  int
    1.63 -ph_GetVideoMode (int width, int height, int bpp)
    1.64 +ph_GetVideoMode(int width, int height, int bpp)
    1.65  {
    1.66      int i;
    1.67      int modestage = 0;
    1.68      int closestmode = 0;
    1.69  
    1.70 -    if (PgGetVideoModeList (&mode_list) < 0) {
    1.71 +    if (PgGetVideoModeList(&mode_list) < 0) {
    1.72          return -1;
    1.73      }
    1.74  
    1.75 @@ -125,7 +125,7 @@
    1.76  
    1.77      /* search list for exact match */
    1.78      for (i = 0; i < mode_list.num_modes; i++) {
    1.79 -        if (PgGetVideoModeInfo (mode_list.modes[i], &mode_info) < 0) {
    1.80 +        if (PgGetVideoModeInfo(mode_list.modes[i], &mode_info) < 0) {
    1.81              return 0;
    1.82          }
    1.83  
    1.84 @@ -153,19 +153,19 @@
    1.85  /* return the mode associated with width, height and bpp               */
    1.86  /* if requested bpp is not found the mode with closest bpp is returned */
    1.87  int
    1.88 -get_mode_any_format (int width, int height, int bpp)
    1.89 +get_mode_any_format(int width, int height, int bpp)
    1.90  {
    1.91      int i, closest, delta, min_delta;
    1.92  
    1.93 -    if (PgGetVideoModeList (&mode_list) < 0) {
    1.94 +    if (PgGetVideoModeList(&mode_list) < 0) {
    1.95          return -1;
    1.96      }
    1.97  
    1.98 -    SDL_qsort (mode_list.modes, mode_list.num_modes, sizeof (unsigned short),
    1.99 -               compare_modes_by_res);
   1.100 +    SDL_qsort(mode_list.modes, mode_list.num_modes, sizeof(unsigned short),
   1.101 +              compare_modes_by_res);
   1.102  
   1.103      for (i = 0; i < mode_list.num_modes; i++) {
   1.104 -        if (PgGetVideoModeInfo (mode_list.modes[i], &mode_info) < 0) {
   1.105 +        if (PgGetVideoModeInfo(mode_list.modes[i], &mode_info) < 0) {
   1.106              return 0;
   1.107          }
   1.108          if ((mode_info.width == width) && (mode_info.height == height)) {
   1.109 @@ -180,10 +180,10 @@
   1.110              return mode_list.modes[closest];
   1.111          }
   1.112  
   1.113 -        min_delta = abs (mode_info.bits_per_pixel - bpp);
   1.114 +        min_delta = abs(mode_info.bits_per_pixel - bpp);
   1.115  
   1.116          while (1) {
   1.117 -            if (PgGetVideoModeInfo (mode_list.modes[i], &mode_info) < 0) {
   1.118 +            if (PgGetVideoModeInfo(mode_list.modes[i], &mode_info) < 0) {
   1.119                  return 0;
   1.120              }
   1.121  
   1.122 @@ -195,7 +195,7 @@
   1.123                      closest = i;
   1.124                      break;
   1.125                  } else {
   1.126 -                    delta = abs (mode_info.bits_per_pixel - bpp);
   1.127 +                    delta = abs(mode_info.bits_per_pixel - bpp);
   1.128                      if (delta < min_delta) {
   1.129                          closest = i;
   1.130                          min_delta = delta;
   1.131 @@ -211,13 +211,13 @@
   1.132  }
   1.133  
   1.134  int
   1.135 -ph_ToggleFullScreen (_THIS, int on)
   1.136 +ph_ToggleFullScreen(_THIS, int on)
   1.137  {
   1.138      return -1;
   1.139  }
   1.140  
   1.141  int
   1.142 -ph_EnterFullScreen (_THIS, SDL_Surface * screen, int fmode)
   1.143 +ph_EnterFullScreen(_THIS, SDL_Surface * screen, int fmode)
   1.144  {
   1.145      PgDisplaySettings_t settings;
   1.146      int mode;
   1.147 @@ -228,21 +228,21 @@
   1.148          /* Get the video mode and set it */
   1.149          if (screen->flags & SDL_ANYFORMAT) {
   1.150              if ((mode =
   1.151 -                 get_mode_any_format (screen->w, screen->h,
   1.152 -                                      screen->format->BitsPerPixel)) == 0) {
   1.153 +                 get_mode_any_format(screen->w, screen->h,
   1.154 +                                     screen->format->BitsPerPixel)) == 0) {
   1.155                  SDL_SetError
   1.156                      ("ph_EnterFullScreen(): can't find appropriate video mode !\n");
   1.157                  return 0;
   1.158              }
   1.159          } else {
   1.160              if ((mode =
   1.161 -                 ph_GetVideoMode (screen->w, screen->h,
   1.162 -                                  screen->format->BitsPerPixel)) == 0) {
   1.163 +                 ph_GetVideoMode(screen->w, screen->h,
   1.164 +                                 screen->format->BitsPerPixel)) == 0) {
   1.165                  SDL_SetError
   1.166                      ("ph_EnterFullScreen(): can't find appropriate video mode !\n");
   1.167                  return 0;
   1.168              }
   1.169 -            if (PgGetVideoModeInfo (mode, &mode_info) < 0) {
   1.170 +            if (PgGetVideoModeInfo(mode, &mode_info) < 0) {
   1.171                  SDL_SetError
   1.172                      ("ph_EnterFullScreen(): can't get video mode capabilities !\n");
   1.173                  return 0;
   1.174 @@ -257,7 +257,7 @@
   1.175          }
   1.176  
   1.177          /* save old video mode caps */
   1.178 -        PgGetVideoMode (&settings);
   1.179 +        PgGetVideoMode(&settings);
   1.180          old_video_mode = settings.mode;
   1.181          old_refresh_rate = settings.refresh;
   1.182  
   1.183 @@ -266,14 +266,14 @@
   1.184          settings.refresh = 0;
   1.185          settings.flags = 0;
   1.186  
   1.187 -        refreshrate = SDL_getenv ("SDL_PHOTON_FULLSCREEN_REFRESH");
   1.188 +        refreshrate = SDL_getenv("SDL_PHOTON_FULLSCREEN_REFRESH");
   1.189          if (refreshrate != NULL) {
   1.190 -            if (SDL_sscanf (refreshrate, "%d", &refreshratenum) == 1) {
   1.191 +            if (SDL_sscanf(refreshrate, "%d", &refreshratenum) == 1) {
   1.192                  settings.refresh = refreshratenum;
   1.193              }
   1.194          }
   1.195  
   1.196 -        if (PgSetVideoMode (&settings) < 0) {
   1.197 +        if (PgSetVideoMode(&settings) < 0) {
   1.198              SDL_SetError
   1.199                  ("ph_EnterFullScreen(): PgSetVideoMode() call failed !\n");
   1.200              return 0;
   1.201 @@ -290,26 +290,26 @@
   1.202          if (fmode == 0) {
   1.203              if (OCImage.direct_context == NULL) {
   1.204                  OCImage.direct_context =
   1.205 -                    (PdDirectContext_t *) PdCreateDirectContext ();
   1.206 +                    (PdDirectContext_t *) PdCreateDirectContext();
   1.207                  if (!OCImage.direct_context) {
   1.208                      SDL_SetError
   1.209                          ("ph_EnterFullScreen(): Can't create direct context !\n");
   1.210 -                    ph_LeaveFullScreen (this);
   1.211 +                    ph_LeaveFullScreen(this);
   1.212                      return 0;
   1.213                  }
   1.214              }
   1.215 -            OCImage.oldDC = PdDirectStart (OCImage.direct_context);
   1.216 +            OCImage.oldDC = PdDirectStart(OCImage.direct_context);
   1.217          }
   1.218  
   1.219          currently_fullscreen = 1;
   1.220      }
   1.221 -    PgFlush ();
   1.222 +    PgFlush();
   1.223  
   1.224      return 1;
   1.225  }
   1.226  
   1.227  int
   1.228 -ph_LeaveFullScreen (_THIS)
   1.229 +ph_LeaveFullScreen(_THIS)
   1.230  {
   1.231      PgDisplaySettings_t oldmode_settings;
   1.232  
   1.233 @@ -323,12 +323,12 @@
   1.234          /* release routines starts here */
   1.235          {
   1.236              if (OCImage.direct_context) {
   1.237 -                PdDirectStop (OCImage.direct_context);
   1.238 -                PdReleaseDirectContext (OCImage.direct_context);
   1.239 +                PdDirectStop(OCImage.direct_context);
   1.240 +                PdReleaseDirectContext(OCImage.direct_context);
   1.241                  OCImage.direct_context = NULL;
   1.242              }
   1.243              if (OCImage.oldDC) {
   1.244 -                PhDCSetCurrent (OCImage.oldDC);
   1.245 +                PhDCSetCurrent(OCImage.oldDC);
   1.246                  OCImage.oldDC = NULL;
   1.247              }
   1.248  
   1.249 @@ -340,7 +340,7 @@
   1.250                  oldmode_settings.refresh = (unsigned short) old_refresh_rate;
   1.251                  oldmode_settings.flags = 0;
   1.252  
   1.253 -                if (PgSetVideoMode (&oldmode_settings) < 0) {
   1.254 +                if (PgSetVideoMode(&oldmode_settings) < 0) {
   1.255                      SDL_SetError
   1.256                          ("Ph_LeaveFullScreen(): PgSetVideoMode() function failed !\n");
   1.257                      return 0;