Fixes a bug in SDL_UpdateTexture when using SDL_RENDERER_SOFTWARE and texture access is SDL_TEXTUREACCESS_STATIC

This commit is contained in:
Dimitris Zenios 2011-06-10 12:13:06 +03:00
parent 2fdcb7bdfc
commit b43aca329d

View file

@ -240,6 +240,8 @@ SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
int row; int row;
size_t length; size_t length;
if(SDL_MUSTLOCK(surface))
SDL_LockSurface(surface);
src = (Uint8 *) pixels; src = (Uint8 *) pixels;
dst = (Uint8 *) surface->pixels + dst = (Uint8 *) surface->pixels +
rect->y * surface->pitch + rect->y * surface->pitch +
@ -250,6 +252,8 @@ SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
src += pitch; src += pitch;
dst += surface->pitch; dst += surface->pitch;
} }
if(SDL_MUSTLOCK(surface))
SDL_UnlockSurface(surface);
return 0; return 0;
} }