dont allocate a full new palette texture every frame in HardwarePalette.Update

This commit is contained in:
Chris Forbes
2011-03-05 18:29:30 +13:00
parent 533df844d8
commit c1ad99bb99

View File

@@ -56,8 +56,9 @@ namespace OpenRA.Graphics
palettes.Add(name, p); palettes.Add(name, p);
indices.Add(name, allocated++); indices.Add(name, allocated++);
} }
uint[,] data = new uint[MaxPalettes, 256];
public void Update(IEnumerable<IPaletteModifier> paletteMods) public void Update(IEnumerable<IPaletteModifier> paletteMods)
{ {
var copy = palettes.ToDictionary(p => p.Key, p => new Palette(p.Value)); var copy = palettes.ToDictionary(p => p.Key, p => new Palette(p.Value));
@@ -65,7 +66,6 @@ namespace OpenRA.Graphics
foreach (var mod in paletteMods) foreach (var mod in paletteMods)
mod.AdjustPalette(copy); mod.AdjustPalette(copy);
var data = new uint[MaxPalettes,256];
foreach (var pal in copy) foreach (var pal in copy)
{ {
var j = indices[pal.Key]; var j = indices[pal.Key];