Date: Wed, 15 Aug 2007 01:08:38 +0200
From: Couriersud Subject: Some SDL1.3 patches Modified UpdateTexture to lock and unlock DirectFB-Surface. --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402603
This commit is contained in:
parent
e00aa0f597
commit
8dd6b2373b
1 changed files with 22 additions and 18 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue