|
|
@ -746,7 +746,14 @@ namespace SixLabors.ImageSharp.Formats.Png |
|
|
ReadOnlySpan<byte> trimmed = defilteredScanline.Slice(1, defilteredScanline.Length - 1); |
|
|
ReadOnlySpan<byte> trimmed = defilteredScanline.Slice(1, defilteredScanline.Length - 1); |
|
|
|
|
|
|
|
|
// Convert 1, 2, and 4 bit pixel data into the 8 bit equivalent.
|
|
|
// Convert 1, 2, and 4 bit pixel data into the 8 bit equivalent.
|
|
|
ReadOnlySpan<byte> scanlineSpan = this.TryScaleUpTo8BitArray(trimmed, this.bytesPerScanline, this.header.BitDepth, out IMemoryOwner<byte> buffer) |
|
|
IMemoryOwner<byte> buffer = null; |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
ReadOnlySpan<byte> scanlineSpan = this.TryScaleUpTo8BitArray( |
|
|
|
|
|
trimmed, |
|
|
|
|
|
this.bytesPerScanline, |
|
|
|
|
|
this.header.BitDepth, |
|
|
|
|
|
out buffer) |
|
|
? buffer.GetSpan() |
|
|
? buffer.GetSpan() |
|
|
: trimmed; |
|
|
: trimmed; |
|
|
|
|
|
|
|
|
@ -816,9 +823,12 @@ namespace SixLabors.ImageSharp.Formats.Png |
|
|
|
|
|
|
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
finally |
|
|
|
|
|
{ |
|
|
buffer?.Dispose(); |
|
|
buffer?.Dispose(); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Decodes and assigns marker colors that identify transparent pixels in non indexed images.
|
|
|
/// Decodes and assigns marker colors that identify transparent pixels in non indexed images.
|
|
|
|