55using System . IO . Compression ;
66
77using SixLabors . ImageSharp . Compression . Zlib ;
8- using SixLabors . ImageSharp . Formats . Tiff . Compression ;
98using SixLabors . ImageSharp . Formats . Tiff . Constants ;
9+ using SixLabors . ImageSharp . Formats . Tiff . PhotometricInterpretation ;
1010using SixLabors . ImageSharp . IO ;
1111using SixLabors . ImageSharp . Memory ;
1212
@@ -20,16 +20,24 @@ namespace SixLabors.ImageSharp.Formats.Tiff.Compression.Decompressors
2020 /// </remarks>
2121 internal class DeflateTiffCompression : TiffBaseDecompressor
2222 {
23+ private readonly bool isBigEndian ;
24+
25+ private readonly TiffColorType colorType ;
26+
2327 /// <summary>
2428 /// Initializes a new instance of the <see cref="DeflateTiffCompression" /> class.
2529 /// </summary>
2630 /// <param name="memoryAllocator">The memoryAllocator to use for buffer allocations.</param>
2731 /// <param name="width">The image width.</param>
2832 /// <param name="bitsPerPixel">The bits used per pixel.</param>
33+ /// <param name="colorType">The color type of the pixel data.</param>
2934 /// <param name="predictor">The tiff predictor used.</param>
30- public DeflateTiffCompression ( MemoryAllocator memoryAllocator , int width , int bitsPerPixel , TiffPredictor predictor )
35+ /// <param name="isBigEndian">if set to <c>true</c> decodes the pixel data as big endian, otherwise as little endian.</param>
36+ public DeflateTiffCompression ( MemoryAllocator memoryAllocator , int width , int bitsPerPixel , TiffColorType colorType , TiffPredictor predictor , bool isBigEndian )
3137 : base ( memoryAllocator , width , bitsPerPixel , predictor )
3238 {
39+ this . colorType = colorType ;
40+ this . isBigEndian = isBigEndian ;
3341 }
3442
3543 /// <inheritdoc/>
@@ -62,7 +70,7 @@ protected override void Decompress(BufferedReadStream stream, int byteCount, Spa
6270
6371 if ( this . Predictor == TiffPredictor . Horizontal )
6472 {
65- HorizontalPredictor . Undo ( buffer , this . Width , this . BitsPerPixel ) ;
73+ HorizontalPredictor . Undo ( buffer , this . Width , this . colorType , this . isBigEndian ) ;
6674 }
6775 }
6876
0 commit comments