Fix strange d2k loading slowness
There is a strange issue that appears* when Theater calls ISpriteFrame.Frames on the R8Reader. The R8Reader uses IEnumerable.Cast<> which behaves slower and slower, which makes map loading become 10+ times slower. The changes here simply avoid the casting. [*] This happens at least on Linux x86_64 with Mono 3.2.8. See https://bugzilla.xamarin.com/show_bug.cgi?id=19668
This commit is contained in:
@@ -86,8 +86,8 @@ namespace OpenRA.FileFormats
|
||||
|
||||
public class ShpD2Reader : ISpriteSource
|
||||
{
|
||||
List<Frame> headers = new List<Frame>();
|
||||
public IEnumerable<ISpriteFrame> Frames { get { return headers.Cast<ISpriteFrame>(); } }
|
||||
readonly List<ISpriteFrame> frames = new List<ISpriteFrame>();
|
||||
public IEnumerable<ISpriteFrame> Frames { get { return frames; } }
|
||||
public bool CacheWhenLoadingTileset { get { return false; } }
|
||||
|
||||
public ShpD2Reader(Stream s)
|
||||
@@ -108,7 +108,7 @@ namespace OpenRA.FileFormats
|
||||
for (var i = 0; i < imageCount; i++)
|
||||
{
|
||||
s.Position = offsets[i];
|
||||
headers.Add(new Frame(s));
|
||||
frames.Add(new Frame(s));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user