diff --git a/project/code/TMV/TextureLoader.Gif.cs b/project/code/TMV/TextureLoader.Gif.cs index 46ddc29..85deeb8 100644 --- a/project/code/TMV/TextureLoader.Gif.cs +++ b/project/code/TMV/TextureLoader.Gif.cs @@ -14,16 +14,9 @@ public partial class TextureLoader var width = gifImage.Width; var height = gifImage.Height; - var image = Image.CreateEmpty(width, height, false, Image.Format.Rgba8); - for (var y = 0; y < height; y++) - { - for (var x = 0; x < width; x++) - { - var pixel = gifImage[x, y].ToVector4(); - image.SetPixel(x, y, new Color(pixel.X, pixel.Y, pixel.Z, pixel.W)); - } - } - + var bytes = new byte[width * height * 4]; + gifImage.CopyPixelDataTo(bytes); + var image = Image.CreateFromData(width, height, false, Image.Format.Rgba8, bytes); return ImageTexture.CreateFromImage(image); } } \ No newline at end of file