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

Commit

Permalink
Date: Wed, 15 Aug 2007 01:08:38 +0200
Browse files Browse the repository at this point in the history
From: Couriersud
Subject: Some SDL1.3 patches

Modified UpdateTexture to lock and unlock DirectFB-Surface.
  • Loading branch information
slouken committed Aug 15, 2007
1 parent ecd59a2 commit b7053fa
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions src/video/directfb/SDL_DirectFB_render.c
Expand Up @@ -505,27 +505,31 @@ DirectFB_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata;
DirectFB_RenderData *renderdata =
(DirectFB_RenderData *) renderer->driverdata;
DFBResult ret;
Uint8 *dpixels;
int dpitch;
Uint8 *src, *dst;
int row;
size_t length;

if (data->pixels) {
Uint8 *src, *dst;
int row;
size_t length;

src = (Uint8 *) pixels;
dst =
(Uint8 *) data->pixels + rect->y * data->pitch +
rect->x * SDL_BYTESPERPIXEL(texture->format);
length = rect->w * SDL_BYTESPERPIXEL(texture->format);
for (row = 0; row < rect->h; ++row) {
SDL_memcpy(dst, src, length);
src += pitch;
dst += data->pitch;
}
} else {
SDL_SetError("FIXME: Update without lock!\n");
return -1;
SDL_DFB_CHECKERR(data->surface->Lock(data->surface,
DSLF_WRITE | DSLF_READ, &dpixels,
&dpitch));
src = (Uint8 *) pixels;
dst =
(Uint8 *) dpixels + rect->y * dpitch +
rect->x * SDL_BYTESPERPIXEL(texture->format);
length = rect->w * SDL_BYTESPERPIXEL(texture->format);
for (row = 0; row < rect->h; ++row) {
SDL_memcpy(dst, src, length);
src += pitch;
dst += dpitch;
}
SDL_DFB_CHECKERR(data->surface->Unlock(data->surface) );
return 0;
error:
return 1;

}

static int
Expand Down

0 comments on commit b7053fa

Please sign in to comment.