Removed unnecessary locks

This commit is contained in:
Stephan Sundermann committed 2012-03-16 16:53:41 +01:00
1 parent 73132f3932
commit 92a84f62f1
1 file changed
+6 -11
+6 -11
View File
@@ -764,17 +764,18 @@ namespace Vocaluxe.Lib.Draw
rect.Data.Position += rect.Pitch; rect.Data.Position += rect.Pitch;
} }
t.UnlockRectangle(0); t.UnlockRectangle(0);
_D3DTextures.Add(t);
bmp2.Dispose(); bmp2.Dispose();
bmp_data = null; bmp_data = null;
// Add to Texture List // Add to Texture List
texture.index = _D3DTextures.Count - 1;
texture.color = new SColorF(1f, 1f, 1f, 1f); texture.color = new SColorF(1f, 1f, 1f, 1f);
texture.rect = new SRectF(0f, 0f, texture.width, texture.height, 0f); texture.rect = new SRectF(0f, 0f, texture.width, texture.height, 0f);
texture.TexturePath = String.Empty; texture.TexturePath = String.Empty;
lock (MutexTexture) lock (MutexTexture)
{ {
_D3DTextures.Add(t);
texture.index = _D3DTextures.Count - 1;
_Textures.Add(texture); _Textures.Add(texture);
} }
@@ -809,7 +810,7 @@ namespace Vocaluxe.Lib.Draw
lock (MutexTexture) lock (MutexTexture)
{ {
_D3DTextures.Add(null); //_D3DTextures.Add(transparentTexture); _D3DTextures.Add(null);
texture.index = _D3DTextures.Count - 1; texture.index = _D3DTextures.Count - 1;
queque.ID = texture.index; queque.ID = texture.index;
_Queque.Add(queque); _Queque.Add(queque);
@@ -838,15 +839,15 @@ namespace Vocaluxe.Lib.Draw
rect.Data.Position += rect.Pitch; rect.Data.Position += rect.Pitch;
} }
t.UnlockRectangle(0); t.UnlockRectangle(0);
_D3DTextures.Add(t);
texture.index = _D3DTextures.Count - 1;
texture.color = new SColorF(1f, 1f, 1f, 1f); texture.color = new SColorF(1f, 1f, 1f, 1f);
texture.rect = new SRectF(0f, 0f, texture.width, texture.height, 0f); texture.rect = new SRectF(0f, 0f, texture.width, texture.height, 0f);
texture.TexturePath = String.Empty; texture.TexturePath = String.Empty;
lock (MutexTexture) lock (MutexTexture)
{ {
_D3DTextures.Add(t);
texture.index = _D3DTextures.Count - 1;
_Textures.Add(texture); _Textures.Add(texture);
} }
return texture; return texture;
@@ -873,8 +874,6 @@ namespace Vocaluxe.Lib.Draw
/// <param name="Data">A byte array containing the new texture's data</param> /// <param name="Data">A byte array containing the new texture's data</param>
/// <returns>True if succeeded</returns> /// <returns>True if succeeded</returns>
public bool UpdateTexture(ref STexture Texture, ref byte[] Data) public bool UpdateTexture(ref STexture Texture, ref byte[] Data)
{
lock (MutexTexture)
{ {
if ((Texture.index >= 0) && (_Textures.Count > 0) && (_D3DTextures.Count > Texture.index) && _TextureExists(ref Texture)) if ((Texture.index >= 0) && (_Textures.Count > 0) && (_D3DTextures.Count > Texture.index) && _TextureExists(ref Texture))
{ {
@@ -895,7 +894,6 @@ namespace Vocaluxe.Lib.Draw
else else
return false; return false;
} }
}
/// <summary> /// <summary>
/// Checks if a texture exists /// Checks if a texture exists
@@ -1380,12 +1378,9 @@ namespace Vocaluxe.Lib.Draw
/// </summary> /// </summary>
/// <returns>The amount of textures</returns> /// <returns>The amount of textures</returns>
public int TextureCount() public int TextureCount()
{
lock (MutexTexture)
{ {
return _Textures.Count; return _Textures.Count;
} }
}
#endregion Textures #endregion Textures
#endregion implementation #endregion implementation