diff --git a/Content.MapRenderer/Painters/DecalData.cs b/Content.MapRenderer/Painters/DecalData.cs index e0fbf6aed7..c64d4ff6ff 100644 --- a/Content.MapRenderer/Painters/DecalData.cs +++ b/Content.MapRenderer/Painters/DecalData.cs @@ -2,17 +2,4 @@ namespace Content.MapRenderer.Painters; -public sealed class DecalData -{ - public DecalData(Decal decal, float x, float y) - { - Decal = decal; - X = x; - Y = y; - } - - public Decal Decal; - - public float X; - public float Y; -} +public readonly record struct DecalData(Decal Decal, float X, float Y); diff --git a/Content.MapRenderer/Painters/DecalPainter.cs b/Content.MapRenderer/Painters/DecalPainter.cs index f33d343539..ffcd140a6e 100644 --- a/Content.MapRenderer/Painters/DecalPainter.cs +++ b/Content.MapRenderer/Painters/DecalPainter.cs @@ -28,7 +28,7 @@ public sealed class DecalPainter _sPrototypeManager = server.ResolveDependency(); } - public void Run(Image canvas, List decals) + public void Run(Image canvas, Span decals) { var stopwatch = new Stopwatch(); stopwatch.Start(); @@ -48,7 +48,7 @@ public sealed class DecalPainter Run(canvas, decal); } - Console.WriteLine($"{nameof(DecalPainter)} painted {decals.Count} decals in {(int) stopwatch.Elapsed.TotalMilliseconds} ms"); + Console.WriteLine($"{nameof(DecalPainter)} painted {decals.Length} decals in {(int) stopwatch.Elapsed.TotalMilliseconds} ms"); } private void Run(Image canvas, DecalData data) @@ -67,7 +67,13 @@ public sealed class DecalPainter } else if (sprite is SpriteSpecifier.Rsi rsi) { - stream = _cResourceCache.ContentFileRead($"/Textures/{rsi.RsiPath}/{rsi.RsiState}.png"); + var path = $"{rsi.RsiPath}/{rsi.RsiState}.png"; + if (!path.StartsWith("/Textures")) + { + path = $"/Textures/{path}"; + } + + stream = _cResourceCache.ContentFileRead(path); } else { diff --git a/Content.MapRenderer/Painters/GridPainter.cs b/Content.MapRenderer/Painters/GridPainter.cs index fe2b392af9..0659be190c 100644 --- a/Content.MapRenderer/Painters/GridPainter.cs +++ b/Content.MapRenderer/Painters/GridPainter.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; +using System.Runtime.InteropServices; using Content.Shared.Decals; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; @@ -57,7 +58,7 @@ namespace Content.MapRenderer.Painters // Decals are always painted before entities, and are also optional. if (_decals.TryGetValue(grid.Owner, out var decals)) - _decalPainter.Run(gridCanvas, decals); + _decalPainter.Run(gridCanvas, CollectionsMarshal.AsSpan(decals)); _entityPainter.Run(gridCanvas, entities);