Browse Source

Cleanup

pull/1574/head
James Jackson-South 6 years ago
parent
commit
773f773f6d
  1. 2
      src/ImageSharp/Formats/Png/PngEncoderCore.cs
  2. 18
      tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs

2
src/ImageSharp/Formats/Png/PngEncoderCore.cs

@ -567,7 +567,7 @@ namespace SixLabors.ImageSharp.Formats.Png
// Bulk convert our palette to RGBA to allow assignment to tables.
// Palette length maxes out at 256 so safe to stackalloc.
Span<Rgba32> rgbaPaletteSpan = stackalloc Rgba32[palette.Length];
Span<Rgba32> rgbaPaletteSpan = stackalloc Rgba32[paletteLength];
PixelOperations<TPixel>.Instance.ToRgba32(quantized.Configuration, quantized.Palette.Span, rgbaPaletteSpan);
ref Rgba32 rgbaPaletteRef = ref MemoryMarshal.GetReference(rgbaPaletteSpan);

18
tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs

@ -5,7 +5,6 @@ using System.IO;
using SixLabors.ImageSharp.Formats.Gif;
using SixLabors.ImageSharp.Metadata;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Processors.Quantization;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
using Xunit;
@ -26,23 +25,6 @@ namespace SixLabors.ImageSharp.Tests.Formats.Gif
{ TestImages.Gif.Ratio4x1, 4, 1, PixelResolutionUnit.AspectRatio }
};
[Theory]
[WithFile(TestImages.Bmp.Car, PixelTypes.Rgba32)]
public void EncodeAllocationCheck<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
{
GifEncoder encoder = new GifEncoder
{
Quantizer = new WebSafePaletteQuantizer(new QuantizerOptions { Dither = KnownDitherings.Bayer4x4 })
};
using (Image<TPixel> image = provider.GetImage())
{
// Always save as we need to compare the encoded output.
provider.Utility.SaveTestOutputFile(image, "gif", encoder);
}
}
[Theory]
[WithTestPatternImages(100, 100, TestPixelTypes, false)]
[WithTestPatternImages(100, 100, TestPixelTypes, false)]

Loading…
Cancel
Save