Skip to content

Commit 9e12a72

Browse files
committed
Fix loop bounds for little endian, add little endian test file
1 parent f1834c7 commit 9e12a72

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgb161616TiffColor{TPixel}.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public override void Decode(ReadOnlySpan<byte> data, Buffer2D<TPixel> pixels, in
5353
}
5454
else
5555
{
56-
for (int x = left; x < left + width; x++)
56+
for (int x = 0; x < pixelRow.Length; x++)
5757
{
5858
ulong r = TiffUtils.ConvertToShortLittleEndian(data.Slice(offset, 2));
5959
offset += 2;

tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ public void TiffDecoder_CanDecode_42Bit<TPixel>(TestImageProvider<TPixel> provid
165165

166166
[Theory]
167167
[WithFile(FlowerRgb161616Contiguous, PixelTypes.Rgba32)]
168+
[WithFile(FlowerRgb161616ContiguousLittleEndian, PixelTypes.Rgba32)]
168169
[WithFile(FlowerRgb161616Planar, PixelTypes.Rgba32)]
169170
[WithFile(FlowerRgb161616PlanarLittleEndian, PixelTypes.Rgba32)]
170171
[WithFile(Issues1716Rgb161616BitLittleEndian, PixelTypes.Rgba32)]

tests/ImageSharp.Tests/TestImages.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ public static class Tiff
562562
public const string Rgb4BitPalette = "Tiff/bike_colorpalette_4bit.tiff";
563563
public const string RgbPaletteDeflate = "Tiff/rgb_palette_deflate.tiff";
564564
public const string FlowerRgb161616Contiguous = "Tiff/flower-rgb-contig-16.tiff";
565+
public const string FlowerRgb161616ContiguousLittleEndian = "Tiff/flower-rgb-contig-16_lsb.tiff";
565566
public const string FlowerRgb161616Planar = "Tiff/flower-rgb-planar-16.tiff";
566567
public const string FlowerRgb161616PlanarLittleEndian = "Tiff/flower-rgb-planar-16_lsb.tiff";
567568
public const string FlowerRgb141414Contiguous = "Tiff/flower-rgb-contig-14.tiff";
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:0951a9c2207eb6864b6a19ec8513a28a874adddb37c3c06b9fd07831372924e3
3+
size 19150

0 commit comments

Comments
 (0)