src/video/dc/SDL_dcvideo.c
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
     1.1 --- a/src/video/dc/SDL_dcvideo.c	Mon May 29 03:53:21 2006 +0000
     1.2 +++ b/src/video/dc/SDL_dcvideo.c	Mon May 29 04:04:35 2006 +0000
     1.3 @@ -36,68 +36,67 @@
     1.4  
     1.5  
     1.6  /* Initialization/Query functions */
     1.7 -static int DC_VideoInit (_THIS, SDL_PixelFormat * vformat);
     1.8 -static SDL_Rect **DC_ListModes (_THIS, SDL_PixelFormat * format,
     1.9 -                                Uint32 flags);
    1.10 -static SDL_Surface *DC_SetVideoMode (_THIS, SDL_Surface * current, int width,
    1.11 -                                     int height, int bpp, Uint32 flags);
    1.12 -static int DC_SetColors (_THIS, int firstcolor, int ncolors,
    1.13 -                         SDL_Color * colors);
    1.14 -static void DC_VideoQuit (_THIS);
    1.15 +static int DC_VideoInit(_THIS, SDL_PixelFormat * vformat);
    1.16 +static SDL_Rect **DC_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags);
    1.17 +static SDL_Surface *DC_SetVideoMode(_THIS, SDL_Surface * current, int width,
    1.18 +                                    int height, int bpp, Uint32 flags);
    1.19 +static int DC_SetColors(_THIS, int firstcolor, int ncolors,
    1.20 +                        SDL_Color * colors);
    1.21 +static void DC_VideoQuit(_THIS);
    1.22  
    1.23  /* Hardware surface functions */
    1.24 -static int DC_AllocHWSurface (_THIS, SDL_Surface * surface);
    1.25 -static int DC_LockHWSurface (_THIS, SDL_Surface * surface);
    1.26 -static void DC_UnlockHWSurface (_THIS, SDL_Surface * surface);
    1.27 -static void DC_FreeHWSurface (_THIS, SDL_Surface * surface);
    1.28 -static int DC_FlipHWSurface (_THIS, SDL_Surface * surface);
    1.29 +static int DC_AllocHWSurface(_THIS, SDL_Surface * surface);
    1.30 +static int DC_LockHWSurface(_THIS, SDL_Surface * surface);
    1.31 +static void DC_UnlockHWSurface(_THIS, SDL_Surface * surface);
    1.32 +static void DC_FreeHWSurface(_THIS, SDL_Surface * surface);
    1.33 +static int DC_FlipHWSurface(_THIS, SDL_Surface * surface);
    1.34  
    1.35  /* etc. */
    1.36 -static void DC_UpdateRects (_THIS, int numrects, SDL_Rect * rects);
    1.37 +static void DC_UpdateRects(_THIS, int numrects, SDL_Rect * rects);
    1.38  
    1.39  /* OpenGL */
    1.40  #if SDL_VIDEO_OPENGL
    1.41 -static void *DC_GL_GetProcAddress (_THIS, const char *proc);
    1.42 -static int DC_GL_LoadLibrary (_THIS, const char *path);
    1.43 -static int DC_GL_GetAttribute (_THIS, SDL_GLattr attrib, int *value);
    1.44 -static void DC_GL_SwapBuffers (_THIS);
    1.45 +static void *DC_GL_GetProcAddress(_THIS, const char *proc);
    1.46 +static int DC_GL_LoadLibrary(_THIS, const char *path);
    1.47 +static int DC_GL_GetAttribute(_THIS, SDL_GLattr attrib, int *value);
    1.48 +static void DC_GL_SwapBuffers(_THIS);
    1.49  #endif
    1.50  
    1.51  /* DC driver bootstrap functions */
    1.52  
    1.53  static int
    1.54 -DC_Available (void)
    1.55 +DC_Available(void)
    1.56  {
    1.57      return 1;
    1.58  }
    1.59  
    1.60  static void
    1.61 -DC_DeleteDevice (SDL_VideoDevice * device)
    1.62 +DC_DeleteDevice(SDL_VideoDevice * device)
    1.63  {
    1.64 -    SDL_free (device->hidden);
    1.65 -    SDL_free (device);
    1.66 +    SDL_free(device->hidden);
    1.67 +    SDL_free(device);
    1.68  }
    1.69  
    1.70  static SDL_VideoDevice *
    1.71 -DC_CreateDevice (int devindex)
    1.72 +DC_CreateDevice(int devindex)
    1.73  {
    1.74      SDL_VideoDevice *device;
    1.75  
    1.76      /* Initialize all variables that we clean on shutdown */
    1.77 -    device = (SDL_VideoDevice *) SDL_malloc (sizeof (SDL_VideoDevice));
    1.78 +    device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice));
    1.79      if (device) {
    1.80 -        SDL_memset (device, 0, (sizeof *device));
    1.81 +        SDL_memset(device, 0, (sizeof *device));
    1.82          device->hidden = (struct SDL_PrivateVideoData *)
    1.83 -            SDL_malloc ((sizeof *device->hidden));
    1.84 +            SDL_malloc((sizeof *device->hidden));
    1.85      }
    1.86      if ((device == NULL) || (device->hidden == NULL)) {
    1.87 -        SDL_OutOfMemory ();
    1.88 +        SDL_OutOfMemory();
    1.89          if (device) {
    1.90 -            SDL_free (device);
    1.91 +            SDL_free(device);
    1.92          }
    1.93          return (0);
    1.94      }
    1.95 -    SDL_memset (device->hidden, 0, (sizeof *device->hidden));
    1.96 +    SDL_memset(device->hidden, 0, (sizeof *device->hidden));
    1.97  
    1.98      /* Set the function pointers */
    1.99      device->VideoInit = DC_VideoInit;
   1.100 @@ -143,7 +142,7 @@
   1.101  
   1.102  
   1.103  int
   1.104 -DC_VideoInit (_THIS, SDL_PixelFormat * vformat)
   1.105 +DC_VideoInit(_THIS, SDL_PixelFormat * vformat)
   1.106  {
   1.107      /* Determine the screen depth (use default 16-bit depth) */
   1.108      /* we change this during the SDL_SetVideoMode implementation... */
   1.109 @@ -167,7 +166,7 @@
   1.110  };
   1.111  
   1.112  SDL_Rect **
   1.113 -DC_ListModes (_THIS, SDL_PixelFormat * format, Uint32 flags)
   1.114 +DC_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags)
   1.115  {
   1.116      switch (format->BitsPerPixel) {
   1.117      case 15:
   1.118 @@ -197,8 +196,8 @@
   1.119  #endif
   1.120  
   1.121  SDL_Surface *
   1.122 -DC_SetVideoMode (_THIS, SDL_Surface * current,
   1.123 -                 int width, int height, int bpp, Uint32 flags)
   1.124 +DC_SetVideoMode(_THIS, SDL_Surface * current,
   1.125 +                int width, int height, int bpp, Uint32 flags)
   1.126  {
   1.127      int disp_mode, pixel_mode, pitch;
   1.128      Uint32 Rmask, Gmask, Bmask;
   1.129 @@ -210,7 +209,7 @@
   1.130      else if (width == 800 && height == 600)
   1.131          disp_mode = DM_800x608;
   1.132      else {
   1.133 -        SDL_SetError ("Couldn't find requested mode in list");
   1.134 +        SDL_SetError("Couldn't find requested mode in list");
   1.135          return (NULL);
   1.136      }
   1.137  
   1.138 @@ -244,12 +243,12 @@
   1.139  #endif
   1.140              break;
   1.141      default:
   1.142 -        SDL_SetError ("Couldn't find requested mode in list");
   1.143 +        SDL_SetError("Couldn't find requested mode in list");
   1.144          return (NULL);
   1.145      }
   1.146  
   1.147  //  if ( bpp != current->format->BitsPerPixel ) {
   1.148 -    if (!SDL_ReallocFormat (current, bpp, Rmask, Gmask, Bmask, 0)) {
   1.149 +    if (!SDL_ReallocFormat(current, bpp, Rmask, Gmask, Bmask, 0)) {
   1.150          return (NULL);
   1.151      }
   1.152  //  }
   1.153 @@ -263,11 +262,11 @@
   1.154  #if SDL_VIDEO_OPENGL
   1.155      if (pvr_inited) {
   1.156          pvr_inited = 0;
   1.157 -        pvr_shutdown ();
   1.158 +        pvr_shutdown();
   1.159      }
   1.160  #endif
   1.161  
   1.162 -    vid_set_mode (disp_mode, pixel_mode);
   1.163 +    vid_set_mode(disp_mode, pixel_mode);
   1.164  
   1.165      current->pixels = vram_s;
   1.166  
   1.167 @@ -277,9 +276,9 @@
   1.168          current->flags = SDL_FULLSCREEN | SDL_INTERNALOPENGL;
   1.169          current->pixels = NULL;
   1.170          pvr_inited = 1;
   1.171 -        pvr_init (&params);
   1.172 -        glKosInit ();
   1.173 -        glKosBeginFrame ();
   1.174 +        pvr_init(&params);
   1.175 +        glKosInit();
   1.176 +        glKosBeginFrame();
   1.177      } else
   1.178  #endif
   1.179      if (flags | SDL_DOUBLEBUF) {
   1.180 @@ -293,47 +292,47 @@
   1.181  
   1.182  /* We don't actually allow hardware surfaces other than the main one */
   1.183  static int
   1.184 -DC_AllocHWSurface (_THIS, SDL_Surface * surface)
   1.185 +DC_AllocHWSurface(_THIS, SDL_Surface * surface)
   1.186  {
   1.187      return (-1);
   1.188  }
   1.189  static void
   1.190 -DC_FreeHWSurface (_THIS, SDL_Surface * surface)
   1.191 +DC_FreeHWSurface(_THIS, SDL_Surface * surface)
   1.192  {
   1.193      return;
   1.194  }
   1.195  
   1.196  /* We need to wait for vertical retrace on page flipped displays */
   1.197  static int
   1.198 -DC_LockHWSurface (_THIS, SDL_Surface * surface)
   1.199 +DC_LockHWSurface(_THIS, SDL_Surface * surface)
   1.200  {
   1.201      return (0);
   1.202  }
   1.203  
   1.204  static void
   1.205 -DC_UnlockHWSurface (_THIS, SDL_Surface * surface)
   1.206 +DC_UnlockHWSurface(_THIS, SDL_Surface * surface)
   1.207  {
   1.208      return;
   1.209  }
   1.210  
   1.211  static int
   1.212 -DC_FlipHWSurface (_THIS, SDL_Surface * surface)
   1.213 +DC_FlipHWSurface(_THIS, SDL_Surface * surface)
   1.214  {
   1.215      if (surface->flags & SDL_DOUBLEBUF) {
   1.216 -        vid_set_start ((int) surface->pixels & 0xffffff);
   1.217 +        vid_set_start((int) surface->pixels & 0xffffff);
   1.218          surface->pixels = (void *) ((int) surface->pixels ^ 0x400000);
   1.219      }
   1.220      return (0);
   1.221  }
   1.222  
   1.223  static void
   1.224 -DC_UpdateRects (_THIS, int numrects, SDL_Rect * rects)
   1.225 +DC_UpdateRects(_THIS, int numrects, SDL_Rect * rects)
   1.226  {
   1.227      /* do nothing. */
   1.228  }
   1.229  
   1.230  static int
   1.231 -DC_SetColors (_THIS, int firstcolor, int ncolors, SDL_Color * colors)
   1.232 +DC_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color * colors)
   1.233  {
   1.234      /* do nothing of note. */
   1.235      return (1);
   1.236 @@ -343,12 +342,12 @@
   1.237     another SDL video routine -- notably UpdateRects.
   1.238  */
   1.239  static void
   1.240 -DC_VideoQuit (_THIS)
   1.241 +DC_VideoQuit(_THIS)
   1.242  {
   1.243  #if SDL_VIDEO_OPENGL
   1.244      if (pvr_inited) {
   1.245          pvr_inited = 0;
   1.246 -        pvr_shutdown ();
   1.247 +        pvr_shutdown();
   1.248      }
   1.249  #endif
   1.250  }
   1.251 @@ -356,7 +355,7 @@
   1.252  #if SDL_VIDEO_OPENGL
   1.253  
   1.254  void
   1.255 -dmyfunc (void)
   1.256 +dmyfunc(void)
   1.257  {
   1.258  }
   1.259  
   1.260 @@ -367,47 +366,47 @@
   1.261      funcptr addr;
   1.262  } glfuncs[] = {
   1.263  #define	DEF(func)	{#func,&func}
   1.264 -    DEF (glBegin), DEF (glBindTexture), DEF (glBlendFunc), DEF (glColor4f),
   1.265 +    DEF(glBegin), DEF(glBindTexture), DEF(glBlendFunc), DEF(glColor4f),
   1.266  //      DEF(glCopyImageID),
   1.267 -        DEF (glDisable),
   1.268 -        DEF (glEnable),
   1.269 -        DEF (glEnd),
   1.270 -        DEF (glFlush),
   1.271 -        DEF (glGenTextures),
   1.272 -        DEF (glGetString),
   1.273 -        DEF (glLoadIdentity),
   1.274 -        DEF (glMatrixMode), DEF (glOrtho), DEF (glPixelStorei),
   1.275 +        DEF(glDisable),
   1.276 +        DEF(glEnable),
   1.277 +        DEF(glEnd),
   1.278 +        DEF(glFlush),
   1.279 +        DEF(glGenTextures),
   1.280 +        DEF(glGetString),
   1.281 +        DEF(glLoadIdentity),
   1.282 +        DEF(glMatrixMode), DEF(glOrtho), DEF(glPixelStorei),
   1.283  //      DEF(glPopAttrib),
   1.284  //      DEF(glPopClientAttrib),
   1.285      {
   1.286      "glPopAttrib", &dmyfunc}, {
   1.287 -    "glPopClientAttrib", &dmyfunc}, DEF (glPopMatrix),
   1.288 +    "glPopClientAttrib", &dmyfunc}, DEF(glPopMatrix),
   1.289  //      DEF(glPushAttrib),
   1.290  //      DEF(glPushClientAttrib),
   1.291      {
   1.292      "glPushAttrib", &dmyfunc}, {
   1.293      "glPushClientAttrib", &dmyfunc},
   1.294 -        DEF (glPushMatrix),
   1.295 -        DEF (glTexCoord2f),
   1.296 -        DEF (glTexEnvf),
   1.297 -        DEF (glTexImage2D),
   1.298 -        DEF (glTexParameteri),
   1.299 -        DEF (glTexSubImage2D), DEF (glVertex2i), DEF (glViewport),
   1.300 +        DEF(glPushMatrix),
   1.301 +        DEF(glTexCoord2f),
   1.302 +        DEF(glTexEnvf),
   1.303 +        DEF(glTexImage2D),
   1.304 +        DEF(glTexParameteri),
   1.305 +        DEF(glTexSubImage2D), DEF(glVertex2i), DEF(glViewport),
   1.306  #undef	DEF
   1.307  };
   1.308  
   1.309  static void *
   1.310 -DC_GL_GetProcAddress (_THIS, const char *proc)
   1.311 +DC_GL_GetProcAddress(_THIS, const char *proc)
   1.312  {
   1.313      void *ret;
   1.314      int i;
   1.315  
   1.316 -    ret = glKosGetProcAddress (proc);
   1.317 +    ret = glKosGetProcAddress(proc);
   1.318      if (ret)
   1.319          return ret;
   1.320  
   1.321 -    for (i = 0; i < sizeof (glfuncs) / sizeof (glfuncs[0]); i++) {
   1.322 -        if (SDL_strcmp (proc, glfuncs[i].name) == 0)
   1.323 +    for (i = 0; i < sizeof(glfuncs) / sizeof(glfuncs[0]); i++) {
   1.324 +        if (SDL_strcmp(proc, glfuncs[i].name) == 0)
   1.325              return glfuncs[i].addr;
   1.326      }
   1.327  
   1.328 @@ -415,7 +414,7 @@
   1.329  }
   1.330  
   1.331  static int
   1.332 -DC_GL_LoadLibrary (_THIS, const char *path)
   1.333 +DC_GL_LoadLibrary(_THIS, const char *path)
   1.334  {
   1.335      this->gl_config.driver_loaded = 1;
   1.336  
   1.337 @@ -423,7 +422,7 @@
   1.338  }
   1.339  
   1.340  static int
   1.341 -DC_GL_GetAttribute (_THIS, SDL_GLattr attrib, int *value)
   1.342 +DC_GL_GetAttribute(_THIS, SDL_GLattr attrib, int *value)
   1.343  {
   1.344      GLenum mesa_attrib;
   1.345      int val;
   1.346 @@ -469,10 +468,10 @@
   1.347  }
   1.348  
   1.349  static void
   1.350 -DC_GL_SwapBuffers (_THIS)
   1.351 +DC_GL_SwapBuffers(_THIS)
   1.352  {
   1.353 -    glKosFinishFrame ();
   1.354 -    glKosBeginFrame ();
   1.355 +    glKosFinishFrame();
   1.356 +    glKosBeginFrame();
   1.357  }
   1.358  #endif
   1.359  /* vi: set ts=4 sw=4 expandtab: */