Remove some unrequired Sheet.CreateBuffer or Sheet.ReleaseBuffer calls.

- In CursorManager, we can release the buffer on the final sheet after loading cursors. We don't need to release the buffer on every sheet in the builder, as the builder will handle that.
- In SpriteCache, we don't need to call CreateBuffer explicitly, as the builder will do that for us.
- In RadarWidget, we don't need to call CreateBuffer explicitly, as GetData will do that for us.
This commit is contained in:
RoosterDragon
2024-08-18 14:24:17 +01:00
committed by Gustas
parent 323204014c
commit 7f05227e56
3 changed files with 2 additions and 8 deletions

View File

@@ -91,10 +91,6 @@ namespace OpenRA.Graphics
}
CreateOrUpdateHardwareCursors();
foreach (var s in sheetBuilder.AllSheets)
s.ReleaseBuffer();
Update();
}
@@ -128,6 +124,8 @@ namespace OpenRA.Graphics
}
}
sheetBuilder.Current.ReleaseBuffer();
hardwareCursorsDoubled = graphicSettings.CursorDouble;
}

View File

@@ -80,9 +80,6 @@ namespace OpenRA.Graphics
public void LoadReservations(ModData modData)
{
foreach (var sb in SheetBuilders.Values)
sb.Current.CreateBuffer();
var pendingResolve = new List<(
string Filename,
int FrameIndex,

View File

@@ -97,7 +97,6 @@ namespace OpenRA.Mods.Common.Widgets
// The four layers are stored in a 2x2 grid within a single texture
radarSheet = new Sheet(SheetType.BGRA, new Size(2 * previewWidth, 2 * previewHeight).NextPowerOf2());
radarSheet.CreateBuffer();
radarData = radarSheet.GetData();
MapBoundsChanged();