Skip to content

Commit 53510f0

Browse files
Add explicit tests for #2450
1 parent c8fe7f2 commit 53510f0

File tree

261 files changed

+791
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

261 files changed

+791
-1
lines changed

src/ImageSharp/Formats/Gif/GifEncoderCore.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,10 @@ private void EncodeFrame<TPixel>(
290290
}
291291

292292
this.WriteGraphicalControlExtension(metadata, transparencyIndex, stream);
293+
294+
// TODO: Consider an optimization that trims down the buffer to the minimum size required.
295+
// We would use a process similar to entropy crop where we trim the buffer from the edges
296+
// until we hit a non-transparent pixel.
293297
this.WriteImageDescriptor(frame, useLocal, stream);
294298

295299
if (useLocal)

tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ public void Decode_VerifyAllFrames<TPixel>(TestImageProvider<TPixel> provider)
3434
image.CompareToReferenceOutputMultiFrame(provider, ImageComparer.Exact);
3535
}
3636

37+
[Theory]
38+
[WithFile(TestImages.Gif.Issues.Issue2450_A, PixelTypes.Rgba32)]
39+
[WithFile(TestImages.Gif.Issues.Issue2450_B, PixelTypes.Rgba32)]
40+
public void Decode_Issue2450<TPixel>(TestImageProvider<TPixel> provider)
41+
where TPixel : unmanaged, IPixel<TPixel>
42+
{
43+
using Image<TPixel> image = provider.GetImage();
44+
image.DebugSaveMultiFrame(provider);
45+
image.CompareToReferenceOutputMultiFrame(provider, ImageComparer.Exact);
46+
}
47+
3748
[Theory]
3849
[WithFile(TestImages.Gif.Giphy, PixelTypes.Rgba32)]
3950
public void GifDecoder_Decode_Resize<TPixel>(TestImageProvider<TPixel> provider)

tests/ImageSharp.Tests/TestImages.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,8 @@ public static class Issues
484484
public const string Issue2288_B = "Gif/issues/issue_2288_2.gif";
485485
public const string Issue2288_C = "Gif/issues/issue_2288_3.gif";
486486
public const string Issue2288_D = "Gif/issues/issue_2288_4.gif";
487-
public const string Issue2450 = "Gif/issues/issue_2450.gif";
487+
public const string Issue2450_A = "Gif/issues/issue_2450.gif";
488+
public const string Issue2450_B = "Gif/issues/issue_2450_2.gif";
488489
public const string Issue2198 = "Gif/issues/issue_2198.gif";
489490
}
490491

Lines changed: 3 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Lines changed: 3 additions & 0 deletions

0 commit comments

Comments
 (0)