src/video/directfb/SDL_DirectFB_video.c
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
     1.1 --- a/src/video/directfb/SDL_DirectFB_video.c	Mon May 29 03:53:21 2006 +0000
     1.2 +++ b/src/video/directfb/SDL_DirectFB_video.c	Mon May 29 04:04:35 2006 +0000
     1.3 @@ -52,34 +52,34 @@
     1.4  
     1.5  
     1.6  /* Initialization/Query functions */
     1.7 -static int DirectFB_VideoInit (_THIS, SDL_PixelFormat * vformat);
     1.8 -static SDL_Rect **DirectFB_ListModes (_THIS, SDL_PixelFormat * format,
     1.9 -                                      Uint32 flags);
    1.10 -static SDL_Surface *DirectFB_SetVideoMode (_THIS, SDL_Surface * current,
    1.11 -                                           int width, int height, int bpp,
    1.12 -                                           Uint32 flags);
    1.13 -static int DirectFB_SetColors (_THIS, int firstcolor, int ncolors,
    1.14 -                               SDL_Color * colors);
    1.15 -static void DirectFB_VideoQuit (_THIS);
    1.16 +static int DirectFB_VideoInit(_THIS, SDL_PixelFormat * vformat);
    1.17 +static SDL_Rect **DirectFB_ListModes(_THIS, SDL_PixelFormat * format,
    1.18 +                                     Uint32 flags);
    1.19 +static SDL_Surface *DirectFB_SetVideoMode(_THIS, SDL_Surface * current,
    1.20 +                                          int width, int height, int bpp,
    1.21 +                                          Uint32 flags);
    1.22 +static int DirectFB_SetColors(_THIS, int firstcolor, int ncolors,
    1.23 +                              SDL_Color * colors);
    1.24 +static void DirectFB_VideoQuit(_THIS);
    1.25  
    1.26  /* Hardware surface functions */
    1.27 -static int DirectFB_AllocHWSurface (_THIS, SDL_Surface * surface);
    1.28 -static int DirectFB_FillHWRect (_THIS, SDL_Surface * dst, SDL_Rect * dstrect,
    1.29 -                                Uint32 color);
    1.30 -static int DirectFB_LockHWSurface (_THIS, SDL_Surface * surface);
    1.31 -static void DirectFB_UnlockHWSurface (_THIS, SDL_Surface * surface);
    1.32 -static void DirectFB_FreeHWSurface (_THIS, SDL_Surface * surface);
    1.33 -static int DirectFB_CheckHWBlit (_THIS, SDL_Surface * src, SDL_Surface * dst);
    1.34 -static int DirectFB_HWAccelBlit (SDL_Surface * src, SDL_Rect * srcrect,
    1.35 -                                 SDL_Surface * dst, SDL_Rect * dstrect);
    1.36 -static int DirectFB_SetHWColorKey (_THIS, SDL_Surface * surface, Uint32 key);
    1.37 -static int DirectFB_SetHWAlpha (_THIS, SDL_Surface * surface, Uint8 alpha);
    1.38 -static int DirectFB_FlipHWSurface (_THIS, SDL_Surface * surface);
    1.39 -static int DirectFB_ShowWMCursor (_THIS, WMcursor * cursor);
    1.40 +static int DirectFB_AllocHWSurface(_THIS, SDL_Surface * surface);
    1.41 +static int DirectFB_FillHWRect(_THIS, SDL_Surface * dst, SDL_Rect * dstrect,
    1.42 +                               Uint32 color);
    1.43 +static int DirectFB_LockHWSurface(_THIS, SDL_Surface * surface);
    1.44 +static void DirectFB_UnlockHWSurface(_THIS, SDL_Surface * surface);
    1.45 +static void DirectFB_FreeHWSurface(_THIS, SDL_Surface * surface);
    1.46 +static int DirectFB_CheckHWBlit(_THIS, SDL_Surface * src, SDL_Surface * dst);
    1.47 +static int DirectFB_HWAccelBlit(SDL_Surface * src, SDL_Rect * srcrect,
    1.48 +                                SDL_Surface * dst, SDL_Rect * dstrect);
    1.49 +static int DirectFB_SetHWColorKey(_THIS, SDL_Surface * surface, Uint32 key);
    1.50 +static int DirectFB_SetHWAlpha(_THIS, SDL_Surface * surface, Uint8 alpha);
    1.51 +static int DirectFB_FlipHWSurface(_THIS, SDL_Surface * surface);
    1.52 +static int DirectFB_ShowWMCursor(_THIS, WMcursor * cursor);
    1.53  
    1.54  /* Various screen update functions available */
    1.55 -static void DirectFB_DirectUpdate (_THIS, int numrects, SDL_Rect * rects);
    1.56 -static void DirectFB_WindowedUpdate (_THIS, int numrects, SDL_Rect * rects);
    1.57 +static void DirectFB_DirectUpdate(_THIS, int numrects, SDL_Rect * rects);
    1.58 +static void DirectFB_WindowedUpdate(_THIS, int numrects, SDL_Rect * rects);
    1.59  
    1.60  /* This is the rect EnumModes2 uses */
    1.61  struct DirectFBEnumRect
    1.62 @@ -94,38 +94,38 @@
    1.63  /* DirectFB driver bootstrap functions */
    1.64  
    1.65  static int
    1.66 -DirectFB_Available (void)
    1.67 +DirectFB_Available(void)
    1.68  {
    1.69      return 1;
    1.70  }
    1.71  
    1.72  static void
    1.73 -DirectFB_DeleteDevice (SDL_VideoDevice * device)
    1.74 +DirectFB_DeleteDevice(SDL_VideoDevice * device)
    1.75  {
    1.76 -    SDL_free (device->hidden);
    1.77 -    SDL_free (device);
    1.78 +    SDL_free(device->hidden);
    1.79 +    SDL_free(device);
    1.80  }
    1.81  
    1.82  static SDL_VideoDevice *
    1.83 -DirectFB_CreateDevice (int devindex)
    1.84 +DirectFB_CreateDevice(int devindex)
    1.85  {
    1.86      SDL_VideoDevice *device;
    1.87  
    1.88      /* Initialize all variables that we clean on shutdown */
    1.89 -    device = (SDL_VideoDevice *) SDL_malloc (sizeof (SDL_VideoDevice));
    1.90 +    device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice));
    1.91      if (device) {
    1.92 -        SDL_memset (device, 0, (sizeof *device));
    1.93 +        SDL_memset(device, 0, (sizeof *device));
    1.94          device->hidden = (struct SDL_PrivateVideoData *)
    1.95 -            malloc (sizeof (*device->hidden));
    1.96 +            malloc(sizeof(*device->hidden));
    1.97      }
    1.98      if (device == NULL || device->hidden == NULL) {
    1.99 -        SDL_OutOfMemory ();
   1.100 +        SDL_OutOfMemory();
   1.101          if (device) {
   1.102 -            free (device);
   1.103 +            free(device);
   1.104          }
   1.105          return (0);
   1.106      }
   1.107 -    SDL_memset (device->hidden, 0, sizeof (*device->hidden));
   1.108 +    SDL_memset(device->hidden, 0, sizeof(*device->hidden));
   1.109  
   1.110      /* Set the function pointers */
   1.111      device->VideoInit = DirectFB_VideoInit;
   1.112 @@ -164,14 +164,14 @@
   1.113  };
   1.114  
   1.115  static DFBSurfacePixelFormat
   1.116 -GetFormatForBpp (int bpp, IDirectFBDisplayLayer * layer)
   1.117 +GetFormatForBpp(int bpp, IDirectFBDisplayLayer * layer)
   1.118  {
   1.119      DFBDisplayLayerConfig dlc;
   1.120      int bytes = (bpp + 7) / 8;
   1.121  
   1.122 -    layer->GetConfiguration (layer, &dlc);
   1.123 +    layer->GetConfiguration(layer, &dlc);
   1.124  
   1.125 -    if (bytes == DFB_BYTES_PER_PIXEL (dlc.pixelformat) && bytes > 1)
   1.126 +    if (bytes == DFB_BYTES_PER_PIXEL(dlc.pixelformat) && bytes > 1)
   1.127          return dlc.pixelformat;
   1.128  
   1.129      switch (bytes) {
   1.130 @@ -189,7 +189,7 @@
   1.131  }
   1.132  
   1.133  static DFBEnumerationResult
   1.134 -EnumModesCallback (int width, int height, int bpp, void *data)
   1.135 +EnumModesCallback(int width, int height, int bpp, void *data)
   1.136  {
   1.137      SDL_VideoDevice *this = (SDL_VideoDevice *) data;
   1.138      struct DirectFBEnumRect *enumrect;
   1.139 @@ -199,9 +199,9 @@
   1.140      if (enumlist && enumlist->r.w == width && enumlist->r.h == height)
   1.141          return DFENUM_OK;
   1.142  
   1.143 -    enumrect = SDL_calloc (1, sizeof (struct DirectFBEnumRect));
   1.144 +    enumrect = SDL_calloc(1, sizeof(struct DirectFBEnumRect));
   1.145      if (!enumrect) {
   1.146 -        SDL_OutOfMemory ();
   1.147 +        SDL_OutOfMemory();
   1.148          return DFENUM_CANCEL;
   1.149      }
   1.150  
   1.151 @@ -221,18 +221,18 @@
   1.152  };
   1.153  
   1.154  void
   1.155 -SetDirectFBerror (const char *function, DFBResult code)
   1.156 +SetDirectFBerror(const char *function, DFBResult code)
   1.157  {
   1.158 -    const char *error = DirectFBErrorString (code);
   1.159 +    const char *error = DirectFBErrorString(code);
   1.160  
   1.161      if (error)
   1.162 -        SDL_SetError ("%s: %s", function, error);
   1.163 +        SDL_SetError("%s: %s", function, error);
   1.164      else
   1.165 -        SDL_SetError ("Unknown error code from %s", function);
   1.166 +        SDL_SetError("Unknown error code from %s", function);
   1.167  }
   1.168  
   1.169  static DFBSurfacePixelFormat
   1.170 -SDLToDFBPixelFormat (SDL_PixelFormat * format)
   1.171 +SDLToDFBPixelFormat(SDL_PixelFormat * format)
   1.172  {
   1.173      if (format->Rmask && format->Gmask && format->Bmask) {
   1.174          switch (format->BitsPerPixel) {
   1.175 @@ -286,20 +286,20 @@
   1.176  }
   1.177  
   1.178  static SDL_Palette *
   1.179 -AllocatePalette (int size)
   1.180 +AllocatePalette(int size)
   1.181  {
   1.182      SDL_Palette *palette;
   1.183      SDL_Color *colors;
   1.184  
   1.185 -    palette = SDL_calloc (1, sizeof (SDL_Palette));
   1.186 +    palette = SDL_calloc(1, sizeof(SDL_Palette));
   1.187      if (!palette) {
   1.188 -        SDL_OutOfMemory ();
   1.189 +        SDL_OutOfMemory();
   1.190          return NULL;
   1.191      }
   1.192  
   1.193 -    colors = SDL_calloc (size, sizeof (SDL_Color));
   1.194 +    colors = SDL_calloc(size, sizeof(SDL_Color));
   1.195      if (!colors) {
   1.196 -        SDL_OutOfMemory ();
   1.197 +        SDL_OutOfMemory();
   1.198          return NULL;
   1.199      }
   1.200  
   1.201 @@ -310,8 +310,8 @@
   1.202  }
   1.203  
   1.204  static int
   1.205 -DFBToSDLPixelFormat (DFBSurfacePixelFormat pixelformat,
   1.206 -                     SDL_PixelFormat * format)
   1.207 +DFBToSDLPixelFormat(DFBSurfacePixelFormat pixelformat,
   1.208 +                    SDL_PixelFormat * format)
   1.209  {
   1.210      format->Amask = format->Rmask = format->Gmask = format->Bmask = 0;
   1.211      format->BitsPerPixel = format->BytesPerPixel = 0;
   1.212 @@ -349,25 +349,25 @@
   1.213          format->Bmask = 0x000000FF;
   1.214  
   1.215          if (!format->palette)
   1.216 -            format->palette = AllocatePalette (256);
   1.217 +            format->palette = AllocatePalette(256);
   1.218          break;
   1.219  
   1.220      default:
   1.221 -        fprintf (stderr,
   1.222 -                 "SDL_DirectFB: Unsupported pixelformat (0x%08x)!\n",
   1.223 -                 pixelformat);
   1.224 +        fprintf(stderr,
   1.225 +                "SDL_DirectFB: Unsupported pixelformat (0x%08x)!\n",
   1.226 +                pixelformat);
   1.227          return -1;
   1.228      }
   1.229  
   1.230 -    format->BitsPerPixel = DFB_BYTES_PER_PIXEL (pixelformat) * 8;
   1.231 -    format->BytesPerPixel = DFB_BYTES_PER_PIXEL (pixelformat);
   1.232 +    format->BitsPerPixel = DFB_BYTES_PER_PIXEL(pixelformat) * 8;
   1.233 +    format->BytesPerPixel = DFB_BYTES_PER_PIXEL(pixelformat);
   1.234  
   1.235      return 0;
   1.236  }
   1.237  
   1.238  
   1.239  int
   1.240 -DirectFB_VideoInit (_THIS, SDL_PixelFormat * vformat)
   1.241 +DirectFB_VideoInit(_THIS, SDL_PixelFormat * vformat)
   1.242  {
   1.243      int i;
   1.244      DFBResult ret;
   1.245 @@ -386,49 +386,49 @@
   1.246      HIDDEN->enable_mga_crtc2 = 0;
   1.247      HIDDEN->mga_crtc2_stretch_overscan = 1;
   1.248  
   1.249 -    ret = DirectFBInit (NULL, NULL);
   1.250 +    ret = DirectFBInit(NULL, NULL);
   1.251      if (ret) {
   1.252 -        SetDirectFBerror ("DirectFBInit", ret);
   1.253 +        SetDirectFBerror("DirectFBInit", ret);
   1.254          goto error;
   1.255      }
   1.256  
   1.257 -    ret = DirectFBCreate (&dfb);
   1.258 +    ret = DirectFBCreate(&dfb);
   1.259      if (ret) {
   1.260 -        SetDirectFBerror ("DirectFBCreate", ret);
   1.261 +        SetDirectFBerror("DirectFBCreate", ret);
   1.262          goto error;
   1.263      }
   1.264  
   1.265 -    ret = dfb->GetDisplayLayer (dfb, DLID_PRIMARY, &layer);
   1.266 +    ret = dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &layer);
   1.267      if (ret) {
   1.268 -        SetDirectFBerror ("dfb->GetDisplayLayer", ret);
   1.269 +        SetDirectFBerror("dfb->GetDisplayLayer", ret);
   1.270          goto error;
   1.271      }
   1.272  
   1.273 -    ret = dfb->CreateInputEventBuffer (dfb, DICAPS_ALL, DFB_FALSE, &events);
   1.274 +    ret = dfb->CreateInputEventBuffer(dfb, DICAPS_ALL, DFB_FALSE, &events);
   1.275      if (ret) {
   1.276 -        SetDirectFBerror ("dfb->CreateEventBuffer", ret);
   1.277 +        SetDirectFBerror("dfb->CreateEventBuffer", ret);
   1.278          goto error;
   1.279      }
   1.280  
   1.281 -    layer->EnableCursor (layer, 1);
   1.282 +    layer->EnableCursor(layer, 1);
   1.283  
   1.284      /* Query layer configuration to determine the current mode and pixelformat */
   1.285 -    layer->GetConfiguration (layer, &dlc);
   1.286 +    layer->GetConfiguration(layer, &dlc);
   1.287  
   1.288      /* If current format is not supported use LUT8 as the default */
   1.289 -    if (DFBToSDLPixelFormat (dlc.pixelformat, vformat))
   1.290 -        DFBToSDLPixelFormat (DSPF_LUT8, vformat);
   1.291 +    if (DFBToSDLPixelFormat(dlc.pixelformat, vformat))
   1.292 +        DFBToSDLPixelFormat(DSPF_LUT8, vformat);
   1.293  
   1.294      /* Enumerate the available fullscreen modes */
   1.295 -    ret = dfb->EnumVideoModes (dfb, EnumModesCallback, this);
   1.296 +    ret = dfb->EnumVideoModes(dfb, EnumModesCallback, this);
   1.297      if (ret) {
   1.298 -        SetDirectFBerror ("dfb->EnumVideoModes", ret);
   1.299 +        SetDirectFBerror("dfb->EnumVideoModes", ret);
   1.300          goto error;
   1.301      }
   1.302  
   1.303 -    HIDDEN->modelist = SDL_calloc (HIDDEN->nummodes + 1, sizeof (SDL_Rect *));
   1.304 +    HIDDEN->modelist = SDL_calloc(HIDDEN->nummodes + 1, sizeof(SDL_Rect *));
   1.305      if (!HIDDEN->modelist) {
   1.306 -        SDL_OutOfMemory ();
   1.307 +        SDL_OutOfMemory();
   1.308          goto error;
   1.309      }
   1.310  
   1.311 @@ -441,9 +441,9 @@
   1.312  
   1.313      /* Query card capabilities to get the video memory size */
   1.314  #if (DIRECTFB_MAJOR_VERSION == 0) && (DIRECTFB_MINOR_VERSION == 9) && (DIRECTFB_MICRO_VERSION < 23)
   1.315 -    dfb->GetCardCapabilities (dfb, &caps);
   1.316 +    dfb->GetCardCapabilities(dfb, &caps);
   1.317  #else
   1.318 -    dfb->GetDeviceDescription (dfb, &caps);
   1.319 +    dfb->GetDeviceDescription(dfb, &caps);
   1.320  #endif
   1.321  
   1.322      this->info.wm_available = 1;
   1.323 @@ -459,22 +459,22 @@
   1.324      HIDDEN->layer = layer;
   1.325      HIDDEN->eventbuffer = events;
   1.326  
   1.327 -    if (SDL_getenv ("SDL_DIRECTFB_MGA_CRTC2") != NULL)
   1.328 +    if (SDL_getenv("SDL_DIRECTFB_MGA_CRTC2") != NULL)
   1.329          HIDDEN->enable_mga_crtc2 = 1;
   1.330  
   1.331      if (HIDDEN->enable_mga_crtc2) {
   1.332          DFBDisplayLayerConfig dlc;
   1.333          DFBDisplayLayerConfigFlags failed;
   1.334  
   1.335 -        ret = dfb->GetDisplayLayer (dfb, 2, &HIDDEN->c2layer);
   1.336 +        ret = dfb->GetDisplayLayer(dfb, 2, &HIDDEN->c2layer);
   1.337          if (ret) {
   1.338 -            SetDirectFBerror ("dfb->GetDisplayLayer(CRTC2)", ret);
   1.339 +            SetDirectFBerror("dfb->GetDisplayLayer(CRTC2)", ret);
   1.340              goto error;
   1.341          }
   1.342  
   1.343          ret =
   1.344 -            HIDDEN->layer->SetCooperativeLevel (HIDDEN->layer,
   1.345 -                                                DLSCL_EXCLUSIVE);
   1.346 +            HIDDEN->layer->SetCooperativeLevel(HIDDEN->layer,
   1.347 +                                               DLSCL_EXCLUSIVE);
   1.348          if (ret) {
   1.349              SetDirectFBerror
   1.350                  ("layer->SetCooperativeLevel(CRTC2, EXCLUSIVE)", ret);
   1.351 @@ -482,15 +482,15 @@
   1.352          }
   1.353  
   1.354          ret =
   1.355 -            HIDDEN->c2layer->SetCooperativeLevel (HIDDEN->c2layer,
   1.356 -                                                  DLSCL_EXCLUSIVE);
   1.357 +            HIDDEN->c2layer->SetCooperativeLevel(HIDDEN->c2layer,
   1.358 +                                                 DLSCL_EXCLUSIVE);
   1.359          if (ret) {
   1.360              SetDirectFBerror
   1.361                  ("c2layer->SetCooperativeLevel(CRTC2, EXCLUSIVE)", ret);
   1.362              goto error;
   1.363          }
   1.364  
   1.365 -        HIDDEN->c2layer->SetOpacity (HIDDEN->c2layer, 0x0);
   1.366 +        HIDDEN->c2layer->SetOpacity(HIDDEN->c2layer, 0x0);
   1.367  
   1.368          /* Init the surface here as it got a fixed size */
   1.369          dlc.flags = DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE;
   1.370 @@ -498,53 +498,53 @@
   1.371          dlc.pixelformat = DSPF_RGB32;
   1.372  
   1.373          ret =
   1.374 -            HIDDEN->c2layer->TestConfiguration (HIDDEN->c2layer, &dlc,
   1.375 -                                                &failed);
   1.376 +            HIDDEN->c2layer->TestConfiguration(HIDDEN->c2layer, &dlc,
   1.377 +                                               &failed);
   1.378          if (ret) {
   1.379 -            SetDirectFBerror ("c2layer->TestConfiguration", ret);
   1.380 +            SetDirectFBerror("c2layer->TestConfiguration", ret);
   1.381              goto error;
   1.382          }
   1.383  
   1.384 -        ret = HIDDEN->c2layer->SetConfiguration (HIDDEN->c2layer, &dlc);
   1.385 +        ret = HIDDEN->c2layer->SetConfiguration(HIDDEN->c2layer, &dlc);
   1.386          if (ret) {
   1.387 -            SetDirectFBerror ("c2layer->SetConfiguration", ret);
   1.388 +            SetDirectFBerror("c2layer->SetConfiguration", ret);
   1.389              goto error;
   1.390          }
   1.391  
   1.392 -        ret = HIDDEN->c2layer->GetSurface (HIDDEN->c2layer, &HIDDEN->c2frame);
   1.393 +        ret = HIDDEN->c2layer->GetSurface(HIDDEN->c2layer, &HIDDEN->c2frame);
   1.394          if (ret) {
   1.395 -            SetDirectFBerror ("c2layer->GetSurface", ret);
   1.396 +            SetDirectFBerror("c2layer->GetSurface", ret);
   1.397              goto error;
   1.398          }
   1.399  
   1.400          HIDDEN->c2framesize.x = 0;
   1.401          HIDDEN->c2framesize.y = 0;
   1.402 -        HIDDEN->c2frame->GetSize (HIDDEN->c2frame, &HIDDEN->c2framesize.w,
   1.403 -                                  &HIDDEN->c2framesize.h);
   1.404 +        HIDDEN->c2frame->GetSize(HIDDEN->c2frame, &HIDDEN->c2framesize.w,
   1.405 +                                 &HIDDEN->c2framesize.h);
   1.406  
   1.407 -        HIDDEN->c2frame->SetBlittingFlags (HIDDEN->c2frame, DSBLIT_NOFX);
   1.408 -        HIDDEN->c2frame->SetColor (HIDDEN->c2frame, 0, 0, 0, 0xff);
   1.409 +        HIDDEN->c2frame->SetBlittingFlags(HIDDEN->c2frame, DSBLIT_NOFX);
   1.410 +        HIDDEN->c2frame->SetColor(HIDDEN->c2frame, 0, 0, 0, 0xff);
   1.411  
   1.412          /* Clear CRTC2 */
   1.413 -        HIDDEN->c2frame->Clear (HIDDEN->c2frame, 0, 0, 0, 0xff);
   1.414 -        HIDDEN->c2frame->Flip (HIDDEN->c2frame, NULL, 0);
   1.415 -        HIDDEN->c2frame->Clear (HIDDEN->c2frame, 0, 0, 0, 0xff);
   1.416 -        HIDDEN->c2frame->Flip (HIDDEN->c2frame, NULL, 0);
   1.417 -        HIDDEN->c2frame->Clear (HIDDEN->c2frame, 0, 0, 0, 0xff);
   1.418 +        HIDDEN->c2frame->Clear(HIDDEN->c2frame, 0, 0, 0, 0xff);
   1.419 +        HIDDEN->c2frame->Flip(HIDDEN->c2frame, NULL, 0);
   1.420 +        HIDDEN->c2frame->Clear(HIDDEN->c2frame, 0, 0, 0, 0xff);
   1.421 +        HIDDEN->c2frame->Flip(HIDDEN->c2frame, NULL, 0);
   1.422 +        HIDDEN->c2frame->Clear(HIDDEN->c2frame, 0, 0, 0, 0xff);
   1.423  
   1.424 -        HIDDEN->c2layer->SetOpacity (HIDDEN->c2layer, 0xFF);
   1.425 +        HIDDEN->c2layer->SetOpacity(HIDDEN->c2layer, 0xFF);
   1.426  
   1.427          /* Check if overscan is possibly set */
   1.428 -        if (SDL_getenv ("SDL_DIRECTFB_MGA_OVERSCAN") != NULL) {
   1.429 +        if (SDL_getenv("SDL_DIRECTFB_MGA_OVERSCAN") != NULL) {
   1.430              float overscan = 0;
   1.431              if (SDL_sscanf
   1.432 -                (SDL_getenv ("SDL_DIRECTFB_MGA_OVERSCAN"), "%f",
   1.433 +                (SDL_getenv("SDL_DIRECTFB_MGA_OVERSCAN"), "%f",
   1.434                   &overscan) == 1)
   1.435                  if (overscan > 0 && overscan < 2)
   1.436                      HIDDEN->mga_crtc2_stretch_overscan = overscan;
   1.437          }
   1.438  #ifdef DIRECTFB_CRTC2_DEBUG
   1.439 -        printf ("CRTC2 overscan: %f\n", HIDDEN->mga_crtc2_stretch_overscan);
   1.440 +        printf("CRTC2 overscan: %f\n", HIDDEN->mga_crtc2_stretch_overscan);
   1.441  #endif
   1.442      }
   1.443  
   1.444 @@ -552,91 +552,89 @@
   1.445  
   1.446    error:
   1.447      if (events)
   1.448 -        events->Release (events);
   1.449 +        events->Release(events);
   1.450  
   1.451      if (HIDDEN->c2frame)
   1.452 -        HIDDEN->c2frame->Release (HIDDEN->c2frame);
   1.453 +        HIDDEN->c2frame->Release(HIDDEN->c2frame);
   1.454  
   1.455      if (HIDDEN->c2layer)
   1.456 -        HIDDEN->c2layer->Release (HIDDEN->c2layer);
   1.457 +        HIDDEN->c2layer->Release(HIDDEN->c2layer);
   1.458  
   1.459      if (layer)
   1.460 -        layer->Release (layer);
   1.461 +        layer->Release(layer);
   1.462  
   1.463      if (dfb)
   1.464 -        dfb->Release (dfb);
   1.465 +        dfb->Release(dfb);
   1.466  
   1.467      return -1;
   1.468  }
   1.469  
   1.470  static SDL_Rect **
   1.471 -DirectFB_ListModes (_THIS, SDL_PixelFormat * format, Uint32 flags)
   1.472 +DirectFB_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags)
   1.473  {
   1.474      if (flags & SDL_FULLSCREEN)
   1.475          return HIDDEN->modelist;
   1.476 -    else if (SDLToDFBPixelFormat (format) != DSPF_UNKNOWN)
   1.477 +    else if (SDLToDFBPixelFormat(format) != DSPF_UNKNOWN)
   1.478          return (SDL_Rect **) - 1;
   1.479  
   1.480      return NULL;
   1.481  }
   1.482  
   1.483  static SDL_Surface *
   1.484 -DirectFB_SetVideoMode (_THIS, SDL_Surface * current, int width, int height,
   1.485 -                       int bpp, Uint32 flags)
   1.486 +DirectFB_SetVideoMode(_THIS, SDL_Surface * current, int width, int height,
   1.487 +                      int bpp, Uint32 flags)
   1.488  {
   1.489      DFBResult ret;
   1.490      DFBSurfaceDescription dsc;
   1.491      DFBSurfacePixelFormat pixelformat;
   1.492      IDirectFBSurface *surface;
   1.493  
   1.494 -    fprintf (stderr, "SDL DirectFB_SetVideoMode: %dx%d@%d, flags: 0x%08x\n",
   1.495 -             width, height, bpp, flags);
   1.496 +    fprintf(stderr, "SDL DirectFB_SetVideoMode: %dx%d@%d, flags: 0x%08x\n",
   1.497 +            width, height, bpp, flags);
   1.498  
   1.499      flags |= SDL_FULLSCREEN;
   1.500  
   1.501      /* Release previous primary surface */
   1.502      if (current->hwdata && current->hwdata->surface) {
   1.503 -        current->hwdata->surface->Release (current->hwdata->surface);
   1.504 +        current->hwdata->surface->Release(current->hwdata->surface);
   1.505          current->hwdata->surface = NULL;
   1.506  
   1.507          /* And its palette if present */
   1.508          if (current->hwdata->palette) {
   1.509 -            current->hwdata->palette->Release (current->hwdata->palette);
   1.510 +            current->hwdata->palette->Release(current->hwdata->palette);
   1.511              current->hwdata->palette = NULL;
   1.512          }
   1.513      } else if (!current->hwdata) {
   1.514          /* Allocate the hardware acceleration data */
   1.515          current->hwdata =
   1.516 -            (struct private_hwdata *) SDL_calloc (1,
   1.517 -                                                  sizeof (*current->hwdata));
   1.518 +            (struct private_hwdata *) SDL_calloc(1, sizeof(*current->hwdata));
   1.519          if (!current->hwdata) {
   1.520 -            SDL_OutOfMemory ();
   1.521 +            SDL_OutOfMemory();
   1.522              return NULL;
   1.523          }
   1.524      }
   1.525  
   1.526      /* Set cooperative level depending on flag SDL_FULLSCREEN */
   1.527      if (flags & SDL_FULLSCREEN) {
   1.528 -        ret =
   1.529 -            HIDDEN->dfb->SetCooperativeLevel (HIDDEN->dfb, DFSCL_FULLSCREEN);
   1.530 +        ret = HIDDEN->dfb->SetCooperativeLevel(HIDDEN->dfb, DFSCL_FULLSCREEN);
   1.531          if (ret && !HIDDEN->enable_mga_crtc2) {
   1.532 -            DirectFBError ("dfb->SetCooperativeLevel", ret);
   1.533 +            DirectFBError("dfb->SetCooperativeLevel", ret);
   1.534              flags &= ~SDL_FULLSCREEN;
   1.535          }
   1.536      } else
   1.537 -        HIDDEN->dfb->SetCooperativeLevel (HIDDEN->dfb, DFSCL_NORMAL);
   1.538 +        HIDDEN->dfb->SetCooperativeLevel(HIDDEN->dfb, DFSCL_NORMAL);
   1.539  
   1.540      /* Set video mode */
   1.541 -    ret = HIDDEN->dfb->SetVideoMode (HIDDEN->dfb, width, height, bpp);
   1.542 +    ret = HIDDEN->dfb->SetVideoMode(HIDDEN->dfb, width, height, bpp);
   1.543      if (ret) {
   1.544          if (flags & SDL_FULLSCREEN) {
   1.545              flags &= ~SDL_FULLSCREEN;
   1.546 -            HIDDEN->dfb->SetCooperativeLevel (HIDDEN->dfb, DFSCL_NORMAL);
   1.547 -            ret = HIDDEN->dfb->SetVideoMode (HIDDEN->dfb, width, height, bpp);
   1.548 +            HIDDEN->dfb->SetCooperativeLevel(HIDDEN->dfb, DFSCL_NORMAL);
   1.549 +            ret = HIDDEN->dfb->SetVideoMode(HIDDEN->dfb, width, height, bpp);
   1.550          }
   1.551  
   1.552          if (ret) {
   1.553 -            SetDirectFBerror ("dfb->SetVideoMode", ret);
   1.554 +            SetDirectFBerror("dfb->SetVideoMode", ret);
   1.555              return NULL;
   1.556          }
   1.557      }
   1.558 @@ -645,16 +643,16 @@
   1.559      dsc.flags = DSDESC_CAPS | DSDESC_PIXELFORMAT;
   1.560      dsc.caps =
   1.561          DSCAPS_PRIMARY | ((flags & SDL_DOUBLEBUF) ? DSCAPS_FLIPPING : 0);
   1.562 -    dsc.pixelformat = GetFormatForBpp (bpp, HIDDEN->layer);
   1.563 +    dsc.pixelformat = GetFormatForBpp(bpp, HIDDEN->layer);
   1.564  
   1.565 -    ret = HIDDEN->dfb->CreateSurface (HIDDEN->dfb, &dsc, &surface);
   1.566 +    ret = HIDDEN->dfb->CreateSurface(HIDDEN->dfb, &dsc, &surface);
   1.567      if (ret && (flags & SDL_DOUBLEBUF)) {
   1.568          /* Try without double buffering */
   1.569          dsc.caps &= ~DSCAPS_FLIPPING;
   1.570 -        ret = HIDDEN->dfb->CreateSurface (HIDDEN->dfb, &dsc, &surface);
   1.571 +        ret = HIDDEN->dfb->CreateSurface(HIDDEN->dfb, &dsc, &surface);
   1.572      }
   1.573      if (ret) {
   1.574 -        SetDirectFBerror ("dfb->CreateSurface", ret);
   1.575 +        SetDirectFBerror("dfb->CreateSurface", ret);
   1.576          return NULL;
   1.577      }
   1.578  
   1.579 @@ -671,13 +669,13 @@
   1.580      if (dsc.caps & DSCAPS_FLIPPING)
   1.581          current->flags |= SDL_DOUBLEBUF;
   1.582  
   1.583 -    surface->GetPixelFormat (surface, &pixelformat);
   1.584 +    surface->GetPixelFormat(surface, &pixelformat);
   1.585  
   1.586 -    DFBToSDLPixelFormat (pixelformat, current->format);
   1.587 +    DFBToSDLPixelFormat(pixelformat, current->format);
   1.588  
   1.589      /* Get the surface palette (if supported) */
   1.590 -    if (DFB_PIXELFORMAT_IS_INDEXED (pixelformat)) {
   1.591 -        surface->GetPalette (surface, &current->hwdata->palette);
   1.592 +    if (DFB_PIXELFORMAT_IS_INDEXED(pixelformat)) {
   1.593 +        surface->GetPalette(surface, &current->hwdata->palette);
   1.594  
   1.595          current->flags |= SDL_HWPALETTE;
   1.596      }
   1.597 @@ -697,7 +695,7 @@
   1.598  
   1.599          HIDDEN->mga_crtc2_stretch = 0;
   1.600  
   1.601 -        if (SDL_getenv ("SDL_DIRECTFB_MGA_STRETCH") != NULL) {
   1.602 +        if (SDL_getenv("SDL_DIRECTFB_MGA_STRETCH") != NULL) {
   1.603              /* Normally assume a picture aspect ratio of 4:3 */
   1.604              int zoom_aspect_x = 4, zoom_aspect_y = 3, i, j;
   1.605  
   1.606 @@ -718,8 +716,8 @@
   1.607              printf
   1.608                  ("Source resolution: X: %d, Y: %d, Aspect ratio: %d:%d\n",
   1.609                   width, height, zoom_aspect_x, zoom_aspect_y);
   1.610 -            printf ("CRTC2 resolution: X: %d, Y: %d\n",
   1.611 -                    HIDDEN->c2framesize.w, HIDDEN->c2framesize.h);
   1.612 +            printf("CRTC2 resolution: X: %d, Y: %d\n",
   1.613 +                   HIDDEN->c2framesize.w, HIDDEN->c2framesize.h);
   1.614  #endif
   1.615  
   1.616              /* don't stretch only slightly smaller/larger images */
   1.617 @@ -740,8 +738,8 @@
   1.618                  HIDDEN->c2dsize.h -= zoom_aspect_y;
   1.619  
   1.620  #ifdef DIRECTFB_CRTC2_DEBUG
   1.621 -                printf ("Stretched resolution: X: %d, Y: %d\n",
   1.622 -                        HIDDEN->c2dsize.w, HIDDEN->c2dsize.h);
   1.623 +                printf("Stretched resolution: X: %d, Y: %d\n",
   1.624 +                       HIDDEN->c2dsize.w, HIDDEN->c2dsize.h);
   1.625  #endif
   1.626  
   1.627                  HIDDEN->mga_crtc2_stretch = 1;
   1.628 @@ -759,14 +757,14 @@
   1.629                  }
   1.630  
   1.631  #ifdef DIRECTFB_CRTC2_DEBUG
   1.632 -                printf ("Down-Stretched resolution: X: %d, Y: %d\n",
   1.633 -                        HIDDEN->c2dsize.w, HIDDEN->c2dsize.h);
   1.634 +                printf("Down-Stretched resolution: X: %d, Y: %d\n",
   1.635 +                       HIDDEN->c2dsize.w, HIDDEN->c2dsize.h);
   1.636  #endif
   1.637  
   1.638                  HIDDEN->mga_crtc2_stretch = 1;
   1.639              } else {
   1.640  #ifdef DIRECTFB_CRTC2_DEBUG
   1.641 -                printf ("Not stretching image\n");
   1.642 +                printf("Not stretching image\n");
   1.643  #endif
   1.644              }
   1.645  
   1.646 @@ -786,8 +784,8 @@
   1.647                      (HIDDEN->c2dsize.h - HIDDEN->c2framesize.h) / 2;
   1.648  
   1.649  #ifdef DIRECTFB_CRTC2_DEBUG
   1.650 -            printf ("CRTC2 position X: %d, Y: %d\n", HIDDEN->c2dsize.x,
   1.651 -                    HIDDEN->c2dsize.y);
   1.652 +            printf("CRTC2 position X: %d, Y: %d\n", HIDDEN->c2dsize.x,
   1.653 +                   HIDDEN->c2dsize.y);
   1.654  #endif
   1.655          }
   1.656      }
   1.657 @@ -796,7 +794,7 @@
   1.658  }
   1.659  
   1.660  static int
   1.661 -DirectFB_AllocHWSurface (_THIS, SDL_Surface * surface)
   1.662 +DirectFB_AllocHWSurface(_THIS, SDL_Surface * surface)
   1.663  {
   1.664      DFBResult ret;
   1.665      DFBSurfaceDescription dsc;
   1.666 @@ -815,25 +813,25 @@
   1.667      dsc.caps = (surface->flags & SDL_DOUBLEBUF) ? DSCAPS_FLIPPING : 0;
   1.668  
   1.669      /* find the right pixelformat */
   1.670 -    dsc.pixelformat = SDLToDFBPixelFormat (surface->format);
   1.671 +    dsc.pixelformat = SDLToDFBPixelFormat(surface->format);
   1.672      if (dsc.pixelformat == DSPF_UNKNOWN)
   1.673          return -1;
   1.674  
   1.675      /* Allocate the hardware acceleration data */
   1.676      surface->hwdata =
   1.677 -        (struct private_hwdata *) SDL_calloc (1, sizeof (*surface->hwdata));
   1.678 +        (struct private_hwdata *) SDL_calloc(1, sizeof(*surface->hwdata));
   1.679      if (surface->hwdata == NULL) {
   1.680 -        SDL_OutOfMemory ();
   1.681 +        SDL_OutOfMemory();
   1.682          return -1;
   1.683      }
   1.684  
   1.685      /* Create the surface */
   1.686      ret =
   1.687 -        HIDDEN->dfb->CreateSurface (HIDDEN->dfb, &dsc,
   1.688 -                                    &surface->hwdata->surface);
   1.689 +        HIDDEN->dfb->CreateSurface(HIDDEN->dfb, &dsc,
   1.690 +                                   &surface->hwdata->surface);
   1.691      if (ret) {
   1.692 -        SetDirectFBerror ("dfb->CreateSurface", ret);
   1.693 -        free (surface->hwdata);
   1.694 +        SetDirectFBerror("dfb->CreateSurface", ret);
   1.695 +        free(surface->hwdata);
   1.696          surface->hwdata = NULL;
   1.697          return -1;
   1.698      }
   1.699 @@ -844,17 +842,17 @@
   1.700  }
   1.701  
   1.702  static void
   1.703 -DirectFB_FreeHWSurface (_THIS, SDL_Surface * surface)
   1.704 +DirectFB_FreeHWSurface(_THIS, SDL_Surface * surface)
   1.705  {
   1.706      if (surface->hwdata && HIDDEN->initialized) {
   1.707 -        surface->hwdata->surface->Release (surface->hwdata->surface);
   1.708 -        free (surface->hwdata);
   1.709 +        surface->hwdata->surface->Release(surface->hwdata->surface);
   1.710 +        free(surface->hwdata);
   1.711          surface->hwdata = NULL;
   1.712      }
   1.713  }
   1.714  
   1.715  static int
   1.716 -DirectFB_CheckHWBlit (_THIS, SDL_Surface * src, SDL_Surface * dst)
   1.717 +DirectFB_CheckHWBlit(_THIS, SDL_Surface * src, SDL_Surface * dst)
   1.718  {
   1.719      /*  fprintf(stderr, "SDL: DirectFB_CheckHWBlit (src->hwdata: %p, dst->hwdata: %p)\n",
   1.720         src->hwdata, dst->hwdata); */
   1.721 @@ -869,8 +867,8 @@
   1.722  }
   1.723  
   1.724  static int
   1.725 -DirectFB_HWAccelBlit (SDL_Surface * src, SDL_Rect * srcrect,
   1.726 -                      SDL_Surface * dst, SDL_Rect * dstrect)
   1.727 +DirectFB_HWAccelBlit(SDL_Surface * src, SDL_Rect * srcrect,
   1.728 +                     SDL_Surface * dst, SDL_Rect * dstrect)
   1.729  {
   1.730      DFBSurfaceBlittingFlags flags = DSBLIT_NOFX;
   1.731  
   1.732 @@ -881,104 +879,104 @@
   1.733  
   1.734      if (src->flags & SDL_SRCCOLORKEY) {
   1.735          flags |= DSBLIT_SRC_COLORKEY;
   1.736 -        DirectFB_SetHWColorKey (NULL, src, src->format->colorkey);
   1.737 +        DirectFB_SetHWColorKey(NULL, src, src->format->colorkey);
   1.738      }
   1.739  
   1.740      if (src->flags & SDL_SRCALPHA) {
   1.741          flags |= DSBLIT_BLEND_COLORALPHA;
   1.742 -        surface->SetColor (surface, 0xff, 0xff, 0xff, src->format->alpha);
   1.743 +        surface->SetColor(surface, 0xff, 0xff, 0xff, src->format->alpha);
   1.744      }
   1.745  
   1.746 -    surface->SetBlittingFlags (surface, flags);
   1.747 +    surface->SetBlittingFlags(surface, flags);
   1.748  
   1.749      if (sr.w == dr.w && sr.h == dr.h)
   1.750 -        surface->Blit (surface, src->hwdata->surface, &sr, dr.x, dr.y);
   1.751 +        surface->Blit(surface, src->hwdata->surface, &sr, dr.x, dr.y);
   1.752      else
   1.753 -        surface->StretchBlit (surface, src->hwdata->surface, &sr, &dr);
   1.754 +        surface->StretchBlit(surface, src->hwdata->surface, &sr, &dr);
   1.755  
   1.756      return 0;
   1.757  }
   1.758  
   1.759  static int
   1.760 -DirectFB_FillHWRect (_THIS, SDL_Surface * dst, SDL_Rect * dstrect,
   1.761 -                     Uint32 color)
   1.762 +DirectFB_FillHWRect(_THIS, SDL_Surface * dst, SDL_Rect * dstrect,
   1.763 +                    Uint32 color)
   1.764  {
   1.765      SDL_PixelFormat *fmt = dst->format;
   1.766      IDirectFBSurface *surface = dst->hwdata->surface;
   1.767  
   1.768      /* ugly */
   1.769 -    surface->SetColor (surface,
   1.770 -                       (color & fmt->Rmask) >> (fmt->Rshift - fmt->Rloss),
   1.771 -                       (color & fmt->Gmask) >> (fmt->Gshift - fmt->Gloss),
   1.772 -                       (color & fmt->Bmask) << (fmt->Bloss - fmt->Bshift),
   1.773 -                       0xFF);
   1.774 -    surface->FillRectangle (surface, dstrect->x, dstrect->y, dstrect->w,
   1.775 -                            dstrect->h);
   1.776 +    surface->SetColor(surface,
   1.777 +                      (color & fmt->Rmask) >> (fmt->Rshift - fmt->Rloss),
   1.778 +                      (color & fmt->Gmask) >> (fmt->Gshift - fmt->Gloss),
   1.779 +                      (color & fmt->Bmask) << (fmt->Bloss - fmt->Bshift),
   1.780 +                      0xFF);
   1.781 +    surface->FillRectangle(surface, dstrect->x, dstrect->y, dstrect->w,
   1.782 +                           dstrect->h);
   1.783  
   1.784      return 0;
   1.785  }
   1.786  
   1.787  static int
   1.788 -DirectFB_SetHWColorKey (_THIS, SDL_Surface * src, Uint32 key)
   1.789 +DirectFB_SetHWColorKey(_THIS, SDL_Surface * src, Uint32 key)
   1.790  {
   1.791      SDL_PixelFormat *fmt = src->format;
   1.792      IDirectFBSurface *surface = src->hwdata->surface;
   1.793  
   1.794      if (fmt->BitsPerPixel == 8)
   1.795 -        surface->SetSrcColorKeyIndex (surface, key);
   1.796 +        surface->SetSrcColorKeyIndex(surface, key);
   1.797      else
   1.798          /* ugly */
   1.799 -        surface->SetSrcColorKey (surface,
   1.800 -                                 (key & fmt->Rmask) >> (fmt->Rshift -
   1.801 -                                                        fmt->Rloss),
   1.802 -                                 (key & fmt->Gmask) >> (fmt->Gshift -
   1.803 -                                                        fmt->Gloss),
   1.804 -                                 (key & fmt->Bmask) << (fmt->Bloss -
   1.805 -                                                        fmt->Bshift));
   1.806 +        surface->SetSrcColorKey(surface,
   1.807 +                                (key & fmt->Rmask) >> (fmt->Rshift -
   1.808 +                                                       fmt->Rloss),
   1.809 +                                (key & fmt->Gmask) >> (fmt->Gshift -
   1.810 +                                                       fmt->Gloss),
   1.811 +                                (key & fmt->Bmask) << (fmt->Bloss -
   1.812 +                                                       fmt->Bshift));
   1.813  
   1.814      return 0;
   1.815  }
   1.816  
   1.817  static int
   1.818 -DirectFB_SetHWAlpha (_THIS, SDL_Surface * surface, Uint8 alpha)
   1.819 +DirectFB_SetHWAlpha(_THIS, SDL_Surface * surface, Uint8 alpha)
   1.820  {
   1.821      return 0;
   1.822  }
   1.823  
   1.824  static int
   1.825 -DirectFB_FlipHWSurface (_THIS, SDL_Surface * surface)
   1.826 +DirectFB_FlipHWSurface(_THIS, SDL_Surface * surface)
   1.827  {
   1.828      if (HIDDEN->enable_mga_crtc2) {
   1.829          int rtn =
   1.830 -            surface->hwdata->surface->Flip (surface->hwdata->surface, NULL,
   1.831 -                                            0);
   1.832 +            surface->hwdata->surface->Flip(surface->hwdata->surface, NULL,
   1.833 +                                           0);
   1.834          if (HIDDEN->mga_crtc2_stretch)
   1.835 -            HIDDEN->c2frame->StretchBlit (HIDDEN->c2frame,
   1.836 -                                          surface->hwdata->surface,
   1.837 -                                          &HIDDEN->c2ssize, &HIDDEN->c2dsize);
   1.838 +            HIDDEN->c2frame->StretchBlit(HIDDEN->c2frame,
   1.839 +                                         surface->hwdata->surface,
   1.840 +                                         &HIDDEN->c2ssize, &HIDDEN->c2dsize);
   1.841          else
   1.842 -            HIDDEN->c2frame->Blit (HIDDEN->c2frame,
   1.843 -                                   surface->hwdata->surface, NULL,
   1.844 -                                   HIDDEN->c2dsize.x, HIDDEN->c2dsize.y);
   1.845 +            HIDDEN->c2frame->Blit(HIDDEN->c2frame,
   1.846 +                                  surface->hwdata->surface, NULL,
   1.847 +                                  HIDDEN->c2dsize.x, HIDDEN->c2dsize.y);
   1.848  
   1.849 -        HIDDEN->c2frame->Flip (HIDDEN->c2frame, NULL, DSFLIP_WAITFORSYNC);
   1.850 +        HIDDEN->c2frame->Flip(HIDDEN->c2frame, NULL, DSFLIP_WAITFORSYNC);
   1.851          return rtn;
   1.852      } else
   1.853 -        return surface->hwdata->surface->Flip (surface->hwdata->surface, NULL,
   1.854 -                                               DSFLIP_WAITFORSYNC);
   1.855 +        return surface->hwdata->surface->Flip(surface->hwdata->surface, NULL,
   1.856 +                                              DSFLIP_WAITFORSYNC);
   1.857  }
   1.858  
   1.859  static int
   1.860 -DirectFB_LockHWSurface (_THIS, SDL_Surface * surface)
   1.861 +DirectFB_LockHWSurface(_THIS, SDL_Surface * surface)
   1.862  {
   1.863      DFBResult ret;
   1.864      void *data;
   1.865      int pitch;
   1.866  
   1.867 -    ret = surface->hwdata->surface->Lock (surface->hwdata->surface,
   1.868 -                                          DSLF_WRITE, &data, &pitch);
   1.869 +    ret = surface->hwdata->surface->Lock(surface->hwdata->surface,
   1.870 +                                         DSLF_WRITE, &data, &pitch);
   1.871      if (ret) {
   1.872 -        SetDirectFBerror ("surface->Lock", ret);
   1.873 +        SetDirectFBerror("surface->Lock", ret);
   1.874          return -1;
   1.875      }
   1.876  
   1.877 @@ -989,31 +987,31 @@
   1.878  }
   1.879  
   1.880  static void
   1.881 -DirectFB_UnlockHWSurface (_THIS, SDL_Surface * surface)
   1.882 +DirectFB_UnlockHWSurface(_THIS, SDL_Surface * surface)
   1.883  {
   1.884 -    surface->hwdata->surface->Unlock (surface->hwdata->surface);
   1.885 +    surface->hwdata->surface->Unlock(surface->hwdata->surface);
   1.886      surface->pixels = NULL;
   1.887  }
   1.888  
   1.889  static void
   1.890 -DirectFB_DirectUpdate (_THIS, int numrects, SDL_Rect * rects)
   1.891 +DirectFB_DirectUpdate(_THIS, int numrects, SDL_Rect * rects)
   1.892  {
   1.893      if (HIDDEN->enable_mga_crtc2) {
   1.894          if (HIDDEN->mga_crtc2_stretch)
   1.895 -            HIDDEN->c2frame->StretchBlit (HIDDEN->c2frame,
   1.896 -                                          this->screen->hwdata->surface,
   1.897 -                                          &HIDDEN->c2ssize, &HIDDEN->c2dsize);
   1.898 +            HIDDEN->c2frame->StretchBlit(HIDDEN->c2frame,
   1.899 +                                         this->screen->hwdata->surface,
   1.900 +                                         &HIDDEN->c2ssize, &HIDDEN->c2dsize);
   1.901          else
   1.902 -            HIDDEN->c2frame->Blit (HIDDEN->c2frame,
   1.903 -                                   this->screen->hwdata->surface, NULL,
   1.904 -                                   HIDDEN->c2dsize.x, HIDDEN->c2dsize.y);
   1.905 +            HIDDEN->c2frame->Blit(HIDDEN->c2frame,
   1.906 +                                  this->screen->hwdata->surface, NULL,
   1.907 +                                  HIDDEN->c2dsize.x, HIDDEN->c2dsize.y);
   1.908  
   1.909 -        HIDDEN->c2frame->Flip (HIDDEN->c2frame, NULL, DSFLIP_WAITFORSYNC);
   1.910 +        HIDDEN->c2frame->Flip(HIDDEN->c2frame, NULL, DSFLIP_WAITFORSYNC);
   1.911      }
   1.912  }
   1.913  
   1.914  static void
   1.915 -DirectFB_WindowedUpdate (_THIS, int numrects, SDL_Rect * rects)
   1.916 +DirectFB_WindowedUpdate(_THIS, int numrects, SDL_Rect * rects)
   1.917  {
   1.918      DFBRegion region;
   1.919      int i;
   1.920 @@ -1054,21 +1052,21 @@
   1.921      if (region_valid) {
   1.922          if (HIDDEN->enable_mga_crtc2) {
   1.923              if (HIDDEN->mga_crtc2_stretch)
   1.924 -                HIDDEN->c2frame->StretchBlit (HIDDEN->c2frame, surface,
   1.925 -                                              &HIDDEN->c2ssize,
   1.926 -                                              &HIDDEN->c2dsize);
   1.927 +                HIDDEN->c2frame->StretchBlit(HIDDEN->c2frame, surface,
   1.928 +                                             &HIDDEN->c2ssize,
   1.929 +                                             &HIDDEN->c2dsize);
   1.930              else
   1.931 -                HIDDEN->c2frame->Blit (HIDDEN->c2frame, surface, NULL,
   1.932 -                                       HIDDEN->c2dsize.x, HIDDEN->c2dsize.y);
   1.933 +                HIDDEN->c2frame->Blit(HIDDEN->c2frame, surface, NULL,
   1.934 +                                      HIDDEN->c2dsize.x, HIDDEN->c2dsize.y);
   1.935  
   1.936 -            HIDDEN->c2frame->Flip (HIDDEN->c2frame, NULL, DSFLIP_WAITFORSYNC);
   1.937 +            HIDDEN->c2frame->Flip(HIDDEN->c2frame, NULL, DSFLIP_WAITFORSYNC);
   1.938          } else
   1.939 -            surface->Flip (surface, &region, DSFLIP_WAITFORSYNC);
   1.940 +            surface->Flip(surface, &region, DSFLIP_WAITFORSYNC);
   1.941      }
   1.942  }
   1.943  
   1.944  int
   1.945 -DirectFB_SetColors (_THIS, int firstcolor, int ncolors, SDL_Color * colors)
   1.946 +DirectFB_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color * colors)
   1.947  {
   1.948      IDirectFBPalette *palette = this->screen->hwdata->palette;
   1.949  
   1.950 @@ -1092,14 +1090,14 @@
   1.951              entries[i].b = colors[i].b;
   1.952          }
   1.953  
   1.954 -        palette->SetEntries (palette, entries, ncolors, firstcolor);
   1.955 +        palette->SetEntries(palette, entries, ncolors, firstcolor);
   1.956      }
   1.957  
   1.958      return 1;
   1.959  }
   1.960  
   1.961  void
   1.962 -DirectFB_VideoQuit (_THIS)
   1.963 +DirectFB_VideoQuit(_THIS)
   1.964  {
   1.965      struct DirectFBEnumRect *rect = enumlist;
   1.966  
   1.967 @@ -1108,50 +1106,50 @@
   1.968          IDirectFBPalette *palette = this->screen->hwdata->palette;
   1.969  
   1.970          if (palette)
   1.971 -            palette->Release (palette);
   1.972 +            palette->Release(palette);
   1.973  
   1.974          if (surface)
   1.975 -            surface->Release (surface);
   1.976 +            surface->Release(surface);
   1.977  
   1.978          this->screen->hwdata->surface = NULL;
   1.979          this->screen->hwdata->palette = NULL;
   1.980      }
   1.981  
   1.982      if (HIDDEN->c2frame) {
   1.983 -        HIDDEN->c2frame->Release (HIDDEN->c2frame);
   1.984 +        HIDDEN->c2frame->Release(HIDDEN->c2frame);
   1.985          HIDDEN->c2frame = NULL;
   1.986      }
   1.987  
   1.988      if (HIDDEN->eventbuffer) {
   1.989 -        HIDDEN->eventbuffer->Release (HIDDEN->eventbuffer);
   1.990 +        HIDDEN->eventbuffer->Release(HIDDEN->eventbuffer);
   1.991          HIDDEN->eventbuffer = NULL;
   1.992      }
   1.993  
   1.994      if (HIDDEN->c2layer) {
   1.995 -        HIDDEN->c2layer->Release (HIDDEN->c2layer);
   1.996 +        HIDDEN->c2layer->Release(HIDDEN->c2layer);
   1.997          HIDDEN->c2layer = NULL;
   1.998      }
   1.999  
  1.1000      if (HIDDEN->layer) {
  1.1001 -        HIDDEN->layer->Release (HIDDEN->layer);
  1.1002 +        HIDDEN->layer->Release(HIDDEN->layer);
  1.1003          HIDDEN->layer = NULL;
  1.1004      }
  1.1005  
  1.1006      if (HIDDEN->dfb) {
  1.1007 -        HIDDEN->dfb->Release (HIDDEN->dfb);
  1.1008 +        HIDDEN->dfb->Release(HIDDEN->dfb);
  1.1009          HIDDEN->dfb = NULL;
  1.1010      }
  1.1011  
  1.1012      /* Free video mode list */
  1.1013      if (HIDDEN->modelist) {
  1.1014 -        free (HIDDEN->modelist);
  1.1015 +        free(HIDDEN->modelist);
  1.1016          HIDDEN->modelist = NULL;
  1.1017      }
  1.1018  
  1.1019      /* Free mode enumeration list */
  1.1020      while (rect) {
  1.1021          struct DirectFBEnumRect *next = rect->next;
  1.1022 -        free (rect);
  1.1023 +        free(rect);
  1.1024          rect = next;
  1.1025      }
  1.1026      enumlist = NULL;
  1.1027 @@ -1161,19 +1159,19 @@
  1.1028  
  1.1029  
  1.1030  int
  1.1031 -DirectFB_ShowWMCursor (_THIS, WMcursor * cursor)
  1.1032 +DirectFB_ShowWMCursor(_THIS, WMcursor * cursor)
  1.1033  {
  1.1034      /* We can only hide or show the default cursor */
  1.1035      if (cursor == NULL) {
  1.1036 -        HIDDEN->layer->SetCursorOpacity (HIDDEN->layer, 0x00);
  1.1037 +        HIDDEN->layer->SetCursorOpacity(HIDDEN->layer, 0x00);
  1.1038      } else {
  1.1039 -        HIDDEN->layer->SetCursorOpacity (HIDDEN->layer, 0xFF);
  1.1040 +        HIDDEN->layer->SetCursorOpacity(HIDDEN->layer, 0xFF);
  1.1041      }
  1.1042      return 1;
  1.1043  }
  1.1044  
  1.1045  void
  1.1046 -DirectFB_FinalQuit (void)
  1.1047 +DirectFB_FinalQuit(void)
  1.1048  {
  1.1049  }
  1.1050