Skip to content

Commit

Permalink
[Imaging] - Fixed a bug with swizzling being incorrectly applied for …
Browse files Browse the repository at this point in the history
…24 bit TGA images.
  • Loading branch information
Tape-Worm committed Apr 15, 2022
1 parent 930386b commit 70d5f64
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Gorgon/Gorgon.Graphics.Imaging/Codecs/GorgonCodecTga.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ private static GorgonImageInfo ReadHeader(GorgonBinaryReader reader, out TGAConv
pixelFormat = BufferFormat.R8G8B8A8_UNorm;
if (header.BPP == 24)
{
conversionFlags |= TGAConversionFlags.Expand;
conversionFlags |= TGAConversionFlags.Expand | TGAConversionFlags.RGB888;
}
break;
}
Expand Down Expand Up @@ -767,7 +767,8 @@ private void CopyImageData(GorgonBinaryReader reader, IGorgonImage image, TGACon
}

// The components of the pixel data in a TGA file need swizzling for 32 bit.
if (formatInfo.BitDepth == 32)
//if (formatInfo.BitDepth == 32)
if ((conversionFlags & TGAConversionFlags.RGB888) != TGAConversionFlags.RGB888)
{
ImageUtilities.SwizzleScanline(in destPtr,
buffer.PitchInformation.RowPitch,
Expand Down

0 comments on commit 70d5f64

Please sign in to comment.