diff --git a/src/ImageSharp/Formats/Tga/TgaDecoderCore.cs b/src/ImageSharp/Formats/Tga/TgaDecoderCore.cs index c8e23532f..e9e7ce719 100644 --- a/src/ImageSharp/Formats/Tga/TgaDecoderCore.cs +++ b/src/ImageSharp/Formats/Tga/TgaDecoderCore.cs @@ -532,26 +532,8 @@ namespace SixLabors.ImageSharp.Formats.Tga { TPixel color = default; bool isXInverted = origin == TgaImageOrigin.BottomRight || origin == TgaImageOrigin.TopRight; - if (this.tgaMetadata.AlphaChannelBits == 8) + if (this.tgaMetadata.AlphaChannelBits == 8 && !isXInverted) { - if (isXInverted) - { - for (int y = 0; y < height; y++) - { - int newY = InvertY(y, height, origin); - Span pixelSpan = pixels.GetRowSpan(newY); - for (int x = 0; x < width; x++) - { - this.currentStream.Read(this.scratchBuffer, 0, 4); - color.FromBgra32(Unsafe.As(ref this.scratchBuffer[0])); - int newX = InvertX(x, width, origin); - pixelSpan[newX] = color; - } - } - - return; - } - using (IManagedByteBuffer row = this.memoryAllocator.AllocatePaddedPixelRowBuffer(width, 4, 0)) { for (int y = 0; y < height; y++)