Allow a sheet buffer to be released without error, even if unbuffered.

This commit is contained in:
RoosterDragon
2015-05-20 18:35:24 +01:00
parent 9397749118
commit d42c3a9740

View File

@@ -154,16 +154,6 @@ namespace OpenRA.Graphics
} }
public void CommitData() public void CommitData()
{
CommitData(false);
}
public void ReleaseBuffer()
{
CommitData(true);
}
void CommitData(bool releaseBuffer)
{ {
lock (textureLock) lock (textureLock)
{ {
@@ -174,8 +164,17 @@ namespace OpenRA.Graphics
"If you need to make only small changes to the texture data consider creating a buffered sheet instead."); "If you need to make only small changes to the texture data consider creating a buffered sheet instead.");
dirty = true; dirty = true;
if (releaseBuffer) }
releaseBufferOnCommit = true; }
public void ReleaseBuffer()
{
lock (textureLock)
{
if (!Buffered)
return;
dirty = true;
releaseBufferOnCommit = true;
} }
} }