Mercurial > sdl-ios-xcode
changeset 3037:490f3e4fe753
Added DFB_VERSION_ATLEAST macro
First attempt at replacing MakeSubSurface for pre 1.2.0 ==> Scaling not yet working
author | Couriersud <couriersud@arcor.de> |
---|---|
date | Tue, 13 Jan 2009 21:17:38 +0000 |
parents | 76a1692fcec5 |
children | c73a5f8a03d2 |
files | src/video/directfb/SDL_DirectFB_events.c src/video/directfb/SDL_DirectFB_modes.c src/video/directfb/SDL_DirectFB_render.c src/video/directfb/SDL_DirectFB_video.h src/video/directfb/SDL_DirectFB_window.c |
diffstat | 5 files changed, 39 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/src/video/directfb/SDL_DirectFB_events.c Tue Jan 13 19:31:06 2009 +0000 +++ b/src/video/directfb/SDL_DirectFB_events.c Tue Jan 13 21:17:38 2009 +0000 @@ -48,7 +48,7 @@ static void DirectFB_SetContext(_THIS, SDL_WindowID id) { -#if (DIRECTFB_MAJOR_VERSION >= 1) +#if (DFB_VERSION_ATLEAST(1,0,0)) /* FIXME: does not work on 1.0/1.2 with radeon driver * the approach did work with the matrox driver * This has simply no effect.
--- a/src/video/directfb/SDL_DirectFB_modes.c Tue Jan 13 19:31:06 2009 +0000 +++ b/src/video/directfb/SDL_DirectFB_modes.c Tue Jan 13 21:17:38 2009 +0000 @@ -335,7 +335,7 @@ display.current_mode = mode; display.driverdata = dispdata; -#if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) +#if (DFB_VERSION_ATLEAST(1,2,0)) dlc.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT | DLCONF_OPTIONS; @@ -438,7 +438,7 @@ SDL_DFB_DEBUG("Trace\n"); config.flags &= ~fail; SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config)); -#if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) +#if (DFB_VERSION_ATLEAST(1,2,0)) /* Need to call this twice ! */ SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config)); #endif
--- a/src/video/directfb/SDL_DirectFB_render.c Tue Jan 13 19:31:06 2009 +0000 +++ b/src/video/directfb/SDL_DirectFB_render.c Tue Jan 13 21:17:38 2009 +0000 @@ -140,7 +140,7 @@ IDirectFBPalette *palette; SDL_VideoDisplay *display; SDL_DirtyRectList dirty; -#if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) +#if (DFB_VERSION_ATLEAST(1,2,0)) DFBSurfaceRenderOptions render_options; #endif } DirectFB_TextureData; @@ -387,7 +387,7 @@ case SDL_PIXELFORMAT_INDEX4MSB: return DSPF_UNKNOWN; case SDL_PIXELFORMAT_RGB444: -#if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) +#if (DFB_VERSION_ATLEAST(1,2,0)) return DSPF_RGB444; #else return DSPF_UNKNOWN; @@ -543,7 +543,7 @@ } } -#if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) +#if (DFB_VERSION_ATLEAST(1,2,0)) data->render_options = DSRO_NONE; #endif @@ -673,7 +673,7 @@ static int DirectFB_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture) { -#if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) +#if (DFB_VERSION_ATLEAST(1,2,0)) DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata; @@ -847,7 +847,7 @@ PrepareDraw(renderer); /* Use antialiasing when available */ -#if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) +#if (DFB_VERSION_ATLEAST(1,2,0)) SDL_DFB_CHECKERR(data->surface->SetRenderOptions(data->surface, DSRO_ANTIALIAS)); #endif @@ -961,7 +961,7 @@ data->blitFlags | flags)); -#if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) +#if (DFB_VERSION_ATLEAST(1,2,0)) SDL_DFB_CHECKERR(data->surface->SetRenderOptions(data->surface, texturedata-> render_options));
--- a/src/video/directfb/SDL_DirectFB_video.h Tue Jan 13 19:31:06 2009 +0000 +++ b/src/video/directfb/SDL_DirectFB_video.h Tue Jan 13 21:17:38 2009 +0000 @@ -34,13 +34,20 @@ #define DEBUG 0 #define LOG_CHANNEL stdout -#if (DIRECTFB_MAJOR_VERSION < 1) -#error "SDL_DIRECTFB: Please compile against libdirectfb version >= 1.0.0" -#endif +#define DFB_VERSIONNUM(X, Y, Z) \ + ((X)*1000 + (Y)*100 + (Z)) + +#define DFB_COMPILEDVERSION \ + DFB_VERSIONNUM(DIRECTFB_MAJOR_VERSION, DIRECTFB_MINOR_VERSION, DIRECTFB_MICRO_VERSION) -#if (DIRECTFB_MAJOR_VERSION >= 1) && (DIRECTFB_MINOR_VERSION >= 0) && (DIRECTFB_MICRO_VERSION >= 0 ) -#define SDL_DIRECTFB_OPENGL 1 -#include <directfbgl.h> +#define DFB_VERSION_ATLEAST(X, Y, Z) \ + (DFB_COMPILEDVERSION >= DFB_VERSIONNUM(X, Y, Z)) + +#if (DFB_VERSION_ATLEAST(1,0,0)) + #define SDL_DIRECTFB_OPENGL 1 + #include <directfbgl.h> +#else + #error "SDL_DIRECTFB: Please compile against libdirectfb version >= 1.0.0" #endif #if SDL_DIRECTFB_OPENGL
--- a/src/video/directfb/SDL_DirectFB_window.c Tue Jan 13 19:31:06 2009 +0000 +++ b/src/video/directfb/SDL_DirectFB_window.c Tue Jan 13 21:17:38 2009 +0000 @@ -420,14 +420,28 @@ } if (adjust) { - SDL_DFB_CHECKERR(windata->window->ResizeSurface(windata->window, +#if DFB_VERSION_ATLEAST(1,2,0) + SDL_DFB_CHECKERR(windata->window->ResizeSurface(windata->window, windata->size.w, windata->size.h)); - SDL_DFB_CHECKERR(windata->surface->MakeSubSurface(windata->surface, + SDL_DFB_CHECKERR(windata->surface->MakeSubSurface(windata->surface, windata-> window_surface, &windata->client)); - DirectFB_WM_RedrawLayout(window); +#else + /* recreate subsurface */ + windata->surface->ReleaseSource(windata->surface); + windata->window_surface->ReleaseSource(windata->window_surface); + SDL_DFB_RELEASE(windata->surface); + windata->surface = NULL; + SDL_DFB_CHECKERR(windata->window->ResizeSurface(windata->window, + windata->size.w, + windata->size.h)); + SDL_DFB_CHECKERR(windata->window_surface-> + GetSubSurface(windata->window_surface, &windata->client, + &windata->surface)); +#endif + DirectFB_WM_RedrawLayout(window); } error: return;