SDL_LockSurface / SDL_UnlockSurface

Hi All,

I don’t understand the semantic of SDL_LockSurface / SDL_UnlockSurface.

When I lock a surface, does it prevent other threads fom reading and writing of that surface?
Or does SDL_LockSurface / SDL_UnlockSurface define a critical section?

Completely unclear is the use of nested lock and unlock calls.

Thanks

–Armin______________________________________________________________________________
Mit WEB.DE iNews werden Sie ?ber die Ergebnisse der wichtigsten WM-Begegnungen
per SMS informiert: http://freemail.web.de/features/inews.htm/?mc=021202

It does nothing of the sort :wink: It has nothing to do with threading.

When you call SDL_LockSurface if the surface was on your graphics card
memory, its contents will be copied into system memory, so you can modify it
normally, through surface->pixels.

SDL_UnlockSurface copies the surface back to the hardware when you are done.
You cannot do blits while a surface is locked.On 6/28/06, Armin Steinhoff wrote:

Hi All,

I don’t understand the semantic of SDL_LockSurface / SDL_UnlockSurface.

Thanks

–Armin

Hi Brian,

… lot of things are now clearer :slight_smile:

Thanks

–Armin

“Brian Barrett” <brian.ripoff at gmail.com> schrieb am 28.06.2006 13:45:46:> It does nothing of the sort :wink: It has nothing to do with threading.

When you call SDL_LockSurface if the surface was on your graphics card memory, its contents will be copied into system memory, so you can modify it normally, through surface->pixels.

SDL_UnlockSurface copies the surface back to the hardware when you are done. You cannot do blits while a surface is locked.

On 6/28/06, Armin Steinhoff wrote:
Hi All,

I don’t understand the semantic of SDL_LockSurface / SDL_UnlockSurface.

Thanks

–Armin



SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Erweitern Sie FreeMail zu einem noch leistungsst?rkeren E-Mail-Postfach!
Mehr Infos unter http://freemail.web.de/home/landingpad/?mc=021131