Commit eeeee885 authored by Couriersud's avatar Couriersud

Added DFB_VERSION_ATLEAST macro

First attempt at replacing MakeSubSurface for pre 1.2.0 ==> Scaling not yet working

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403499
parent 4907b7e6
...@@ -48,7 +48,7 @@ static int DirectFB_TranslateButton(DFBInputDeviceButtonIdentifier button); ...@@ -48,7 +48,7 @@ static int DirectFB_TranslateButton(DFBInputDeviceButtonIdentifier button);
static void static void
DirectFB_SetContext(_THIS, SDL_WindowID id) 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 /* FIXME: does not work on 1.0/1.2 with radeon driver
* the approach did work with the matrox driver * the approach did work with the matrox driver
* This has simply no effect. * This has simply no effect.
......
...@@ -335,7 +335,7 @@ DirectFB_InitModes(_THIS) ...@@ -335,7 +335,7 @@ DirectFB_InitModes(_THIS)
display.current_mode = mode; display.current_mode = mode;
display.driverdata = dispdata; display.driverdata = dispdata;
#if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) #if (DFB_VERSION_ATLEAST(1,2,0))
dlc.flags = dlc.flags =
DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT | DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT |
DLCONF_OPTIONS; DLCONF_OPTIONS;
...@@ -438,7 +438,7 @@ DirectFB_SetDisplayMode(_THIS, SDL_DisplayMode * mode) ...@@ -438,7 +438,7 @@ DirectFB_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
SDL_DFB_DEBUG("Trace\n"); SDL_DFB_DEBUG("Trace\n");
config.flags &= ~fail; config.flags &= ~fail;
SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config)); 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 ! */ /* Need to call this twice ! */
SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config)); SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config));
#endif #endif
......
...@@ -140,7 +140,7 @@ typedef struct ...@@ -140,7 +140,7 @@ typedef struct
IDirectFBPalette *palette; IDirectFBPalette *palette;
SDL_VideoDisplay *display; SDL_VideoDisplay *display;
SDL_DirtyRectList dirty; SDL_DirtyRectList dirty;
#if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) #if (DFB_VERSION_ATLEAST(1,2,0))
DFBSurfaceRenderOptions render_options; DFBSurfaceRenderOptions render_options;
#endif #endif
} DirectFB_TextureData; } DirectFB_TextureData;
...@@ -387,7 +387,7 @@ SDLToDFBPixelFormat(Uint32 format) ...@@ -387,7 +387,7 @@ SDLToDFBPixelFormat(Uint32 format)
case SDL_PIXELFORMAT_INDEX4MSB: case SDL_PIXELFORMAT_INDEX4MSB:
return DSPF_UNKNOWN; return DSPF_UNKNOWN;
case SDL_PIXELFORMAT_RGB444: case SDL_PIXELFORMAT_RGB444:
#if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) #if (DFB_VERSION_ATLEAST(1,2,0))
return DSPF_RGB444; return DSPF_RGB444;
#else #else
return DSPF_UNKNOWN; return DSPF_UNKNOWN;
...@@ -543,7 +543,7 @@ DirectFB_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -543,7 +543,7 @@ DirectFB_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
} }
} }
#if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) #if (DFB_VERSION_ATLEAST(1,2,0))
data->render_options = DSRO_NONE; data->render_options = DSRO_NONE;
#endif #endif
...@@ -673,7 +673,7 @@ DirectFB_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -673,7 +673,7 @@ DirectFB_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture)
static int static int
DirectFB_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture) 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; DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata;
...@@ -847,7 +847,7 @@ DirectFB_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2) ...@@ -847,7 +847,7 @@ DirectFB_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2)
PrepareDraw(renderer); PrepareDraw(renderer);
/* Use antialiasing when available */ /* 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, SDL_DFB_CHECKERR(data->surface->SetRenderOptions(data->surface,
DSRO_ANTIALIAS)); DSRO_ANTIALIAS));
#endif #endif
...@@ -961,7 +961,7 @@ DirectFB_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -961,7 +961,7 @@ DirectFB_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
data->blitFlags data->blitFlags
| flags)); | 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, SDL_DFB_CHECKERR(data->surface->SetRenderOptions(data->surface,
texturedata-> texturedata->
render_options)); render_options));
......
...@@ -34,13 +34,20 @@ ...@@ -34,13 +34,20 @@
#define DEBUG 0 #define DEBUG 0
#define LOG_CHANNEL stdout #define LOG_CHANNEL stdout
#if (DIRECTFB_MAJOR_VERSION < 1) #define DFB_VERSIONNUM(X, Y, Z) \
#error "SDL_DIRECTFB: Please compile against libdirectfb version >= 1.0.0" ((X)*1000 + (Y)*100 + (Z))
#endif
#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 DFB_VERSION_ATLEAST(X, Y, Z) \
#define SDL_DIRECTFB_OPENGL 1 (DFB_COMPILEDVERSION >= DFB_VERSIONNUM(X, Y, Z))
#include <directfbgl.h>
#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 #endif
#if SDL_DIRECTFB_OPENGL #if SDL_DIRECTFB_OPENGL
......
...@@ -420,14 +420,28 @@ DirectFB_AdjustWindowSurface(SDL_Window * window) ...@@ -420,14 +420,28 @@ DirectFB_AdjustWindowSurface(SDL_Window * window)
} }
if (adjust) { 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.w,
windata->size.h)); windata->size.h));
SDL_DFB_CHECKERR(windata->surface->MakeSubSurface(windata->surface, SDL_DFB_CHECKERR(windata->surface->MakeSubSurface(windata->surface,
windata-> windata->
window_surface, window_surface,
&windata->client)); &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: error:
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment