# HG changeset patch # User Sam Lantinga # Date 1230656573 0 # Node ID 8acbb14124c592e1b906e1bca418160e2764b490 # Parent 81fc47035302ce0f8cd946d8a5494e64591258a9 Date: Mon, 29 Dec 2008 23:29:52 +0100 From: Couriersud I have attached the latest DirectFB changes. diff -r 81fc47035302 -r 8acbb14124c5 src/video/directfb/SDL_DirectFB_render.c --- a/src/video/directfb/SDL_DirectFB_render.c Tue Dec 30 17:02:06 2008 +0000 +++ b/src/video/directfb/SDL_DirectFB_render.c Tue Dec 30 17:02:53 2008 +0000 @@ -205,9 +205,10 @@ case SDL_BLENDMODE_ADD: data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL; data->drawFlags = DSDRAW_BLEND; - //FIXME: SRCALPHA kills performance on radeon ... - //Eventually use a premultiplied texture - if (0 && TextureHasAlpha(source)) + // FIXME: SRCALPHA kills performance on radeon ... + // It will be cheaper to copy the surface to + // a temporay surface and premultiply + if (source && TextureHasAlpha(source)) data->surface->SetSrcBlendFunction(data->surface, DSBF_SRCALPHA); else @@ -713,15 +714,15 @@ Uint8 *src, *dst; int row; size_t length; + int bpp = DFB_BYTES_PER_PIXEL(SDLToDFBPixelFormat(texture->format)); + // FIXME: SDL_BYTESPERPIXEL(texture->format) broken for yuv yv12 3 planes SDL_DFB_CHECKERR(data->surface->Lock(data->surface, DSLF_WRITE | DSLF_READ, ((void **) &dpixels), &dpitch)); src = (Uint8 *) pixels; - dst = - (Uint8 *) dpixels + rect->y * dpitch + - rect->x * SDL_BYTESPERPIXEL(texture->format); - length = rect->w * SDL_BYTESPERPIXEL(texture->format); + dst = (Uint8 *) dpixels + rect->y * dpitch + rect->x * bpp; + length = rect->w * bpp; for (row = 0; row < rect->h; ++row) { SDL_memcpy(dst, src, length); src += pitch; @@ -836,7 +837,7 @@ DFBResult ret; PrepareDraw(renderer); - SDL_DFB_CHECKERR(data->surface->DrawPoint(data->surface, x, y)); + SDL_DFB_CHECKERR(data->surface->DrawLine(data->surface, x, y, x, y)); return 0; error: return -1; @@ -849,6 +850,11 @@ DFBResult ret; PrepareDraw(renderer); + /* Use antialiasing when available */ +#if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) + SDL_DFB_CHECKERR(data->surface->SetRenderOptions(data->surface, + DSRO_ANTIALIAS)); +#endif SDL_DFB_CHECKERR(data->surface->DrawLine(data->surface, x1, y1, x2, y2)); return 0; error: