hedgewars/uMisc.pas
changeset 754 94ac14829085
parent 753 40fc0deb388f
child 755 edf26e9554ac
--- a/hedgewars/uMisc.pas	Fri Jan 25 20:47:50 2008 +0000
+++ b/hedgewars/uMisc.pas	Fri Jan 25 21:55:48 2008 +0000
@@ -258,6 +258,9 @@
 var mode: LongInt;
     texId: GLuint;
 begin
+if SDL_MustLock(surf) then
+   SDLTry(SDL_LockSurface(surf) >= 0, true);
+
 if (surf^.format^.BytesPerPixel = 3) then mode:= GL_RGB else
 if (surf^.format^.BytesPerPixel = 4) then mode:= GL_RGBA else
    begin
@@ -272,6 +275,9 @@
 
 glTexImage2D(GL_TEXTURE_2D, 0, mode, surf^.w, surf^.h, 0, mode, GL_UNSIGNED_BYTE, surf^.pixels);
 
+if SDL_MustLock(surf) then
+   SDL_UnlockSurface(surf);
+
 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);