Mercurial > sdl-ios-xcode
diff src/video/directfb/SDL_DirectFB_video.c @ 1668:4da1ee79c9af SDL-1.3
more tweaking indent options
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 29 May 2006 04:04:35 +0000 |
parents | 782fd950bd46 |
children |
line wrap: on
line diff
--- a/src/video/directfb/SDL_DirectFB_video.c Mon May 29 03:53:21 2006 +0000 +++ b/src/video/directfb/SDL_DirectFB_video.c Mon May 29 04:04:35 2006 +0000 @@ -52,34 +52,34 @@ /* Initialization/Query functions */ -static int DirectFB_VideoInit (_THIS, SDL_PixelFormat * vformat); -static SDL_Rect **DirectFB_ListModes (_THIS, SDL_PixelFormat * format, - Uint32 flags); -static SDL_Surface *DirectFB_SetVideoMode (_THIS, SDL_Surface * current, - int width, int height, int bpp, - Uint32 flags); -static int DirectFB_SetColors (_THIS, int firstcolor, int ncolors, - SDL_Color * colors); -static void DirectFB_VideoQuit (_THIS); +static int DirectFB_VideoInit(_THIS, SDL_PixelFormat * vformat); +static SDL_Rect **DirectFB_ListModes(_THIS, SDL_PixelFormat * format, + Uint32 flags); +static SDL_Surface *DirectFB_SetVideoMode(_THIS, SDL_Surface * current, + int width, int height, int bpp, + Uint32 flags); +static int DirectFB_SetColors(_THIS, int firstcolor, int ncolors, + SDL_Color * colors); +static void DirectFB_VideoQuit(_THIS); /* Hardware surface functions */ -static int DirectFB_AllocHWSurface (_THIS, SDL_Surface * surface); -static int DirectFB_FillHWRect (_THIS, SDL_Surface * dst, SDL_Rect * dstrect, - Uint32 color); -static int DirectFB_LockHWSurface (_THIS, SDL_Surface * surface); -static void DirectFB_UnlockHWSurface (_THIS, SDL_Surface * surface); -static void DirectFB_FreeHWSurface (_THIS, SDL_Surface * surface); -static int DirectFB_CheckHWBlit (_THIS, SDL_Surface * src, SDL_Surface * dst); -static int DirectFB_HWAccelBlit (SDL_Surface * src, SDL_Rect * srcrect, - SDL_Surface * dst, SDL_Rect * dstrect); -static int DirectFB_SetHWColorKey (_THIS, SDL_Surface * surface, Uint32 key); -static int DirectFB_SetHWAlpha (_THIS, SDL_Surface * surface, Uint8 alpha); -static int DirectFB_FlipHWSurface (_THIS, SDL_Surface * surface); -static int DirectFB_ShowWMCursor (_THIS, WMcursor * cursor); +static int DirectFB_AllocHWSurface(_THIS, SDL_Surface * surface); +static int DirectFB_FillHWRect(_THIS, SDL_Surface * dst, SDL_Rect * dstrect, + Uint32 color); +static int DirectFB_LockHWSurface(_THIS, SDL_Surface * surface); +static void DirectFB_UnlockHWSurface(_THIS, SDL_Surface * surface); +static void DirectFB_FreeHWSurface(_THIS, SDL_Surface * surface); +static int DirectFB_CheckHWBlit(_THIS, SDL_Surface * src, SDL_Surface * dst); +static int DirectFB_HWAccelBlit(SDL_Surface * src, SDL_Rect * srcrect, + SDL_Surface * dst, SDL_Rect * dstrect); +static int DirectFB_SetHWColorKey(_THIS, SDL_Surface * surface, Uint32 key); +static int DirectFB_SetHWAlpha(_THIS, SDL_Surface * surface, Uint8 alpha); +static int DirectFB_FlipHWSurface(_THIS, SDL_Surface * surface); +static int DirectFB_ShowWMCursor(_THIS, WMcursor * cursor); /* Various screen update functions available */ -static void DirectFB_DirectUpdate (_THIS, int numrects, SDL_Rect * rects); -static void DirectFB_WindowedUpdate (_THIS, int numrects, SDL_Rect * rects); +static void DirectFB_DirectUpdate(_THIS, int numrects, SDL_Rect * rects); +static void DirectFB_WindowedUpdate(_THIS, int numrects, SDL_Rect * rects); /* This is the rect EnumModes2 uses */ struct DirectFBEnumRect @@ -94,38 +94,38 @@ /* DirectFB driver bootstrap functions */ static int -DirectFB_Available (void) +DirectFB_Available(void) { return 1; } static void -DirectFB_DeleteDevice (SDL_VideoDevice * device) +DirectFB_DeleteDevice(SDL_VideoDevice * device) { - SDL_free (device->hidden); - SDL_free (device); + SDL_free(device->hidden); + SDL_free(device); } static SDL_VideoDevice * -DirectFB_CreateDevice (int devindex) +DirectFB_CreateDevice(int devindex) { SDL_VideoDevice *device; /* Initialize all variables that we clean on shutdown */ - device = (SDL_VideoDevice *) SDL_malloc (sizeof (SDL_VideoDevice)); + device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice)); if (device) { - SDL_memset (device, 0, (sizeof *device)); + SDL_memset(device, 0, (sizeof *device)); device->hidden = (struct SDL_PrivateVideoData *) - malloc (sizeof (*device->hidden)); + malloc(sizeof(*device->hidden)); } if (device == NULL || device->hidden == NULL) { - SDL_OutOfMemory (); + SDL_OutOfMemory(); if (device) { - free (device); + free(device); } return (0); } - SDL_memset (device->hidden, 0, sizeof (*device->hidden)); + SDL_memset(device->hidden, 0, sizeof(*device->hidden)); /* Set the function pointers */ device->VideoInit = DirectFB_VideoInit; @@ -164,14 +164,14 @@ }; static DFBSurfacePixelFormat -GetFormatForBpp (int bpp, IDirectFBDisplayLayer * layer) +GetFormatForBpp(int bpp, IDirectFBDisplayLayer * layer) { DFBDisplayLayerConfig dlc; int bytes = (bpp + 7) / 8; - layer->GetConfiguration (layer, &dlc); + layer->GetConfiguration(layer, &dlc); - if (bytes == DFB_BYTES_PER_PIXEL (dlc.pixelformat) && bytes > 1) + if (bytes == DFB_BYTES_PER_PIXEL(dlc.pixelformat) && bytes > 1) return dlc.pixelformat; switch (bytes) { @@ -189,7 +189,7 @@ } static DFBEnumerationResult -EnumModesCallback (int width, int height, int bpp, void *data) +EnumModesCallback(int width, int height, int bpp, void *data) { SDL_VideoDevice *this = (SDL_VideoDevice *) data; struct DirectFBEnumRect *enumrect; @@ -199,9 +199,9 @@ if (enumlist && enumlist->r.w == width && enumlist->r.h == height) return DFENUM_OK; - enumrect = SDL_calloc (1, sizeof (struct DirectFBEnumRect)); + enumrect = SDL_calloc(1, sizeof(struct DirectFBEnumRect)); if (!enumrect) { - SDL_OutOfMemory (); + SDL_OutOfMemory(); return DFENUM_CANCEL; } @@ -221,18 +221,18 @@ }; void -SetDirectFBerror (const char *function, DFBResult code) +SetDirectFBerror(const char *function, DFBResult code) { - const char *error = DirectFBErrorString (code); + const char *error = DirectFBErrorString(code); if (error) - SDL_SetError ("%s: %s", function, error); + SDL_SetError("%s: %s", function, error); else - SDL_SetError ("Unknown error code from %s", function); + SDL_SetError("Unknown error code from %s", function); } static DFBSurfacePixelFormat -SDLToDFBPixelFormat (SDL_PixelFormat * format) +SDLToDFBPixelFormat(SDL_PixelFormat * format) { if (format->Rmask && format->Gmask && format->Bmask) { switch (format->BitsPerPixel) { @@ -286,20 +286,20 @@ } static SDL_Palette * -AllocatePalette (int size) +AllocatePalette(int size) { SDL_Palette *palette; SDL_Color *colors; - palette = SDL_calloc (1, sizeof (SDL_Palette)); + palette = SDL_calloc(1, sizeof(SDL_Palette)); if (!palette) { - SDL_OutOfMemory (); + SDL_OutOfMemory(); return NULL; } - colors = SDL_calloc (size, sizeof (SDL_Color)); + colors = SDL_calloc(size, sizeof(SDL_Color)); if (!colors) { - SDL_OutOfMemory (); + SDL_OutOfMemory(); return NULL; } @@ -310,8 +310,8 @@ } static int -DFBToSDLPixelFormat (DFBSurfacePixelFormat pixelformat, - SDL_PixelFormat * format) +DFBToSDLPixelFormat(DFBSurfacePixelFormat pixelformat, + SDL_PixelFormat * format) { format->Amask = format->Rmask = format->Gmask = format->Bmask = 0; format->BitsPerPixel = format->BytesPerPixel = 0; @@ -349,25 +349,25 @@ format->Bmask = 0x000000FF; if (!format->palette) - format->palette = AllocatePalette (256); + format->palette = AllocatePalette(256); break; default: - fprintf (stderr, - "SDL_DirectFB: Unsupported pixelformat (0x%08x)!\n", - pixelformat); + fprintf(stderr, + "SDL_DirectFB: Unsupported pixelformat (0x%08x)!\n", + pixelformat); return -1; } - format->BitsPerPixel = DFB_BYTES_PER_PIXEL (pixelformat) * 8; - format->BytesPerPixel = DFB_BYTES_PER_PIXEL (pixelformat); + format->BitsPerPixel = DFB_BYTES_PER_PIXEL(pixelformat) * 8; + format->BytesPerPixel = DFB_BYTES_PER_PIXEL(pixelformat); return 0; } int -DirectFB_VideoInit (_THIS, SDL_PixelFormat * vformat) +DirectFB_VideoInit(_THIS, SDL_PixelFormat * vformat) { int i; DFBResult ret; @@ -386,49 +386,49 @@ HIDDEN->enable_mga_crtc2 = 0; HIDDEN->mga_crtc2_stretch_overscan = 1; - ret = DirectFBInit (NULL, NULL); + ret = DirectFBInit(NULL, NULL); if (ret) { - SetDirectFBerror ("DirectFBInit", ret); + SetDirectFBerror("DirectFBInit", ret); goto error; } - ret = DirectFBCreate (&dfb); + ret = DirectFBCreate(&dfb); if (ret) { - SetDirectFBerror ("DirectFBCreate", ret); + SetDirectFBerror("DirectFBCreate", ret); goto error; } - ret = dfb->GetDisplayLayer (dfb, DLID_PRIMARY, &layer); + ret = dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &layer); if (ret) { - SetDirectFBerror ("dfb->GetDisplayLayer", ret); + SetDirectFBerror("dfb->GetDisplayLayer", ret); goto error; } - ret = dfb->CreateInputEventBuffer (dfb, DICAPS_ALL, DFB_FALSE, &events); + ret = dfb->CreateInputEventBuffer(dfb, DICAPS_ALL, DFB_FALSE, &events); if (ret) { - SetDirectFBerror ("dfb->CreateEventBuffer", ret); + SetDirectFBerror("dfb->CreateEventBuffer", ret); goto error; } - layer->EnableCursor (layer, 1); + layer->EnableCursor(layer, 1); /* Query layer configuration to determine the current mode and pixelformat */ - layer->GetConfiguration (layer, &dlc); + layer->GetConfiguration(layer, &dlc); /* If current format is not supported use LUT8 as the default */ - if (DFBToSDLPixelFormat (dlc.pixelformat, vformat)) - DFBToSDLPixelFormat (DSPF_LUT8, vformat); + if (DFBToSDLPixelFormat(dlc.pixelformat, vformat)) + DFBToSDLPixelFormat(DSPF_LUT8, vformat); /* Enumerate the available fullscreen modes */ - ret = dfb->EnumVideoModes (dfb, EnumModesCallback, this); + ret = dfb->EnumVideoModes(dfb, EnumModesCallback, this); if (ret) { - SetDirectFBerror ("dfb->EnumVideoModes", ret); + SetDirectFBerror("dfb->EnumVideoModes", ret); goto error; } - HIDDEN->modelist = SDL_calloc (HIDDEN->nummodes + 1, sizeof (SDL_Rect *)); + HIDDEN->modelist = SDL_calloc(HIDDEN->nummodes + 1, sizeof(SDL_Rect *)); if (!HIDDEN->modelist) { - SDL_OutOfMemory (); + SDL_OutOfMemory(); goto error; } @@ -441,9 +441,9 @@ /* Query card capabilities to get the video memory size */ #if (DIRECTFB_MAJOR_VERSION == 0) && (DIRECTFB_MINOR_VERSION == 9) && (DIRECTFB_MICRO_VERSION < 23) - dfb->GetCardCapabilities (dfb, &caps); + dfb->GetCardCapabilities(dfb, &caps); #else - dfb->GetDeviceDescription (dfb, &caps); + dfb->GetDeviceDescription(dfb, &caps); #endif this->info.wm_available = 1; @@ -459,22 +459,22 @@ HIDDEN->layer = layer; HIDDEN->eventbuffer = events; - if (SDL_getenv ("SDL_DIRECTFB_MGA_CRTC2") != NULL) + if (SDL_getenv("SDL_DIRECTFB_MGA_CRTC2") != NULL) HIDDEN->enable_mga_crtc2 = 1; if (HIDDEN->enable_mga_crtc2) { DFBDisplayLayerConfig dlc; DFBDisplayLayerConfigFlags failed; - ret = dfb->GetDisplayLayer (dfb, 2, &HIDDEN->c2layer); + ret = dfb->GetDisplayLayer(dfb, 2, &HIDDEN->c2layer); if (ret) { - SetDirectFBerror ("dfb->GetDisplayLayer(CRTC2)", ret); + SetDirectFBerror("dfb->GetDisplayLayer(CRTC2)", ret); goto error; } ret = - HIDDEN->layer->SetCooperativeLevel (HIDDEN->layer, - DLSCL_EXCLUSIVE); + HIDDEN->layer->SetCooperativeLevel(HIDDEN->layer, + DLSCL_EXCLUSIVE); if (ret) { SetDirectFBerror ("layer->SetCooperativeLevel(CRTC2, EXCLUSIVE)", ret); @@ -482,15 +482,15 @@ } ret = - HIDDEN->c2layer->SetCooperativeLevel (HIDDEN->c2layer, - DLSCL_EXCLUSIVE); + HIDDEN->c2layer->SetCooperativeLevel(HIDDEN->c2layer, + DLSCL_EXCLUSIVE); if (ret) { SetDirectFBerror ("c2layer->SetCooperativeLevel(CRTC2, EXCLUSIVE)", ret); goto error; } - HIDDEN->c2layer->SetOpacity (HIDDEN->c2layer, 0x0); + HIDDEN->c2layer->SetOpacity(HIDDEN->c2layer, 0x0); /* Init the surface here as it got a fixed size */ dlc.flags = DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE; @@ -498,53 +498,53 @@ dlc.pixelformat = DSPF_RGB32; ret = - HIDDEN->c2layer->TestConfiguration (HIDDEN->c2layer, &dlc, - &failed); + HIDDEN->c2layer->TestConfiguration(HIDDEN->c2layer, &dlc, + &failed); if (ret) { - SetDirectFBerror ("c2layer->TestConfiguration", ret); + SetDirectFBerror("c2layer->TestConfiguration", ret); goto error; } - ret = HIDDEN->c2layer->SetConfiguration (HIDDEN->c2layer, &dlc); + ret = HIDDEN->c2layer->SetConfiguration(HIDDEN->c2layer, &dlc); if (ret) { - SetDirectFBerror ("c2layer->SetConfiguration", ret); + SetDirectFBerror("c2layer->SetConfiguration", ret); goto error; } - ret = HIDDEN->c2layer->GetSurface (HIDDEN->c2layer, &HIDDEN->c2frame); + ret = HIDDEN->c2layer->GetSurface(HIDDEN->c2layer, &HIDDEN->c2frame); if (ret) { - SetDirectFBerror ("c2layer->GetSurface", ret); + SetDirectFBerror("c2layer->GetSurface", ret); goto error; } HIDDEN->c2framesize.x = 0; HIDDEN->c2framesize.y = 0; - HIDDEN->c2frame->GetSize (HIDDEN->c2frame, &HIDDEN->c2framesize.w, - &HIDDEN->c2framesize.h); + HIDDEN->c2frame->GetSize(HIDDEN->c2frame, &HIDDEN->c2framesize.w, + &HIDDEN->c2framesize.h); - HIDDEN->c2frame->SetBlittingFlags (HIDDEN->c2frame, DSBLIT_NOFX); - HIDDEN->c2frame->SetColor (HIDDEN->c2frame, 0, 0, 0, 0xff); + HIDDEN->c2frame->SetBlittingFlags(HIDDEN->c2frame, DSBLIT_NOFX); + HIDDEN->c2frame->SetColor(HIDDEN->c2frame, 0, 0, 0, 0xff); /* Clear CRTC2 */ - HIDDEN->c2frame->Clear (HIDDEN->c2frame, 0, 0, 0, 0xff); - HIDDEN->c2frame->Flip (HIDDEN->c2frame, NULL, 0); - HIDDEN->c2frame->Clear (HIDDEN->c2frame, 0, 0, 0, 0xff); - HIDDEN->c2frame->Flip (HIDDEN->c2frame, NULL, 0); - HIDDEN->c2frame->Clear (HIDDEN->c2frame, 0, 0, 0, 0xff); + HIDDEN->c2frame->Clear(HIDDEN->c2frame, 0, 0, 0, 0xff); + HIDDEN->c2frame->Flip(HIDDEN->c2frame, NULL, 0); + HIDDEN->c2frame->Clear(HIDDEN->c2frame, 0, 0, 0, 0xff); + HIDDEN->c2frame->Flip(HIDDEN->c2frame, NULL, 0); + HIDDEN->c2frame->Clear(HIDDEN->c2frame, 0, 0, 0, 0xff); - HIDDEN->c2layer->SetOpacity (HIDDEN->c2layer, 0xFF); + HIDDEN->c2layer->SetOpacity(HIDDEN->c2layer, 0xFF); /* Check if overscan is possibly set */ - if (SDL_getenv ("SDL_DIRECTFB_MGA_OVERSCAN") != NULL) { + if (SDL_getenv("SDL_DIRECTFB_MGA_OVERSCAN") != NULL) { float overscan = 0; if (SDL_sscanf - (SDL_getenv ("SDL_DIRECTFB_MGA_OVERSCAN"), "%f", + (SDL_getenv("SDL_DIRECTFB_MGA_OVERSCAN"), "%f", &overscan) == 1) if (overscan > 0 && overscan < 2) HIDDEN->mga_crtc2_stretch_overscan = overscan; } #ifdef DIRECTFB_CRTC2_DEBUG - printf ("CRTC2 overscan: %f\n", HIDDEN->mga_crtc2_stretch_overscan); + printf("CRTC2 overscan: %f\n", HIDDEN->mga_crtc2_stretch_overscan); #endif } @@ -552,91 +552,89 @@ error: if (events) - events->Release (events); + events->Release(events); if (HIDDEN->c2frame) - HIDDEN->c2frame->Release (HIDDEN->c2frame); + HIDDEN->c2frame->Release(HIDDEN->c2frame); if (HIDDEN->c2layer) - HIDDEN->c2layer->Release (HIDDEN->c2layer); + HIDDEN->c2layer->Release(HIDDEN->c2layer); if (layer) - layer->Release (layer); + layer->Release(layer); if (dfb) - dfb->Release (dfb); + dfb->Release(dfb); return -1; } static SDL_Rect ** -DirectFB_ListModes (_THIS, SDL_PixelFormat * format, Uint32 flags) +DirectFB_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags) { if (flags & SDL_FULLSCREEN) return HIDDEN->modelist; - else if (SDLToDFBPixelFormat (format) != DSPF_UNKNOWN) + else if (SDLToDFBPixelFormat(format) != DSPF_UNKNOWN) return (SDL_Rect **) - 1; return NULL; } static SDL_Surface * -DirectFB_SetVideoMode (_THIS, SDL_Surface * current, int width, int height, - int bpp, Uint32 flags) +DirectFB_SetVideoMode(_THIS, SDL_Surface * current, int width, int height, + int bpp, Uint32 flags) { DFBResult ret; DFBSurfaceDescription dsc; DFBSurfacePixelFormat pixelformat; IDirectFBSurface *surface; - fprintf (stderr, "SDL DirectFB_SetVideoMode: %dx%d@%d, flags: 0x%08x\n", - width, height, bpp, flags); + fprintf(stderr, "SDL DirectFB_SetVideoMode: %dx%d@%d, flags: 0x%08x\n", + width, height, bpp, flags); flags |= SDL_FULLSCREEN; /* Release previous primary surface */ if (current->hwdata && current->hwdata->surface) { - current->hwdata->surface->Release (current->hwdata->surface); + current->hwdata->surface->Release(current->hwdata->surface); current->hwdata->surface = NULL; /* And its palette if present */ if (current->hwdata->palette) { - current->hwdata->palette->Release (current->hwdata->palette); + current->hwdata->palette->Release(current->hwdata->palette); current->hwdata->palette = NULL; } } else if (!current->hwdata) { /* Allocate the hardware acceleration data */ current->hwdata = - (struct private_hwdata *) SDL_calloc (1, - sizeof (*current->hwdata)); + (struct private_hwdata *) SDL_calloc(1, sizeof(*current->hwdata)); if (!current->hwdata) { - SDL_OutOfMemory (); + SDL_OutOfMemory(); return NULL; } } /* Set cooperative level depending on flag SDL_FULLSCREEN */ if (flags & SDL_FULLSCREEN) { - ret = - HIDDEN->dfb->SetCooperativeLevel (HIDDEN->dfb, DFSCL_FULLSCREEN); + ret = HIDDEN->dfb->SetCooperativeLevel(HIDDEN->dfb, DFSCL_FULLSCREEN); if (ret && !HIDDEN->enable_mga_crtc2) { - DirectFBError ("dfb->SetCooperativeLevel", ret); + DirectFBError("dfb->SetCooperativeLevel", ret); flags &= ~SDL_FULLSCREEN; } } else - HIDDEN->dfb->SetCooperativeLevel (HIDDEN->dfb, DFSCL_NORMAL); + HIDDEN->dfb->SetCooperativeLevel(HIDDEN->dfb, DFSCL_NORMAL); /* Set video mode */ - ret = HIDDEN->dfb->SetVideoMode (HIDDEN->dfb, width, height, bpp); + ret = HIDDEN->dfb->SetVideoMode(HIDDEN->dfb, width, height, bpp); if (ret) { if (flags & SDL_FULLSCREEN) { flags &= ~SDL_FULLSCREEN; - HIDDEN->dfb->SetCooperativeLevel (HIDDEN->dfb, DFSCL_NORMAL); - ret = HIDDEN->dfb->SetVideoMode (HIDDEN->dfb, width, height, bpp); + HIDDEN->dfb->SetCooperativeLevel(HIDDEN->dfb, DFSCL_NORMAL); + ret = HIDDEN->dfb->SetVideoMode(HIDDEN->dfb, width, height, bpp); } if (ret) { - SetDirectFBerror ("dfb->SetVideoMode", ret); + SetDirectFBerror("dfb->SetVideoMode", ret); return NULL; } } @@ -645,16 +643,16 @@ dsc.flags = DSDESC_CAPS | DSDESC_PIXELFORMAT; dsc.caps = DSCAPS_PRIMARY | ((flags & SDL_DOUBLEBUF) ? DSCAPS_FLIPPING : 0); - dsc.pixelformat = GetFormatForBpp (bpp, HIDDEN->layer); + dsc.pixelformat = GetFormatForBpp(bpp, HIDDEN->layer); - ret = HIDDEN->dfb->CreateSurface (HIDDEN->dfb, &dsc, &surface); + ret = HIDDEN->dfb->CreateSurface(HIDDEN->dfb, &dsc, &surface); if (ret && (flags & SDL_DOUBLEBUF)) { /* Try without double buffering */ dsc.caps &= ~DSCAPS_FLIPPING; - ret = HIDDEN->dfb->CreateSurface (HIDDEN->dfb, &dsc, &surface); + ret = HIDDEN->dfb->CreateSurface(HIDDEN->dfb, &dsc, &surface); } if (ret) { - SetDirectFBerror ("dfb->CreateSurface", ret); + SetDirectFBerror("dfb->CreateSurface", ret); return NULL; } @@ -671,13 +669,13 @@ if (dsc.caps & DSCAPS_FLIPPING) current->flags |= SDL_DOUBLEBUF; - surface->GetPixelFormat (surface, &pixelformat); + surface->GetPixelFormat(surface, &pixelformat); - DFBToSDLPixelFormat (pixelformat, current->format); + DFBToSDLPixelFormat(pixelformat, current->format); /* Get the surface palette (if supported) */ - if (DFB_PIXELFORMAT_IS_INDEXED (pixelformat)) { - surface->GetPalette (surface, ¤t->hwdata->palette); + if (DFB_PIXELFORMAT_IS_INDEXED(pixelformat)) { + surface->GetPalette(surface, ¤t->hwdata->palette); current->flags |= SDL_HWPALETTE; } @@ -697,7 +695,7 @@ HIDDEN->mga_crtc2_stretch = 0; - if (SDL_getenv ("SDL_DIRECTFB_MGA_STRETCH") != NULL) { + if (SDL_getenv("SDL_DIRECTFB_MGA_STRETCH") != NULL) { /* Normally assume a picture aspect ratio of 4:3 */ int zoom_aspect_x = 4, zoom_aspect_y = 3, i, j; @@ -718,8 +716,8 @@ printf ("Source resolution: X: %d, Y: %d, Aspect ratio: %d:%d\n", width, height, zoom_aspect_x, zoom_aspect_y); - printf ("CRTC2 resolution: X: %d, Y: %d\n", - HIDDEN->c2framesize.w, HIDDEN->c2framesize.h); + printf("CRTC2 resolution: X: %d, Y: %d\n", + HIDDEN->c2framesize.w, HIDDEN->c2framesize.h); #endif /* don't stretch only slightly smaller/larger images */ @@ -740,8 +738,8 @@ HIDDEN->c2dsize.h -= zoom_aspect_y; #ifdef DIRECTFB_CRTC2_DEBUG - printf ("Stretched resolution: X: %d, Y: %d\n", - HIDDEN->c2dsize.w, HIDDEN->c2dsize.h); + printf("Stretched resolution: X: %d, Y: %d\n", + HIDDEN->c2dsize.w, HIDDEN->c2dsize.h); #endif HIDDEN->mga_crtc2_stretch = 1; @@ -759,14 +757,14 @@ } #ifdef DIRECTFB_CRTC2_DEBUG - printf ("Down-Stretched resolution: X: %d, Y: %d\n", - HIDDEN->c2dsize.w, HIDDEN->c2dsize.h); + printf("Down-Stretched resolution: X: %d, Y: %d\n", + HIDDEN->c2dsize.w, HIDDEN->c2dsize.h); #endif HIDDEN->mga_crtc2_stretch = 1; } else { #ifdef DIRECTFB_CRTC2_DEBUG - printf ("Not stretching image\n"); + printf("Not stretching image\n"); #endif } @@ -786,8 +784,8 @@ (HIDDEN->c2dsize.h - HIDDEN->c2framesize.h) / 2; #ifdef DIRECTFB_CRTC2_DEBUG - printf ("CRTC2 position X: %d, Y: %d\n", HIDDEN->c2dsize.x, - HIDDEN->c2dsize.y); + printf("CRTC2 position X: %d, Y: %d\n", HIDDEN->c2dsize.x, + HIDDEN->c2dsize.y); #endif } } @@ -796,7 +794,7 @@ } static int -DirectFB_AllocHWSurface (_THIS, SDL_Surface * surface) +DirectFB_AllocHWSurface(_THIS, SDL_Surface * surface) { DFBResult ret; DFBSurfaceDescription dsc; @@ -815,25 +813,25 @@ dsc.caps = (surface->flags & SDL_DOUBLEBUF) ? DSCAPS_FLIPPING : 0; /* find the right pixelformat */ - dsc.pixelformat = SDLToDFBPixelFormat (surface->format); + dsc.pixelformat = SDLToDFBPixelFormat(surface->format); if (dsc.pixelformat == DSPF_UNKNOWN) return -1; /* Allocate the hardware acceleration data */ surface->hwdata = - (struct private_hwdata *) SDL_calloc (1, sizeof (*surface->hwdata)); + (struct private_hwdata *) SDL_calloc(1, sizeof(*surface->hwdata)); if (surface->hwdata == NULL) { - SDL_OutOfMemory (); + SDL_OutOfMemory(); return -1; } /* Create the surface */ ret = - HIDDEN->dfb->CreateSurface (HIDDEN->dfb, &dsc, - &surface->hwdata->surface); + HIDDEN->dfb->CreateSurface(HIDDEN->dfb, &dsc, + &surface->hwdata->surface); if (ret) { - SetDirectFBerror ("dfb->CreateSurface", ret); - free (surface->hwdata); + SetDirectFBerror("dfb->CreateSurface", ret); + free(surface->hwdata); surface->hwdata = NULL; return -1; } @@ -844,17 +842,17 @@ } static void -DirectFB_FreeHWSurface (_THIS, SDL_Surface * surface) +DirectFB_FreeHWSurface(_THIS, SDL_Surface * surface) { if (surface->hwdata && HIDDEN->initialized) { - surface->hwdata->surface->Release (surface->hwdata->surface); - free (surface->hwdata); + surface->hwdata->surface->Release(surface->hwdata->surface); + free(surface->hwdata); surface->hwdata = NULL; } } static int -DirectFB_CheckHWBlit (_THIS, SDL_Surface * src, SDL_Surface * dst) +DirectFB_CheckHWBlit(_THIS, SDL_Surface * src, SDL_Surface * dst) { /* fprintf(stderr, "SDL: DirectFB_CheckHWBlit (src->hwdata: %p, dst->hwdata: %p)\n", src->hwdata, dst->hwdata); */ @@ -869,8 +867,8 @@ } static int -DirectFB_HWAccelBlit (SDL_Surface * src, SDL_Rect * srcrect, - SDL_Surface * dst, SDL_Rect * dstrect) +DirectFB_HWAccelBlit(SDL_Surface * src, SDL_Rect * srcrect, + SDL_Surface * dst, SDL_Rect * dstrect) { DFBSurfaceBlittingFlags flags = DSBLIT_NOFX; @@ -881,104 +879,104 @@ if (src->flags & SDL_SRCCOLORKEY) { flags |= DSBLIT_SRC_COLORKEY; - DirectFB_SetHWColorKey (NULL, src, src->format->colorkey); + DirectFB_SetHWColorKey(NULL, src, src->format->colorkey); } if (src->flags & SDL_SRCALPHA) { flags |= DSBLIT_BLEND_COLORALPHA; - surface->SetColor (surface, 0xff, 0xff, 0xff, src->format->alpha); + surface->SetColor(surface, 0xff, 0xff, 0xff, src->format->alpha); } - surface->SetBlittingFlags (surface, flags); + surface->SetBlittingFlags(surface, flags); if (sr.w == dr.w && sr.h == dr.h) - surface->Blit (surface, src->hwdata->surface, &sr, dr.x, dr.y); + surface->Blit(surface, src->hwdata->surface, &sr, dr.x, dr.y); else - surface->StretchBlit (surface, src->hwdata->surface, &sr, &dr); + surface->StretchBlit(surface, src->hwdata->surface, &sr, &dr); return 0; } static int -DirectFB_FillHWRect (_THIS, SDL_Surface * dst, SDL_Rect * dstrect, - Uint32 color) +DirectFB_FillHWRect(_THIS, SDL_Surface * dst, SDL_Rect * dstrect, + Uint32 color) { SDL_PixelFormat *fmt = dst->format; IDirectFBSurface *surface = dst->hwdata->surface; /* ugly */ - surface->SetColor (surface, - (color & fmt->Rmask) >> (fmt->Rshift - fmt->Rloss), - (color & fmt->Gmask) >> (fmt->Gshift - fmt->Gloss), - (color & fmt->Bmask) << (fmt->Bloss - fmt->Bshift), - 0xFF); - surface->FillRectangle (surface, dstrect->x, dstrect->y, dstrect->w, - dstrect->h); + surface->SetColor(surface, + (color & fmt->Rmask) >> (fmt->Rshift - fmt->Rloss), + (color & fmt->Gmask) >> (fmt->Gshift - fmt->Gloss), + (color & fmt->Bmask) << (fmt->Bloss - fmt->Bshift), + 0xFF); + surface->FillRectangle(surface, dstrect->x, dstrect->y, dstrect->w, + dstrect->h); return 0; } static int -DirectFB_SetHWColorKey (_THIS, SDL_Surface * src, Uint32 key) +DirectFB_SetHWColorKey(_THIS, SDL_Surface * src, Uint32 key) { SDL_PixelFormat *fmt = src->format; IDirectFBSurface *surface = src->hwdata->surface; if (fmt->BitsPerPixel == 8) - surface->SetSrcColorKeyIndex (surface, key); + surface->SetSrcColorKeyIndex(surface, key); else /* ugly */ - surface->SetSrcColorKey (surface, - (key & fmt->Rmask) >> (fmt->Rshift - - fmt->Rloss), - (key & fmt->Gmask) >> (fmt->Gshift - - fmt->Gloss), - (key & fmt->Bmask) << (fmt->Bloss - - fmt->Bshift)); + surface->SetSrcColorKey(surface, + (key & fmt->Rmask) >> (fmt->Rshift - + fmt->Rloss), + (key & fmt->Gmask) >> (fmt->Gshift - + fmt->Gloss), + (key & fmt->Bmask) << (fmt->Bloss - + fmt->Bshift)); return 0; } static int -DirectFB_SetHWAlpha (_THIS, SDL_Surface * surface, Uint8 alpha) +DirectFB_SetHWAlpha(_THIS, SDL_Surface * surface, Uint8 alpha) { return 0; } static int -DirectFB_FlipHWSurface (_THIS, SDL_Surface * surface) +DirectFB_FlipHWSurface(_THIS, SDL_Surface * surface) { if (HIDDEN->enable_mga_crtc2) { int rtn = - surface->hwdata->surface->Flip (surface->hwdata->surface, NULL, - 0); + surface->hwdata->surface->Flip(surface->hwdata->surface, NULL, + 0); if (HIDDEN->mga_crtc2_stretch) - HIDDEN->c2frame->StretchBlit (HIDDEN->c2frame, - surface->hwdata->surface, - &HIDDEN->c2ssize, &HIDDEN->c2dsize); + HIDDEN->c2frame->StretchBlit(HIDDEN->c2frame, + surface->hwdata->surface, + &HIDDEN->c2ssize, &HIDDEN->c2dsize); else - HIDDEN->c2frame->Blit (HIDDEN->c2frame, - surface->hwdata->surface, NULL, - HIDDEN->c2dsize.x, HIDDEN->c2dsize.y); + HIDDEN->c2frame->Blit(HIDDEN->c2frame, + surface->hwdata->surface, NULL, + HIDDEN->c2dsize.x, HIDDEN->c2dsize.y); - HIDDEN->c2frame->Flip (HIDDEN->c2frame, NULL, DSFLIP_WAITFORSYNC); + HIDDEN->c2frame->Flip(HIDDEN->c2frame, NULL, DSFLIP_WAITFORSYNC); return rtn; } else - return surface->hwdata->surface->Flip (surface->hwdata->surface, NULL, - DSFLIP_WAITFORSYNC); + return surface->hwdata->surface->Flip(surface->hwdata->surface, NULL, + DSFLIP_WAITFORSYNC); } static int -DirectFB_LockHWSurface (_THIS, SDL_Surface * surface) +DirectFB_LockHWSurface(_THIS, SDL_Surface * surface) { DFBResult ret; void *data; int pitch; - ret = surface->hwdata->surface->Lock (surface->hwdata->surface, - DSLF_WRITE, &data, &pitch); + ret = surface->hwdata->surface->Lock(surface->hwdata->surface, + DSLF_WRITE, &data, &pitch); if (ret) { - SetDirectFBerror ("surface->Lock", ret); + SetDirectFBerror("surface->Lock", ret); return -1; } @@ -989,31 +987,31 @@ } static void -DirectFB_UnlockHWSurface (_THIS, SDL_Surface * surface) +DirectFB_UnlockHWSurface(_THIS, SDL_Surface * surface) { - surface->hwdata->surface->Unlock (surface->hwdata->surface); + surface->hwdata->surface->Unlock(surface->hwdata->surface); surface->pixels = NULL; } static void -DirectFB_DirectUpdate (_THIS, int numrects, SDL_Rect * rects) +DirectFB_DirectUpdate(_THIS, int numrects, SDL_Rect * rects) { if (HIDDEN->enable_mga_crtc2) { if (HIDDEN->mga_crtc2_stretch) - HIDDEN->c2frame->StretchBlit (HIDDEN->c2frame, - this->screen->hwdata->surface, - &HIDDEN->c2ssize, &HIDDEN->c2dsize); + HIDDEN->c2frame->StretchBlit(HIDDEN->c2frame, + this->screen->hwdata->surface, + &HIDDEN->c2ssize, &HIDDEN->c2dsize); else - HIDDEN->c2frame->Blit (HIDDEN->c2frame, - this->screen->hwdata->surface, NULL, - HIDDEN->c2dsize.x, HIDDEN->c2dsize.y); + HIDDEN->c2frame->Blit(HIDDEN->c2frame, + this->screen->hwdata->surface, NULL, + HIDDEN->c2dsize.x, HIDDEN->c2dsize.y); - HIDDEN->c2frame->Flip (HIDDEN->c2frame, NULL, DSFLIP_WAITFORSYNC); + HIDDEN->c2frame->Flip(HIDDEN->c2frame, NULL, DSFLIP_WAITFORSYNC); } } static void -DirectFB_WindowedUpdate (_THIS, int numrects, SDL_Rect * rects) +DirectFB_WindowedUpdate(_THIS, int numrects, SDL_Rect * rects) { DFBRegion region; int i; @@ -1054,21 +1052,21 @@ if (region_valid) { if (HIDDEN->enable_mga_crtc2) { if (HIDDEN->mga_crtc2_stretch) - HIDDEN->c2frame->StretchBlit (HIDDEN->c2frame, surface, - &HIDDEN->c2ssize, - &HIDDEN->c2dsize); + HIDDEN->c2frame->StretchBlit(HIDDEN->c2frame, surface, + &HIDDEN->c2ssize, + &HIDDEN->c2dsize); else - HIDDEN->c2frame->Blit (HIDDEN->c2frame, surface, NULL, - HIDDEN->c2dsize.x, HIDDEN->c2dsize.y); + HIDDEN->c2frame->Blit(HIDDEN->c2frame, surface, NULL, + HIDDEN->c2dsize.x, HIDDEN->c2dsize.y); - HIDDEN->c2frame->Flip (HIDDEN->c2frame, NULL, DSFLIP_WAITFORSYNC); + HIDDEN->c2frame->Flip(HIDDEN->c2frame, NULL, DSFLIP_WAITFORSYNC); } else - surface->Flip (surface, ®ion, DSFLIP_WAITFORSYNC); + surface->Flip(surface, ®ion, DSFLIP_WAITFORSYNC); } } int -DirectFB_SetColors (_THIS, int firstcolor, int ncolors, SDL_Color * colors) +DirectFB_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color * colors) { IDirectFBPalette *palette = this->screen->hwdata->palette; @@ -1092,14 +1090,14 @@ entries[i].b = colors[i].b; } - palette->SetEntries (palette, entries, ncolors, firstcolor); + palette->SetEntries(palette, entries, ncolors, firstcolor); } return 1; } void -DirectFB_VideoQuit (_THIS) +DirectFB_VideoQuit(_THIS) { struct DirectFBEnumRect *rect = enumlist; @@ -1108,50 +1106,50 @@ IDirectFBPalette *palette = this->screen->hwdata->palette; if (palette) - palette->Release (palette); + palette->Release(palette); if (surface) - surface->Release (surface); + surface->Release(surface); this->screen->hwdata->surface = NULL; this->screen->hwdata->palette = NULL; } if (HIDDEN->c2frame) { - HIDDEN->c2frame->Release (HIDDEN->c2frame); + HIDDEN->c2frame->Release(HIDDEN->c2frame); HIDDEN->c2frame = NULL; } if (HIDDEN->eventbuffer) { - HIDDEN->eventbuffer->Release (HIDDEN->eventbuffer); + HIDDEN->eventbuffer->Release(HIDDEN->eventbuffer); HIDDEN->eventbuffer = NULL; } if (HIDDEN->c2layer) { - HIDDEN->c2layer->Release (HIDDEN->c2layer); + HIDDEN->c2layer->Release(HIDDEN->c2layer); HIDDEN->c2layer = NULL; } if (HIDDEN->layer) { - HIDDEN->layer->Release (HIDDEN->layer); + HIDDEN->layer->Release(HIDDEN->layer); HIDDEN->layer = NULL; } if (HIDDEN->dfb) { - HIDDEN->dfb->Release (HIDDEN->dfb); + HIDDEN->dfb->Release(HIDDEN->dfb); HIDDEN->dfb = NULL; } /* Free video mode list */ if (HIDDEN->modelist) { - free (HIDDEN->modelist); + free(HIDDEN->modelist); HIDDEN->modelist = NULL; } /* Free mode enumeration list */ while (rect) { struct DirectFBEnumRect *next = rect->next; - free (rect); + free(rect); rect = next; } enumlist = NULL; @@ -1161,19 +1159,19 @@ int -DirectFB_ShowWMCursor (_THIS, WMcursor * cursor) +DirectFB_ShowWMCursor(_THIS, WMcursor * cursor) { /* We can only hide or show the default cursor */ if (cursor == NULL) { - HIDDEN->layer->SetCursorOpacity (HIDDEN->layer, 0x00); + HIDDEN->layer->SetCursorOpacity(HIDDEN->layer, 0x00); } else { - HIDDEN->layer->SetCursorOpacity (HIDDEN->layer, 0xFF); + HIDDEN->layer->SetCursorOpacity(HIDDEN->layer, 0xFF); } return 1; } void -DirectFB_FinalQuit (void) +DirectFB_FinalQuit(void) { }