From 78ddc70680c541f2ff970000a361dd94b97414a6 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 1 Nov 2001 16:21:40 +0000 Subject: [PATCH] Updated SDL DirectFB backend for DirectFB version 0.9.7 --- configure.in | 2 +- src/video/directfb/SDL_DirectFB_video.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/configure.in b/configure.in index cbff749c5..2eeef8618 100644 --- a/configure.in +++ b/configure.in @@ -704,7 +704,7 @@ CheckDirectFB() AC_MSG_ERROR([*** pkg-config too old; version 0.5 or better required.]) fi - DIRECTFB_REQUIRED_VERSION=0.9.5 + DIRECTFB_REQUIRED_VERSION=0.9.7 if $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb ; then DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb` diff --git a/src/video/directfb/SDL_DirectFB_video.c b/src/video/directfb/SDL_DirectFB_video.c index 235a8ce9e..947f0557f 100644 --- a/src/video/directfb/SDL_DirectFB_video.c +++ b/src/video/directfb/SDL_DirectFB_video.c @@ -601,7 +601,7 @@ static int DirectFB_HWAccelBlit(SDL_Surface *src, SDL_Rect *srcrect, if (src->flags & SDL_SRCCOLORKEY) { flags |= DSBLIT_SRC_COLORKEY; - surface->SetSrcColorKey (surface, src->format->colorkey); + DirectFB_SetHWColorKey (NULL, src, src->format->colorkey); } if (src->flags & SDL_SRCALPHA) @@ -635,8 +635,17 @@ static int DirectFB_FillHWRect(_THIS, SDL_Surface *dst, SDL_Rect *dstrect, Uint3 return 0; } -static int DirectFB_SetHWColorKey(_THIS, SDL_Surface *surface, Uint32 key) +static int DirectFB_SetHWColorKey(_THIS, SDL_Surface *src, Uint32 key) { + SDL_PixelFormat *fmt = src->format; + IDirectFBSurface *surface = src->hwdata->surface; + + /* 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)); + return 0; }