diff options
Diffstat (limited to 'Bitmap.cs')
| -rw-r--r-- | Bitmap.cs | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -69,7 +69,7 @@ class Bitmap : IDisposable public static Bitmap Deserialize(ReadOnlySpan<byte> span, int MaxW = MaxWidth, int MaxH = MaxHeight, Image? fallbackImage = null) { - int width = BinaryPrimitives.ReadInt16LittleEndian(span[..2]); + int width = BinaryPrimitives.ReadInt16LittleEndian(span); int height = BinaryPrimitives.ReadInt16LittleEndian(span.Slice(2, 2)); PixelFormat format = (PixelFormat)span[4]; int mipmaps = span[5]; @@ -81,10 +81,11 @@ class Bitmap : IDisposable Image img = Raylib.GenImageChecked(Math.Clamp(width, 8, MaxW), Math.Clamp(height, 8, MaxH), 4, 4, Color.Pink, Color.Black); if (Invalid) return new Bitmap(img); - byte[] compressed = span[6..].ToArray(); + byte[] compressed = span.ToArray(); byte[] data = new byte[RaylibExt.TextureLength(width, height, format, mipmaps)]; { using MemoryStream input = new(compressed); + input.Position += 6; using DeflateStream decompressor = new(input, CompressionMode.Decompress); decompressor.ReadExactly(data); } |
