Removed caching properties from video readers

Those seem redundant since the frame number is guaranteed to match the loaded data inside CurrentFrameData.
This commit is contained in:
penev92
2021-08-01 20:50:03 +03:00
committed by Matthias Mailänder
parent 0df3b34c52
commit 1b5f2f1b39
2 changed files with 14 additions and 35 deletions

View File

@@ -22,17 +22,8 @@ namespace OpenRA.Mods.Cnc.FileFormats
public ushort Width { get; }
public ushort Height { get; }
public uint[,] CurrentFrameData { get; }
public int CurrentFrameNumber { get; private set; }
public uint[,] CurrentFrameData
{
get
{
if (cachedFrameNumber != CurrentFrameNumber)
LoadFrame();
return cachedCurrentFrameData;
}
}
public bool HasAudio => false;
public byte[] AudioData => null;
@@ -47,9 +38,6 @@ namespace OpenRA.Mods.Cnc.FileFormats
byte[] previousFramePaletteIndexData;
byte[] currentFramePaletteIndexData;
int cachedFrameNumber = -1;
uint[,] cachedCurrentFrameData;
public WsaReader(Stream stream)
{
this.stream = stream;
@@ -90,6 +78,9 @@ namespace OpenRA.Mods.Cnc.FileFormats
frameOffsets[i] += 768;
}
var frameSize = Exts.NextPowerOf2(Math.Max(Width, Height));
CurrentFrameData = new uint[frameSize, frameSize];
Reset();
}
@@ -132,11 +123,9 @@ namespace OpenRA.Mods.Cnc.FileFormats
XORDeltaCompression.DecodeInto(intermediateData, currentFramePaletteIndexData, 0);
var c = 0;
var frameSize = Exts.NextPowerOf2(Math.Max(Width, Height));
cachedCurrentFrameData = new uint[frameSize, frameSize];
for (var y = 0; y < Height; y++)
for (var x = 0; x < Width; x++)
cachedCurrentFrameData[y, x] = palette[currentFramePaletteIndexData[c++]];
CurrentFrameData[y, x] = palette[currentFramePaletteIndexData[c++]];
}
}
}