changeset 219:f928da36f0e9

Updated SDL DirectFB backend for DirectFB version 0.9.7
author Sam Lantinga <slouken@libsdl.org>
date Thu, 01 Nov 2001 16:21:40 +0000
parents 91a5db3e930a
children 7861d904fb77
files configure.in src/video/directfb/SDL_DirectFB_video.c
diffstat 2 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Fri Oct 26 14:51:22 2001 +0000
+++ b/configure.in	Thu Nov 01 16:21:40 2001 +0000
@@ -704,7 +704,7 @@
                 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`
--- a/src/video/directfb/SDL_DirectFB_video.c	Fri Oct 26 14:51:22 2001 +0000
+++ b/src/video/directfb/SDL_DirectFB_video.c	Thu Nov 01 16:21:40 2001 +0000
@@ -601,7 +601,7 @@
   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 @@
   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;
 }