src/video/riscos/SDL_riscosFullScreenVideo.c
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
     1.1 --- a/src/video/riscos/SDL_riscosFullScreenVideo.c	Mon May 29 03:53:21 2006 +0000
     1.2 +++ b/src/video/riscos/SDL_riscosFullScreenVideo.c	Mon May 29 04:04:35 2006 +0000
     1.3 @@ -57,51 +57,50 @@
     1.4  
     1.5  
     1.6  /* Helper functions */
     1.7 -void FULLSCREEN_SetDeviceMode (_THIS);
     1.8 -int FULLSCREEN_SetMode (int width, int height, int bpp);
     1.9 -void FULLSCREEN_SetupBanks (_THIS);
    1.10 +void FULLSCREEN_SetDeviceMode(_THIS);
    1.11 +int FULLSCREEN_SetMode(int width, int height, int bpp);
    1.12 +void FULLSCREEN_SetupBanks(_THIS);
    1.13  
    1.14  /* SDL video device functions for fullscreen mode */
    1.15 -static int FULLSCREEN_SetColors (_THIS, int firstcolor, int ncolors,
    1.16 -                                 SDL_Color * colors);
    1.17 -static int FULLSCREEN_FlipHWSurface (_THIS, SDL_Surface * surface);
    1.18 -void FULLSCREEN_SetWMCaption (_THIS, const char *title, const char *icon);
    1.19 -extern int RISCOS_GetWmInfo (_THIS, SDL_SysWMinfo * info);
    1.20 +static int FULLSCREEN_SetColors(_THIS, int firstcolor, int ncolors,
    1.21 +                                SDL_Color * colors);
    1.22 +static int FULLSCREEN_FlipHWSurface(_THIS, SDL_Surface * surface);
    1.23 +void FULLSCREEN_SetWMCaption(_THIS, const char *title, const char *icon);
    1.24 +extern int RISCOS_GetWmInfo(_THIS, SDL_SysWMinfo * info);
    1.25  
    1.26  /* UpdateRects variants */
    1.27 -static void FULLSCREEN_UpdateRects (_THIS, int numrects, SDL_Rect * rects);
    1.28 -static void FULLSCREEN_UpdateRectsMemCpy (_THIS, int numrects,
    1.29 -                                          SDL_Rect * rects);
    1.30 -static void FULLSCREEN_UpdateRects8bpp (_THIS, int numrects,
    1.31 +static void FULLSCREEN_UpdateRects(_THIS, int numrects, SDL_Rect * rects);
    1.32 +static void FULLSCREEN_UpdateRectsMemCpy(_THIS, int numrects,
    1.33 +                                         SDL_Rect * rects);
    1.34 +static void FULLSCREEN_UpdateRects8bpp(_THIS, int numrects, SDL_Rect * rects);
    1.35 +static void FULLSCREEN_UpdateRects16bpp(_THIS, int numrects,
    1.36                                          SDL_Rect * rects);
    1.37 -static void FULLSCREEN_UpdateRects16bpp (_THIS, int numrects,
    1.38 -                                         SDL_Rect * rects);
    1.39 -static void FULLSCREEN_UpdateRects32bpp (_THIS, int numrects,
    1.40 -                                         SDL_Rect * rects);
    1.41 -static void FULLSCREEN_UpdateRectsOS (_THIS, int numrects, SDL_Rect * rects);
    1.42 +static void FULLSCREEN_UpdateRects32bpp(_THIS, int numrects,
    1.43 +                                        SDL_Rect * rects);
    1.44 +static void FULLSCREEN_UpdateRectsOS(_THIS, int numrects, SDL_Rect * rects);
    1.45  
    1.46  /* Local helper functions */
    1.47 -static int cmpmodes (const void *va, const void *vb);
    1.48 -static int FULLSCREEN_AddMode (_THIS, int bpp, int w, int h);
    1.49 -void FULLSCREEN_SetWriteBank (int bank);
    1.50 -void FULLSCREEN_SetDisplayBank (int bank);
    1.51 -static void FULLSCREEN_DisableEscape ();
    1.52 -static void FULLSCREEN_EnableEscape ();
    1.53 -void FULLSCREEN_BuildModeList (_THIS);
    1.54 +static int cmpmodes(const void *va, const void *vb);
    1.55 +static int FULLSCREEN_AddMode(_THIS, int bpp, int w, int h);
    1.56 +void FULLSCREEN_SetWriteBank(int bank);
    1.57 +void FULLSCREEN_SetDisplayBank(int bank);
    1.58 +static void FULLSCREEN_DisableEscape();
    1.59 +static void FULLSCREEN_EnableEscape();
    1.60 +void FULLSCREEN_BuildModeList(_THIS);
    1.61  
    1.62  /* Following variable is set up in riskosTask.c */
    1.63  extern int riscos_backbuffer;   /* Create a back buffer in system memory for full screen mode */
    1.64  
    1.65  /* Following is used to create a sprite back buffer */
    1.66 -extern unsigned char *WIMP_CreateBuffer (int width, int height, int bpp);
    1.67 +extern unsigned char *WIMP_CreateBuffer(int width, int height, int bpp);
    1.68  
    1.69  /* Fast assembler copy */
    1.70 -extern void RISCOS_Put32 (void *to, int pixels, int pitch, int rows,
    1.71 -                          void *from, int src_skip_bytes);
    1.72 +extern void RISCOS_Put32(void *to, int pixels, int pitch, int rows,
    1.73 +                         void *from, int src_skip_bytes);
    1.74  
    1.75  SDL_Surface *
    1.76 -FULLSCREEN_SetVideoMode (_THIS, SDL_Surface * current,
    1.77 -                         int width, int height, int bpp, Uint32 flags)
    1.78 +FULLSCREEN_SetVideoMode(_THIS, SDL_Surface * current,
    1.79 +                        int width, int height, int bpp, Uint32 flags)
    1.80  {
    1.81      _kernel_swi_regs regs;
    1.82      Uint32 Rmask = 0;
    1.83 @@ -128,23 +127,22 @@
    1.84          break;
    1.85  
    1.86      default:
    1.87 -        SDL_SetError ("Pixel depth not supported");
    1.88 +        SDL_SetError("Pixel depth not supported");
    1.89          return NULL;
    1.90          break;
    1.91      }
    1.92  
    1.93 -    if (FULLSCREEN_SetMode (width, height, bpp) == 0) {
    1.94 -        SDL_SetError ("Couldn't set requested mode");
    1.95 +    if (FULLSCREEN_SetMode(width, height, bpp) == 0) {
    1.96 +        SDL_SetError("Couldn't set requested mode");
    1.97          return (NULL);
    1.98      }
    1.99  
   1.100  /* 	printf("Setting mode %dx%d\n", width, height); */
   1.101  
   1.102      /* Allocate the new pixel format for the screen */
   1.103 -    if (!SDL_ReallocFormat (current, bpp, Rmask, Gmask, Bmask, 0)) {
   1.104 -        RISCOS_RestoreWimpMode ();
   1.105 -        SDL_SetError
   1.106 -            ("Couldn't allocate new pixel format for requested mode");
   1.107 +    if (!SDL_ReallocFormat(current, bpp, Rmask, Gmask, Bmask, 0)) {
   1.108 +        RISCOS_RestoreWimpMode();
   1.109 +        SDL_SetError("Couldn't allocate new pixel format for requested mode");
   1.110          return (NULL);
   1.111      }
   1.112  
   1.113 @@ -156,18 +154,18 @@
   1.114  
   1.115      /* Get screen width in bytes */
   1.116      regs.r[1] = 6;              // Screen Width in bytes
   1.117 -    _kernel_swi (OS_ReadModeVariable, &regs, &regs);
   1.118 +    _kernel_swi(OS_ReadModeVariable, &regs, &regs);
   1.119  
   1.120      current->pitch = regs.r[2];
   1.121  
   1.122      if (flags & SDL_DOUBLEBUF) {
   1.123          regs.r[0] = 2;          /* Screen area */
   1.124 -        _kernel_swi (OS_ReadDynamicArea, &regs, &regs);
   1.125 +        _kernel_swi(OS_ReadDynamicArea, &regs, &regs);
   1.126  
   1.127          /* Reg 1 has amount of memory currently used for display */
   1.128          regs.r[0] = 2;          /* Screen area */
   1.129          regs.r[1] = (current->pitch * height * 2) - regs.r[1];
   1.130 -        if (_kernel_swi (OS_ChangeDynamicArea, &regs, &regs) != NULL) {
   1.131 +        if (_kernel_swi(OS_ChangeDynamicArea, &regs, &regs) != NULL) {
   1.132              /* Can't allocate enough screen memory for double buffer */
   1.133              flags &= ~SDL_DOUBLEBUF;
   1.134          }
   1.135 @@ -178,13 +176,13 @@
   1.136  
   1.137      /* Need to set display banks here for double buffering */
   1.138      if (flags & SDL_DOUBLEBUF) {
   1.139 -        FULLSCREEN_SetWriteBank (0);
   1.140 -        FULLSCREEN_SetDisplayBank (1);
   1.141 +        FULLSCREEN_SetWriteBank(0);
   1.142 +        FULLSCREEN_SetDisplayBank(1);
   1.143  
   1.144          create_back_buffer = 0; /* Don't need a back buffer for a double buffered display */
   1.145      }
   1.146  
   1.147 -    FULLSCREEN_SetupBanks (this);
   1.148 +    FULLSCREEN_SetupBanks(this);
   1.149  
   1.150      if (create_back_buffer) {
   1.151          /* If not double buffered we may need to create a memory
   1.152 @@ -193,12 +191,12 @@
   1.153           ** SDL$<name>$BackBuffer >= 1
   1.154           */
   1.155          if (riscos_backbuffer == 3)
   1.156 -            this->hidden->bank[0] = WIMP_CreateBuffer (width, height, bpp);
   1.157 +            this->hidden->bank[0] = WIMP_CreateBuffer(width, height, bpp);
   1.158          else
   1.159 -            this->hidden->bank[0] = SDL_malloc (height * current->pitch);
   1.160 +            this->hidden->bank[0] = SDL_malloc(height * current->pitch);
   1.161          if (this->hidden->bank[0] == 0) {
   1.162 -            RISCOS_RestoreWimpMode ();
   1.163 -            SDL_SetError ("Couldnt allocate memory for back buffer");
   1.164 +            RISCOS_RestoreWimpMode();
   1.165 +            SDL_SetError("Couldnt allocate memory for back buffer");
   1.166              return (NULL);
   1.167          }
   1.168          /* Surface updated in programs is now a software surface */
   1.169 @@ -207,7 +205,7 @@
   1.170  
   1.171      /* Store address of allocated screen bank to be freed later */
   1.172      if (this->hidden->alloc_bank)
   1.173 -        SDL_free (this->hidden->alloc_bank);
   1.174 +        SDL_free(this->hidden->alloc_bank);
   1.175      if (create_back_buffer) {
   1.176          this->hidden->alloc_bank = this->hidden->bank[0];
   1.177          if (riscos_backbuffer == 3) {
   1.178 @@ -219,8 +217,8 @@
   1.179          this->hidden->alloc_bank = 0;
   1.180  
   1.181      // Clear both banks to black
   1.182 -    SDL_memset (this->hidden->bank[0], 0, height * current->pitch);
   1.183 -    SDL_memset (this->hidden->bank[1], 0, height * current->pitch);
   1.184 +    SDL_memset(this->hidden->bank[0], 0, height * current->pitch);
   1.185 +    SDL_memset(this->hidden->bank[1], 0, height * current->pitch);
   1.186  
   1.187      this->hidden->current_bank = 0;
   1.188      current->pixels = this->hidden->bank[0];
   1.189 @@ -229,7 +227,7 @@
   1.190      this->screen = current;
   1.191  
   1.192      /* Reset device functions for the wimp */
   1.193 -    FULLSCREEN_SetDeviceMode (this);
   1.194 +    FULLSCREEN_SetDeviceMode(this);
   1.195  
   1.196  /*	FULLSCREEN_DisableEscape(); */
   1.197  
   1.198 @@ -239,7 +237,7 @@
   1.199  
   1.200  /* Reset any device functions that have been changed because we have run in WIMP mode */
   1.201  void
   1.202 -FULLSCREEN_SetDeviceMode (_THIS)
   1.203 +FULLSCREEN_SetDeviceMode(_THIS)
   1.204  {
   1.205      /* Update rects is different if we have a backbuffer */
   1.206  
   1.207 @@ -290,7 +288,7 @@
   1.208  
   1.209  /* Query for the list of available video modes */
   1.210  void
   1.211 -FULLSCREEN_BuildModeList (_THIS)
   1.212 +FULLSCREEN_BuildModeList(_THIS)
   1.213  {
   1.214      _kernel_swi_regs regs;
   1.215      char *enumInfo = NULL;
   1.216 @@ -304,23 +302,23 @@
   1.217      regs.r[2] = 0;              /* Number of modes to skip */
   1.218      regs.r[6] = 0;              /* pointer to block or 0 for count */
   1.219      regs.r[7] = 0;              /* Size of block in bytes */
   1.220 -    _kernel_swi (OS_ScreenMode, &regs, &regs);
   1.221 +    _kernel_swi(OS_ScreenMode, &regs, &regs);
   1.222  
   1.223      num_modes = -regs.r[2];
   1.224  
   1.225      /* Video memory should be in r[5] */
   1.226      this->info.video_mem = regs.r[5] / 1024;
   1.227  
   1.228 -    enumInfo = (unsigned char *) SDL_malloc (-regs.r[7]);
   1.229 +    enumInfo = (unsigned char *) SDL_malloc(-regs.r[7]);
   1.230      if (enumInfo == NULL) {
   1.231 -        SDL_OutOfMemory ();
   1.232 +        SDL_OutOfMemory();
   1.233          return;
   1.234      }
   1.235      /* Read mode information into block */
   1.236      regs.r[2] = 0;
   1.237      regs.r[6] = (int) enumInfo;
   1.238      regs.r[7] = -regs.r[7];
   1.239 -    _kernel_swi (OS_ScreenMode, &regs, &regs);
   1.240 +    _kernel_swi(OS_ScreenMode, &regs, &regs);
   1.241  
   1.242      enum_ptr = enumInfo;
   1.243  
   1.244 @@ -329,13 +327,13 @@
   1.245          if ((blockInfo[1] & 255) == 1) {        /* We understand this format */
   1.246              switch (blockInfo[4]) {
   1.247              case 3:            /* 8 bits per pixel */
   1.248 -                FULLSCREEN_AddMode (this, 8, blockInfo[2], blockInfo[3]);
   1.249 +                FULLSCREEN_AddMode(this, 8, blockInfo[2], blockInfo[3]);
   1.250                  break;
   1.251              case 4:            /* 15 bits per pixel */
   1.252 -                FULLSCREEN_AddMode (this, 15, blockInfo[2], blockInfo[3]);
   1.253 +                FULLSCREEN_AddMode(this, 15, blockInfo[2], blockInfo[3]);
   1.254                  break;
   1.255              case 5:            /* 32 bits per pixel */
   1.256 -                FULLSCREEN_AddMode (this, 32, blockInfo[2], blockInfo[3]);
   1.257 +                FULLSCREEN_AddMode(this, 32, blockInfo[2], blockInfo[3]);
   1.258                  break;
   1.259              }
   1.260          }
   1.261 @@ -343,43 +341,43 @@
   1.262          enum_ptr += blockInfo[0];
   1.263      }
   1.264  
   1.265 -    SDL_free (enumInfo);
   1.266 +    SDL_free(enumInfo);
   1.267  
   1.268      /* Sort the mode lists */
   1.269      for (j = 0; j < NUM_MODELISTS; ++j) {
   1.270          if (SDL_nummodes[j] > 0) {
   1.271 -            SDL_qsort (SDL_modelist[j], SDL_nummodes[j],
   1.272 -                       sizeof *SDL_modelist[j], cmpmodes);
   1.273 +            SDL_qsort(SDL_modelist[j], SDL_nummodes[j],
   1.274 +                      sizeof *SDL_modelist[j], cmpmodes);
   1.275          }
   1.276      }
   1.277  }
   1.278  
   1.279  static int
   1.280 -FULLSCREEN_FlipHWSurface (_THIS, SDL_Surface * surface)
   1.281 +FULLSCREEN_FlipHWSurface(_THIS, SDL_Surface * surface)
   1.282  {
   1.283      _kernel_swi_regs regs;
   1.284      regs.r[0] = 19;
   1.285  
   1.286 -    FULLSCREEN_SetDisplayBank (this->hidden->current_bank);
   1.287 +    FULLSCREEN_SetDisplayBank(this->hidden->current_bank);
   1.288      this->hidden->current_bank ^= 1;
   1.289 -    FULLSCREEN_SetWriteBank (this->hidden->current_bank);
   1.290 +    FULLSCREEN_SetWriteBank(this->hidden->current_bank);
   1.291      surface->pixels = this->hidden->bank[this->hidden->current_bank];
   1.292  
   1.293      /* Wait for Vsync */
   1.294 -    _kernel_swi (OS_Byte, &regs, &regs);
   1.295 +    _kernel_swi(OS_Byte, &regs, &regs);
   1.296  
   1.297      return (0);
   1.298  }
   1.299  
   1.300  /* Nothing to do if we are writing direct to hardware */
   1.301  static void
   1.302 -FULLSCREEN_UpdateRects (_THIS, int numrects, SDL_Rect * rects)
   1.303 +FULLSCREEN_UpdateRects(_THIS, int numrects, SDL_Rect * rects)
   1.304  {
   1.305  }
   1.306  
   1.307  /* Safe but slower Memory copy from our allocated back buffer */
   1.308  static void
   1.309 -FULLSCREEN_UpdateRectsMemCpy (_THIS, int numrects, SDL_Rect * rects)
   1.310 +FULLSCREEN_UpdateRectsMemCpy(_THIS, int numrects, SDL_Rect * rects)
   1.311  {
   1.312      int j;
   1.313      char *to, *from;
   1.314 @@ -390,7 +388,7 @@
   1.315          from = this->hidden->bank[0] + rects->x * xmult + rects->y * pitch;
   1.316          to = this->hidden->bank[1] + rects->x * xmult + rects->y * pitch;
   1.317          for (row = 0; row < rects->h; row++) {
   1.318 -            SDL_memcpy (to, from, rects->w * xmult);
   1.319 +            SDL_memcpy(to, from, rects->w * xmult);
   1.320              from += pitch;
   1.321              to += pitch;
   1.322          }
   1.323 @@ -401,7 +399,7 @@
   1.324  /* Use optimized assembler memory copy. Deliberately copies extra columns if
   1.325     necessary to ensure the rectangle is word aligned. */
   1.326  static void
   1.327 -FULLSCREEN_UpdateRects8bpp (_THIS, int numrects, SDL_Rect * rects)
   1.328 +FULLSCREEN_UpdateRects8bpp(_THIS, int numrects, SDL_Rect * rects)
   1.329  {
   1.330      int j;
   1.331      char *to, *from;
   1.332 @@ -423,8 +421,8 @@
   1.333              width_bytes += 4 - (width_bytes & 3);
   1.334          src_skip_bytes = pitch - width_bytes;
   1.335  
   1.336 -        RISCOS_Put32 (to, (width_bytes >> 2), pitch, (int) rects->h, from,
   1.337 -                      src_skip_bytes);
   1.338 +        RISCOS_Put32(to, (width_bytes >> 2), pitch, (int) rects->h, from,
   1.339 +                     src_skip_bytes);
   1.340          rects++;
   1.341      }
   1.342  }
   1.343 @@ -432,7 +430,7 @@
   1.344  /* Use optimized assembler memory copy. Deliberately copies extra columns if
   1.345     necessary to ensure the rectangle is word aligned. */
   1.346  static void
   1.347 -FULLSCREEN_UpdateRects16bpp (_THIS, int numrects, SDL_Rect * rects)
   1.348 +FULLSCREEN_UpdateRects16bpp(_THIS, int numrects, SDL_Rect * rects)
   1.349  {
   1.350      int j;
   1.351      char *to, *from;
   1.352 @@ -453,15 +451,15 @@
   1.353              width_bytes += 2;
   1.354          src_skip_bytes = pitch - width_bytes;
   1.355  
   1.356 -        RISCOS_Put32 (to, (width_bytes >> 2), pitch, (int) rects->h, from,
   1.357 -                      src_skip_bytes);
   1.358 +        RISCOS_Put32(to, (width_bytes >> 2), pitch, (int) rects->h, from,
   1.359 +                     src_skip_bytes);
   1.360          rects++;
   1.361      }
   1.362  }
   1.363  
   1.364  /* Use optimized assembler memory copy. 32 bpp modes are always word aligned */
   1.365  static void
   1.366 -FULLSCREEN_UpdateRects32bpp (_THIS, int numrects, SDL_Rect * rects)
   1.367 +FULLSCREEN_UpdateRects32bpp(_THIS, int numrects, SDL_Rect * rects)
   1.368  {
   1.369      int j;
   1.370      char *to, *from;
   1.371 @@ -473,8 +471,8 @@
   1.372          to = this->hidden->bank[1] + (rects->x << 2) + rects->y * pitch;
   1.373          width = (int) rects->w;
   1.374  
   1.375 -        RISCOS_Put32 (to, width, pitch, (int) rects->h, from,
   1.376 -                      pitch - (width << 2));
   1.377 +        RISCOS_Put32(to, width, pitch, (int) rects->h, from,
   1.378 +                     pitch - (width << 2));
   1.379          rects++;
   1.380      }
   1.381  }
   1.382 @@ -483,7 +481,7 @@
   1.383     other variants however accelerated sprite plotting can be seen on the horizon
   1.384     so this prepares for it. */
   1.385  static void
   1.386 -FULLSCREEN_UpdateRectsOS (_THIS, int numrects, SDL_Rect * rects)
   1.387 +FULLSCREEN_UpdateRectsOS(_THIS, int numrects, SDL_Rect * rects)
   1.388  {
   1.389      _kernel_swi_regs regs;
   1.390      _kernel_oserror *err;
   1.391 @@ -497,44 +495,44 @@
   1.392  
   1.393      for (j = 0; j < numrects; j++) {
   1.394          y = this->screen->h - rects->y; /* top of clipping region */
   1.395 -        _kernel_oswrch (24);    /* Set graphics clip region */
   1.396 -        _kernel_oswrch ((rects->x << this->hidden->xeig) & 0xFF);       /* left */
   1.397 -        _kernel_oswrch (((rects->x << this->hidden->xeig) >> 8) & 0xFF);
   1.398 -        _kernel_oswrch (((y - rects->h) << this->hidden->yeig) & 0xFF); /* bottom */
   1.399 -        _kernel_oswrch ((((y - rects->h) << this->hidden->yeig) >> 8) & 0xFF);
   1.400 -        _kernel_oswrch (((rects->x + rects->w - 1) << this->hidden->xeig) & 0xFF);      /* right */
   1.401 -        _kernel_oswrch ((((rects->x + rects->w -
   1.402 -                           1) << this->hidden->xeig) >> 8) & 0xFF);
   1.403 -        _kernel_oswrch (((y - 1) << this->hidden->yeig) & 0xFF);        /* top */
   1.404 -        _kernel_oswrch ((((y - 1) << this->hidden->yeig) >> 8) & 0xFF);
   1.405 +        _kernel_oswrch(24);     /* Set graphics clip region */
   1.406 +        _kernel_oswrch((rects->x << this->hidden->xeig) & 0xFF);        /* left */
   1.407 +        _kernel_oswrch(((rects->x << this->hidden->xeig) >> 8) & 0xFF);
   1.408 +        _kernel_oswrch(((y - rects->h) << this->hidden->yeig) & 0xFF);  /* bottom */
   1.409 +        _kernel_oswrch((((y - rects->h) << this->hidden->yeig) >> 8) & 0xFF);
   1.410 +        _kernel_oswrch(((rects->x + rects->w - 1) << this->hidden->xeig) & 0xFF);       /* right */
   1.411 +        _kernel_oswrch((((rects->x + rects->w -
   1.412 +                          1) << this->hidden->xeig) >> 8) & 0xFF);
   1.413 +        _kernel_oswrch(((y - 1) << this->hidden->yeig) & 0xFF); /* top */
   1.414 +        _kernel_oswrch((((y - 1) << this->hidden->yeig) >> 8) & 0xFF);
   1.415  
   1.416          regs.r[3] = 0;
   1.417          regs.r[4] = 0;
   1.418  
   1.419 -        if ((err = _kernel_swi (OS_SpriteOp, &regs, &regs)) != 0) {
   1.420 -            printf ("OS_SpriteOp failed \n%s\n", err->errmess);
   1.421 +        if ((err = _kernel_swi(OS_SpriteOp, &regs, &regs)) != 0) {
   1.422 +            printf("OS_SpriteOp failed \n%s\n", err->errmess);
   1.423          }
   1.424  
   1.425          rects++;
   1.426  
   1.427          /* Reset to full screen clipping */
   1.428 -        _kernel_oswrch (24);    /* Set graphics clip region */
   1.429 -        _kernel_oswrch (0);     /* left */
   1.430 -        _kernel_oswrch (0);
   1.431 -        _kernel_oswrch (0);     /* bottom */
   1.432 -        _kernel_oswrch (0);
   1.433 -        _kernel_oswrch (((this->screen->w - 1) << this->hidden->xeig) & 0xFF);  /* right */
   1.434 -        _kernel_oswrch ((((this->screen->w -
   1.435 -                           1) << this->hidden->xeig) >> 8) & 0xFF);
   1.436 -        _kernel_oswrch (((this->screen->h - 1) << this->hidden->yeig) & 0xFF);  /* top */
   1.437 -        _kernel_oswrch ((((this->screen->h -
   1.438 -                           1) << this->hidden->yeig) >> 8) & 0xFF);
   1.439 +        _kernel_oswrch(24);     /* Set graphics clip region */
   1.440 +        _kernel_oswrch(0);      /* left */
   1.441 +        _kernel_oswrch(0);
   1.442 +        _kernel_oswrch(0);      /* bottom */
   1.443 +        _kernel_oswrch(0);
   1.444 +        _kernel_oswrch(((this->screen->w - 1) << this->hidden->xeig) & 0xFF);   /* right */
   1.445 +        _kernel_oswrch((((this->screen->w -
   1.446 +                          1) << this->hidden->xeig) >> 8) & 0xFF);
   1.447 +        _kernel_oswrch(((this->screen->h - 1) << this->hidden->yeig) & 0xFF);   /* top */
   1.448 +        _kernel_oswrch((((this->screen->h -
   1.449 +                          1) << this->hidden->yeig) >> 8) & 0xFF);
   1.450      }
   1.451  }
   1.452  
   1.453  
   1.454  int
   1.455 -FULLSCREEN_SetColors (_THIS, int firstcolor, int ncolors, SDL_Color * colors)
   1.456 +FULLSCREEN_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color * colors)
   1.457  {
   1.458      _kernel_swi_regs regs;
   1.459      int palette[256];
   1.460 @@ -544,7 +542,7 @@
   1.461      regs.r[2] = (int) palette;
   1.462      regs.r[3] = 1024;
   1.463      regs.r[4] = 0;
   1.464 -    _kernel_swi (ColourTrans_ReadPalette, &regs, &regs);
   1.465 +    _kernel_swi(ColourTrans_ReadPalette, &regs, &regs);
   1.466  
   1.467      while (ncolors--) {
   1.468          palette[firstcolor] =
   1.469 @@ -558,14 +556,14 @@
   1.470      regs.r[2] = (int) palette;
   1.471      regs.r[3] = 0;
   1.472      regs.r[4] = 0;
   1.473 -    _kernel_swi (ColourTrans_WritePalette, &regs, &regs);
   1.474 +    _kernel_swi(ColourTrans_WritePalette, &regs, &regs);
   1.475  
   1.476      return (1);
   1.477  }
   1.478  
   1.479  
   1.480  static int
   1.481 -cmpmodes (const void *va, const void *vb)
   1.482 +cmpmodes(const void *va, const void *vb)
   1.483  {
   1.484      SDL_Rect *a = *(SDL_Rect **) va;
   1.485      SDL_Rect *b = *(SDL_Rect **) vb;
   1.486 @@ -576,7 +574,7 @@
   1.487  }
   1.488  
   1.489  static int
   1.490 -FULLSCREEN_AddMode (_THIS, int bpp, int w, int h)
   1.491 +FULLSCREEN_AddMode(_THIS, int bpp, int w, int h)
   1.492  {
   1.493      SDL_Rect *mode;
   1.494      int i, index;
   1.495 @@ -595,9 +593,9 @@
   1.496      }
   1.497  
   1.498      /* Set up the new video mode rectangle */
   1.499 -    mode = (SDL_Rect *) SDL_malloc (sizeof *mode);
   1.500 +    mode = (SDL_Rect *) SDL_malloc(sizeof *mode);
   1.501      if (mode == NULL) {
   1.502 -        SDL_OutOfMemory ();
   1.503 +        SDL_OutOfMemory();
   1.504          return (-1);
   1.505      }
   1.506      mode->x = 0;
   1.507 @@ -608,12 +606,12 @@
   1.508      /* Allocate the new list of modes, and fill in the new mode */
   1.509      next_mode = SDL_nummodes[index];
   1.510      SDL_modelist[index] = (SDL_Rect **)
   1.511 -        SDL_realloc (SDL_modelist[index],
   1.512 -                     (1 + next_mode + 1) * sizeof (SDL_Rect *));
   1.513 +        SDL_realloc(SDL_modelist[index],
   1.514 +                    (1 + next_mode + 1) * sizeof(SDL_Rect *));
   1.515      if (SDL_modelist[index] == NULL) {
   1.516 -        SDL_OutOfMemory ();
   1.517 +        SDL_OutOfMemory();
   1.518          SDL_nummodes[index] = 0;
   1.519 -        SDL_free (mode);
   1.520 +        SDL_free(mode);
   1.521          return (-1);
   1.522      }
   1.523      SDL_modelist[index][next_mode] = mode;
   1.524 @@ -624,54 +622,54 @@
   1.525  }
   1.526  
   1.527  void
   1.528 -FULLSCREEN_SetWriteBank (int bank)
   1.529 +FULLSCREEN_SetWriteBank(int bank)
   1.530  {
   1.531      _kernel_swi_regs regs;
   1.532      regs.r[0] = 112;
   1.533      regs.r[1] = bank + 1;
   1.534 -    _kernel_swi (OS_Byte, &regs, &regs);
   1.535 +    _kernel_swi(OS_Byte, &regs, &regs);
   1.536  }
   1.537  
   1.538  void
   1.539 -FULLSCREEN_SetDisplayBank (int bank)
   1.540 +FULLSCREEN_SetDisplayBank(int bank)
   1.541  {
   1.542      _kernel_swi_regs regs;
   1.543      regs.r[0] = 113;
   1.544      regs.r[1] = bank + 1;
   1.545 -    _kernel_swi (OS_Byte, &regs, &regs);
   1.546 +    _kernel_swi(OS_Byte, &regs, &regs);
   1.547  }
   1.548  
   1.549  
   1.550  /** Disable special escape key processing */
   1.551  static void
   1.552 -FULLSCREEN_DisableEscape ()
   1.553 +FULLSCREEN_DisableEscape()
   1.554  {
   1.555      _kernel_swi_regs regs;
   1.556      regs.r[0] = 229;
   1.557      regs.r[1] = 1;
   1.558      regs.r[2] = 0;
   1.559 -    _kernel_swi (OS_Byte, &regs, &regs);
   1.560 +    _kernel_swi(OS_Byte, &regs, &regs);
   1.561  
   1.562  }
   1.563  
   1.564  /** Enable special escape key processing */
   1.565  static void
   1.566 -FULLSCREEN_EnableEscape ()
   1.567 +FULLSCREEN_EnableEscape()
   1.568  {
   1.569      _kernel_swi_regs regs;
   1.570      regs.r[0] = 229;
   1.571      regs.r[1] = 0;
   1.572      regs.r[2] = 0;
   1.573 -    _kernel_swi (OS_Byte, &regs, &regs);
   1.574 +    _kernel_swi(OS_Byte, &regs, &regs);
   1.575  
   1.576  }
   1.577  
   1.578  /** Store caption in case this is called before we create a window */
   1.579  void
   1.580 -FULLSCREEN_SetWMCaption (_THIS, const char *title, const char *icon)
   1.581 +FULLSCREEN_SetWMCaption(_THIS, const char *title, const char *icon)
   1.582  {
   1.583 -    SDL_strlcpy (this->hidden->title, title,
   1.584 -                 SDL_arraysize (this->hidden->title));
   1.585 +    SDL_strlcpy(this->hidden->title, title,
   1.586 +                SDL_arraysize(this->hidden->title));
   1.587  }
   1.588  
   1.589  /* Set screen mode
   1.590 @@ -680,7 +678,7 @@
   1.591  */
   1.592  
   1.593  int
   1.594 -FULLSCREEN_SetMode (int width, int height, int bpp)
   1.595 +FULLSCREEN_SetMode(int width, int height, int bpp)
   1.596  {
   1.597      SCREENMODEBLOCK smb;
   1.598      _kernel_swi_regs regs;
   1.599 @@ -711,7 +709,7 @@
   1.600          break;
   1.601  
   1.602      default:
   1.603 -        SDL_SetError ("Pixel depth not supported");
   1.604 +        SDL_SetError("Pixel depth not supported");
   1.605          return 0;
   1.606          break;
   1.607      }
   1.608 @@ -721,30 +719,30 @@
   1.609      regs.r[0] = 0;
   1.610      regs.r[1] = (int) &smb;
   1.611  
   1.612 -    if (_kernel_swi (OS_ScreenMode, &regs, &regs) != 0) {
   1.613 -        SDL_SetError ("Couldn't set requested mode");
   1.614 +    if (_kernel_swi(OS_ScreenMode, &regs, &regs) != 0) {
   1.615 +        SDL_SetError("Couldn't set requested mode");
   1.616          return 0;
   1.617      }
   1.618  
   1.619      /* Turn cursor off */
   1.620 -    _kernel_oswrch (23);
   1.621 -    _kernel_oswrch (1);
   1.622 -    _kernel_oswrch (0);
   1.623 -    _kernel_oswrch (0);
   1.624 -    _kernel_oswrch (0);
   1.625 -    _kernel_oswrch (0);
   1.626 -    _kernel_oswrch (0);
   1.627 -    _kernel_oswrch (0);
   1.628 -    _kernel_oswrch (0);
   1.629 -    _kernel_oswrch (0);
   1.630 -    _kernel_oswrch (0);
   1.631 +    _kernel_oswrch(23);
   1.632 +    _kernel_oswrch(1);
   1.633 +    _kernel_oswrch(0);
   1.634 +    _kernel_oswrch(0);
   1.635 +    _kernel_oswrch(0);
   1.636 +    _kernel_oswrch(0);
   1.637 +    _kernel_oswrch(0);
   1.638 +    _kernel_oswrch(0);
   1.639 +    _kernel_oswrch(0);
   1.640 +    _kernel_oswrch(0);
   1.641 +    _kernel_oswrch(0);
   1.642  
   1.643      return 1;
   1.644  }
   1.645  
   1.646  /* Get Start addresses for the screen banks */
   1.647  void
   1.648 -FULLSCREEN_SetupBanks (_THIS)
   1.649 +FULLSCREEN_SetupBanks(_THIS)
   1.650  {
   1.651      _kernel_swi_regs regs;
   1.652      int block[5];
   1.653 @@ -756,7 +754,7 @@
   1.654  
   1.655      regs.r[0] = (int) block;
   1.656      regs.r[1] = (int) block;
   1.657 -    _kernel_swi (OS_ReadVduVariables, &regs, &regs);
   1.658 +    _kernel_swi(OS_ReadVduVariables, &regs, &regs);
   1.659  
   1.660      this->hidden->bank[0] = (void *) block[0];
   1.661      this->hidden->bank[1] = (void *) block[1];
   1.662 @@ -767,20 +765,20 @@
   1.663  /* Toggle to full screen mode from the WIMP */
   1.664  
   1.665  int
   1.666 -FULLSCREEN_ToggleFromWimp (_THIS)
   1.667 +FULLSCREEN_ToggleFromWimp(_THIS)
   1.668  {
   1.669      int width = this->screen->w;
   1.670      int height = this->screen->h;
   1.671      int bpp = this->screen->format->BitsPerPixel;
   1.672  
   1.673 -    RISCOS_StoreWimpMode ();
   1.674 -    if (FULLSCREEN_SetMode (width, height, bpp)) {
   1.675 +    RISCOS_StoreWimpMode();
   1.676 +    if (FULLSCREEN_SetMode(width, height, bpp)) {
   1.677          char *buffer = this->hidden->alloc_bank;        /* This is start of sprite data */
   1.678          /* Support back buffer mode only */
   1.679          if (riscos_backbuffer == 0)
   1.680              riscos_backbuffer = 1;
   1.681  
   1.682 -        FULLSCREEN_SetupBanks (this);
   1.683 +        FULLSCREEN_SetupBanks(this);
   1.684  
   1.685          this->hidden->bank[0] = buffer + 60;    /* Start of sprite data */
   1.686          if (bpp == 8)
   1.687 @@ -790,13 +788,13 @@
   1.688          this->screen->pixels = this->hidden->bank[0];
   1.689  
   1.690          /* Copy back buffer to screen memory */
   1.691 -        SDL_memcpy (this->hidden->bank[1], this->hidden->bank[0],
   1.692 -                    width * height * this->screen->format->BytesPerPixel);
   1.693 +        SDL_memcpy(this->hidden->bank[1], this->hidden->bank[0],
   1.694 +                   width * height * this->screen->format->BytesPerPixel);
   1.695  
   1.696 -        FULLSCREEN_SetDeviceMode (this);
   1.697 +        FULLSCREEN_SetDeviceMode(this);
   1.698          return 1;
   1.699      } else
   1.700 -        RISCOS_RestoreWimpMode ();
   1.701 +        RISCOS_RestoreWimpMode();
   1.702  
   1.703      return 0;
   1.704  }