Browse Source

Merge branch 'master' into af/create-2.1-target

af/merge-core
James Jackson-South 8 years ago
committed by GitHub
parent
commit
ce656264e3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/ImageSharp/PixelFormats/Bgr24.cs
  2. 5
      src/ImageSharp/PixelFormats/Rgb24.cs
  3. 14
      src/ImageSharp/Processing/Quantization/FrameQuantizers/WuFrameQuantizer{TPixel}.cs
  4. 2
      tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Baseline.cs
  5. 2
      tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Progressive.cs
  6. 8
      tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs
  7. 5
      tests/ImageSharp.Tests/Image/ImageCloneTests.cs
  8. 25
      tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs
  9. 12
      tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs

5
src/ImageSharp/PixelFormats/Bgr24.cs

@ -14,22 +14,25 @@ namespace SixLabors.ImageSharp.PixelFormats
/// Ranges from [0, 0, 0, 1] to [1, 1, 1, 1] in vector form.
/// </para>
/// </summary>
[StructLayout(LayoutKind.Sequential)]
[StructLayout(LayoutKind.Explicit)]
public struct Bgr24 : IPixel<Bgr24>
{
/// <summary>
/// The blue component.
/// </summary>
[FieldOffset(0)]
public byte B;
/// <summary>
/// The green component.
/// </summary>
[FieldOffset(1)]
public byte G;
/// <summary>
/// The red component.
/// </summary>
[FieldOffset(2)]
public byte R;
/// <summary>

5
src/ImageSharp/PixelFormats/Rgb24.cs

@ -15,22 +15,25 @@ namespace SixLabors.ImageSharp.PixelFormats
/// Ranges from [0, 0, 0, 1] to [1, 1, 1, 1] in vector form.
/// </para>
/// </summary>
[StructLayout(LayoutKind.Sequential)]
[StructLayout(LayoutKind.Explicit)]
public struct Rgb24 : IPixel<Rgb24>
{
/// <summary>
/// The red component.
/// </summary>
[FieldOffset(0)]
public byte R;
/// <summary>
/// The green component.
/// </summary>
[FieldOffset(1)]
public byte G;
/// <summary>
/// The blue component.
/// </summary>
[FieldOffset(2)]
public byte B;
/// <summary>

14
src/ImageSharp/Processing/Quantization/FrameQuantizers/WuFrameQuantizer{TPixel}.cs

@ -157,13 +157,13 @@ namespace SixLabors.ImageSharp.Processing.Quantization.FrameQuantizers
}
finally
{
this.vwt.Dispose();
this.vmr.Dispose();
this.vmg.Dispose();
this.vmb.Dispose();
this.vma.Dispose();
this.m2.Dispose();
this.tag.Dispose();
this.vwt?.Dispose();
this.vmr?.Dispose();
this.vmg?.Dispose();
this.vmb?.Dispose();
this.vma?.Dispose();
this.m2?.Dispose();
this.tag?.Dispose();
}
}

2
tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Baseline.cs

@ -42,7 +42,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
public void DecodeBaselineJpeg_PdfJs<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
if (TestEnvironment.RunsOnCI && !TestEnvironment.Is64BitProcess)
if (SkipTest(provider))
{
// skipping to avoid OutOfMemoryException on CI
return;

2
tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Progressive.cs

@ -18,7 +18,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
public void DecodeProgressiveJpeg_Orig<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
if (TestEnvironment.RunsOnCI && !TestEnvironment.Is64BitProcess)
if (SkipTest(provider))
{
// skipping to avoid OutOfMemoryException on CI
return;

8
tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs

@ -48,11 +48,13 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
string[] largeImagesToSkipOn32Bit =
{
TestImages.Jpeg.Baseline.Jpeg420Exif,
TestImages.Jpeg.Issues.BadZigZagProgressive385
TestImages.Jpeg.Issues.MissingFF00ProgressiveBedroom159,
TestImages.Jpeg.Issues.BadZigZagProgressive385,
TestImages.Jpeg.Issues.NoEoiProgressive517,
TestImages.Jpeg.Issues.BadRstProgressive518,
};
return TestEnvironment.RunsOnCI && !TestEnvironment.Is64BitProcess
&& largeImagesToSkipOn32Bit.Contains(provider.SourceFileOrDescription);
return !TestEnvironment.Is64BitProcess && largeImagesToSkipOn32Bit.Contains(provider.SourceFileOrDescription);
}
public JpegDecoderTests(ITestOutputHelper output)

5
tests/ImageSharp.Tests/Image/ImageCloneTests.cs

@ -33,10 +33,7 @@ namespace SixLabors.ImageSharp.Tests
}
}
/// <summary>
/// https://github.com/SixLabors/ImageSharp/issues/576
/// </summary>
[Theory(Skip = "See https://github.com/SixLabors/ImageSharp/issues/576")]
[Theory]
[WithTestPatternImages(9, 9, PixelTypes.Rgba32)]
public void CloneAs_ToBgr24(TestImageProvider<Rgba32> provider)
{

25
tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs

@ -55,7 +55,7 @@ namespace SixLabors.ImageSharp.Tests
public bool Equals(Key other)
{
if (ReferenceEquals(null, other)) return false;
if (other is null) return false;
if (ReferenceEquals(this, other)) return true;
if (!this.commonValues.Equals(other.commonValues)) return false;
@ -81,7 +81,7 @@ namespace SixLabors.ImageSharp.Tests
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (obj is null) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return this.Equals((Key)obj);
@ -133,15 +133,14 @@ namespace SixLabors.ImageSharp.Tests
{
Guard.NotNull(decoder, nameof(decoder));
Key key = new Key(this.PixelType, this.FilePath, decoder);
if (!TestEnvironment.Is64BitProcess)
{
return LoadImage(decoder);
}
Image<TPixel> cachedImage = cache.GetOrAdd(
key,
fn =>
{
var testFile = TestFile.Create(this.FilePath);
return Image.Load<TPixel>(this.Configuration, testFile.Bytes, decoder);
});
var key = new Key(this.PixelType, this.FilePath, decoder);
Image<TPixel> cachedImage = cache.GetOrAdd(key, fn => { return LoadImage(decoder); });
return cachedImage.Clone();
}
@ -158,6 +157,12 @@ namespace SixLabors.ImageSharp.Tests
base.Serialize(info);
info.AddValue("path", this.FilePath);
}
private Image<TPixel> LoadImage(IImageDecoder decoder)
{
var testFile = TestFile.Create(this.FilePath);
return Image.Load<TPixel>(this.Configuration, testFile.Bytes, decoder);
}
}
public static string GetFilePathOrNull(ITestImageProvider provider)

12
tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs

@ -121,6 +121,12 @@ namespace SixLabors.ImageSharp.Tests
public void GetImage_WithCustomParameterlessDecoder_ShouldUtilizeCache<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
if (!TestEnvironment.Is64BitProcess)
{
// We don't cache with the 32 bit build.
return;
}
Assert.NotNull(provider.Utility.SourceFileOrDescription);
TestDecoder.DoTestThreadSafe(() =>
@ -179,6 +185,12 @@ namespace SixLabors.ImageSharp.Tests
public void GetImage_WithCustomParametricDecoder_ShouldUtilizeCache_WhenParametersAreEqual<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
if (!TestEnvironment.Is64BitProcess)
{
// We don't cache with the 32 bit build.
return;
}
Assert.NotNull(provider.Utility.SourceFileOrDescription);
TestDecoderWithParameters.DoTestThreadSafe(() =>

Loading…
Cancel
Save