Date: Mon, 29 Dec 2008 23:29:52 +0100
authorSam Lantinga <slouken@libsdl.org>
Tue, 30 Dec 2008 17:02:53 +0000
changeset 29308acbb14124c5
parent 2929 81fc47035302
child 2931 e705adf6f3dc
Date: Mon, 29 Dec 2008 23:29:52 +0100
From: Couriersud

I have attached the latest DirectFB changes.
src/video/directfb/SDL_DirectFB_render.c
     1.1 --- a/src/video/directfb/SDL_DirectFB_render.c	Tue Dec 30 17:02:06 2008 +0000
     1.2 +++ b/src/video/directfb/SDL_DirectFB_render.c	Tue Dec 30 17:02:53 2008 +0000
     1.3 @@ -205,9 +205,10 @@
     1.4          case SDL_BLENDMODE_ADD:
     1.5              data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL;
     1.6              data->drawFlags = DSDRAW_BLEND;
     1.7 -            //FIXME: SRCALPHA kills performance on radeon ...
     1.8 -            //Eventually use a premultiplied texture
     1.9 -            if (0 && TextureHasAlpha(source))
    1.10 +            // FIXME: SRCALPHA kills performance on radeon ...
    1.11 +            // It will be cheaper to copy the surface to
    1.12 +            // a temporay surface and premultiply 
    1.13 +            if (source && TextureHasAlpha(source))
    1.14                  data->surface->SetSrcBlendFunction(data->surface,
    1.15                                                     DSBF_SRCALPHA);
    1.16              else
    1.17 @@ -713,15 +714,15 @@
    1.18      Uint8 *src, *dst;
    1.19      int row;
    1.20      size_t length;
    1.21 +    int bpp = DFB_BYTES_PER_PIXEL(SDLToDFBPixelFormat(texture->format));
    1.22 +    // FIXME: SDL_BYTESPERPIXEL(texture->format) broken for yuv yv12 3 planes
    1.23  
    1.24      SDL_DFB_CHECKERR(data->surface->Lock(data->surface,
    1.25                                           DSLF_WRITE | DSLF_READ,
    1.26                                           ((void **) &dpixels), &dpitch));
    1.27      src = (Uint8 *) pixels;
    1.28 -    dst =
    1.29 -        (Uint8 *) dpixels + rect->y * dpitch +
    1.30 -        rect->x * SDL_BYTESPERPIXEL(texture->format);
    1.31 -    length = rect->w * SDL_BYTESPERPIXEL(texture->format);
    1.32 +    dst = (Uint8 *) dpixels + rect->y * dpitch + rect->x * bpp;
    1.33 +    length = rect->w * bpp;
    1.34      for (row = 0; row < rect->h; ++row) {
    1.35          SDL_memcpy(dst, src, length);
    1.36          src += pitch;
    1.37 @@ -836,7 +837,7 @@
    1.38      DFBResult ret;
    1.39  
    1.40      PrepareDraw(renderer);
    1.41 -    SDL_DFB_CHECKERR(data->surface->DrawPoint(data->surface, x, y));
    1.42 +    SDL_DFB_CHECKERR(data->surface->DrawLine(data->surface, x, y, x, y));
    1.43      return 0;
    1.44    error:
    1.45      return -1;
    1.46 @@ -849,6 +850,11 @@
    1.47      DFBResult ret;
    1.48  
    1.49      PrepareDraw(renderer);
    1.50 +    /* Use antialiasing when available */
    1.51 +#if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2)
    1.52 +    SDL_DFB_CHECKERR(data->surface->SetRenderOptions(data->surface,
    1.53 +                                                     DSRO_ANTIALIAS));
    1.54 +#endif
    1.55      SDL_DFB_CHECKERR(data->surface->DrawLine(data->surface, x1, y1, x2, y2));
    1.56      return 0;
    1.57    error: