Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Date: Mon, 29 Dec 2008 23:29:52 +0100
Browse files Browse the repository at this point in the history
From: Couriersud

I have attached the latest DirectFB changes.
  • Loading branch information
slouken committed Dec 30, 2008
1 parent a158763 commit 7c8ad93
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/video/directfb/SDL_DirectFB_render.c
Expand Up @@ -205,9 +205,10 @@ SetBlendMode(DirectFB_RenderData * data, int blendMode,
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
Expand Down Expand Up @@ -713,15 +714,15 @@ DirectFB_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
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;
Expand Down Expand Up @@ -836,7 +837,7 @@ DirectFB_RenderPoint(SDL_Renderer * renderer, int x, int y)
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;
Expand All @@ -849,6 +850,11 @@ DirectFB_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2)
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:
Expand Down

0 comments on commit 7c8ad93

Please sign in to comment.