mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-08-27 17:11:37 +00:00
SDL_MUSTLOCK() returns true once a surface has the RLE flag set
This more closely matches the mental model of people using SDL, and locking a surface that isn't RLE encoded doesn't cause any issues. Fixes https://github.com/libsdl-org/SDL/issues/5594
This commit is contained in:
@@ -46,7 +46,7 @@ SDL_bool SDL_SurfaceValid(SDL_Surface *surface)
|
||||
|
||||
void SDL_UpdateSurfaceLockFlag(SDL_Surface *surface)
|
||||
{
|
||||
if (surface->internal->flags & SDL_INTERNAL_SURFACE_RLEACCEL) {
|
||||
if (SDL_SurfaceHasRLE(surface)) {
|
||||
surface->flags |= SDL_SURFACE_LOCK_NEEDED;
|
||||
} else {
|
||||
surface->flags &= ~SDL_SURFACE_LOCK_NEEDED;
|
||||
@@ -460,6 +460,7 @@ int SDL_SetSurfaceRLE(SDL_Surface *surface, SDL_bool enabled)
|
||||
if (surface->internal->map.info.flags != flags) {
|
||||
SDL_InvalidateMap(&surface->internal->map);
|
||||
}
|
||||
SDL_UpdateSurfaceLockFlag(surface);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1250,7 +1251,6 @@ int SDL_LockSurface(SDL_Surface *surface)
|
||||
if (surface->internal->flags & SDL_INTERNAL_SURFACE_RLEACCEL) {
|
||||
SDL_UnRLESurface(surface, SDL_TRUE);
|
||||
surface->internal->flags |= SDL_INTERNAL_SURFACE_RLEACCEL; /* save accel'd state */
|
||||
SDL_UpdateSurfaceLockFlag(surface);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user