Browse Source

Correctly read Adam7 palette colors

pull/294/head
James Jackson-South 9 years ago
parent
commit
4b2fbcd453
  1. 15
      src/ImageSharp/Formats/Png/PngDecoderCore.cs

15
src/ImageSharp/Formats/Png/PngDecoderCore.cs

@ -768,10 +768,7 @@ namespace ImageSharp.Formats
case PngColorType.Palette: case PngColorType.Palette:
byte[] newScanline = ToArrayByBitsLength( byte[] newScanline = ToArrayByBitsLength(defilteredScanline, this.bytesPerScanline, this.header.BitDepth);
defilteredScanline,
this.bytesPerScanline,
this.header.BitDepth);
var rgba = default(Rgba32); var rgba = default(Rgba32);
if (this.paletteAlpha != null && this.paletteAlpha.Length > 0) if (this.paletteAlpha != null && this.paletteAlpha.Length > 0)
@ -784,15 +781,7 @@ namespace ImageSharp.Formats
int offset = index * 3; int offset = index * 3;
rgba.A = this.paletteAlpha.Length > index ? this.paletteAlpha[index] : (byte)255; rgba.A = this.paletteAlpha.Length > index ? this.paletteAlpha[index] : (byte)255;
rgba.Rgb = this.palette.GetRgb24(offset);
if (rgba.A > 0)
{
rgba.Rgb = this.palette.GetRgb24(offset);
}
else
{
rgba = default(Rgba32);
}
color.PackFromRgba32(rgba); color.PackFromRgba32(rgba);
rowSpan[x] = color; rowSpan[x] = color;

Loading…
Cancel
Save