|
|
@ -506,11 +506,15 @@ namespace SixLabors.ImageSharp.Formats.Png |
|
|
while (this.currentRow < this.header.Height) |
|
|
while (this.currentRow < this.header.Height) |
|
|
{ |
|
|
{ |
|
|
Span<byte> scanlineSpan = this.scanline.GetSpan(); |
|
|
Span<byte> scanlineSpan = this.scanline.GetSpan(); |
|
|
int bytesRead = compressedStream.Read(scanlineSpan, this.currentRowBytesRead, this.bytesPerScanline - this.currentRowBytesRead); |
|
|
while (this.currentRowBytesRead < this.bytesPerScanline) |
|
|
this.currentRowBytesRead += bytesRead; |
|
|
|
|
|
if (this.currentRowBytesRead < this.bytesPerScanline) |
|
|
|
|
|
{ |
|
|
{ |
|
|
return; |
|
|
int bytesRead = compressedStream.Read(scanlineSpan, this.currentRowBytesRead, this.bytesPerScanline - this.currentRowBytesRead); |
|
|
|
|
|
if (bytesRead <= 0) |
|
|
|
|
|
{ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.currentRowBytesRead += bytesRead; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
this.currentRowBytesRead = 0; |
|
|
this.currentRowBytesRead = 0; |
|
|
@ -577,11 +581,15 @@ namespace SixLabors.ImageSharp.Formats.Png |
|
|
|
|
|
|
|
|
while (this.currentRow < this.header.Height) |
|
|
while (this.currentRow < this.header.Height) |
|
|
{ |
|
|
{ |
|
|
int bytesRead = compressedStream.Read(this.scanline.GetSpan(), this.currentRowBytesRead, bytesPerInterlaceScanline - this.currentRowBytesRead); |
|
|
while (this.currentRowBytesRead < bytesPerInterlaceScanline) |
|
|
this.currentRowBytesRead += bytesRead; |
|
|
|
|
|
if (this.currentRowBytesRead < bytesPerInterlaceScanline) |
|
|
|
|
|
{ |
|
|
{ |
|
|
return; |
|
|
int bytesRead = compressedStream.Read(this.scanline.GetSpan(), this.currentRowBytesRead, bytesPerInterlaceScanline - this.currentRowBytesRead); |
|
|
|
|
|
if (bytesRead <= 0) |
|
|
|
|
|
{ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.currentRowBytesRead += bytesRead; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
this.currentRowBytesRead = 0; |
|
|
this.currentRowBytesRead = 0; |
|
|
|