Actually dispose queued Bitmaps
This commit is contained in:
1 parent
0611148ec4
commit
125be98466
1 file changed
+20
-2
@@ -508,11 +508,20 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
Debug.Assert(oldTexture != null, "Queued type is wrong");
|
Debug.Assert(oldTexture != null, "Queued type is wrong");
|
||||||
Debug.Assert(!oldTexture.IsLoaded);
|
Debug.Assert(!oldTexture.IsLoaded);
|
||||||
if (oldTexture.RefCount <= 0)
|
if (oldTexture.RefCount <= 0)
|
||||||
|
{
|
||||||
|
Bitmap bmp = q.Data as Bitmap;
|
||||||
|
if (bmp != null)
|
||||||
|
bmp.Dispose();
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
TTextureType texture = null;
|
TTextureType texture = null;
|
||||||
// ReSharper disable CanBeReplacedWithTryCastAndCheckForNull
|
// ReSharper disable CanBeReplacedWithTryCastAndCheckForNull
|
||||||
if (q.Data is Bitmap)
|
if (q.Data is Bitmap)
|
||||||
_WriteBitmapToTexture(ref texture, (Bitmap)q.Data);
|
{
|
||||||
|
Bitmap bmp = (Bitmap)q.Data;
|
||||||
|
_WriteBitmapToTexture(ref texture, bmp);
|
||||||
|
bmp.Dispose();
|
||||||
|
}
|
||||||
else if (q.Data is byte[])
|
else if (q.Data is byte[])
|
||||||
texture = _CreateAndFillTexture(q.DataSize, (byte[])q.Data);
|
texture = _CreateAndFillTexture(q.DataSize, (byte[])q.Data);
|
||||||
else
|
else
|
||||||
@@ -525,12 +534,21 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
CTextureRef textureRef = q.TextureOrRef as CTextureRef;
|
CTextureRef textureRef = q.TextureOrRef as CTextureRef;
|
||||||
Debug.Assert(textureRef != null, "Queued type is wrong");
|
Debug.Assert(textureRef != null, "Queued type is wrong");
|
||||||
if (!_Textures.ContainsKey(textureRef.ID))
|
if (!_Textures.ContainsKey(textureRef.ID))
|
||||||
|
{
|
||||||
|
Bitmap bmp = q.Data as Bitmap;
|
||||||
|
if (bmp != null)
|
||||||
|
bmp.Dispose();
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if (q.Action == EQueueAction.Update)
|
if (q.Action == EQueueAction.Update)
|
||||||
{
|
{
|
||||||
// ReSharper disable CanBeReplacedWithTryCastAndCheckForNull
|
// ReSharper disable CanBeReplacedWithTryCastAndCheckForNull
|
||||||
if (q.Data is Bitmap)
|
if (q.Data is Bitmap)
|
||||||
UpdateTexture(textureRef, (Bitmap)q.Data);
|
{
|
||||||
|
Bitmap bmp = (Bitmap)q.Data;
|
||||||
|
UpdateTexture(textureRef, bmp);
|
||||||
|
bmp.Dispose();
|
||||||
|
}
|
||||||
else if (q.Data is byte[])
|
else if (q.Data is byte[])
|
||||||
UpdateTexture(textureRef, q.DataSize.Width, q.DataSize.Height, (byte[])q.Data);
|
UpdateTexture(textureRef, q.DataSize.Width, q.DataSize.Height, (byte[])q.Data);
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in new issue
Block a user