Browse Source

Merge branch 'master' into js/clamp-utils

js/color-alpha-handling
James Jackson-South 5 years ago
committed by GitHub
parent
commit
5f63c88b2f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      .gitignore
  2. 11
      src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/RgbaVector.PixelOperations.cs
  3. 6
      tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs
  4. 2
      tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs

1
.gitignore

@ -221,3 +221,4 @@ artifacts/
# Tests
**/Images/ActualOutput
**/Images/ReferenceOutput
.DS_Store

11
src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/RgbaVector.PixelOperations.cs

@ -26,6 +26,17 @@ namespace SixLabors.ImageSharp.PixelFormats
/// <inheritdoc />
public override PixelTypeInfo GetPixelTypeInfo() => LazyInfo.Value;
/// <inheritdoc />
public override void From<TSourcePixel>(
Configuration configuration,
ReadOnlySpan<TSourcePixel> sourcePixels,
Span<RgbaVector> destinationPixels)
{
Span<Vector4> destinationVectors = MemoryMarshal.Cast<RgbaVector, Vector4>(destinationPixels);
PixelOperations<TSourcePixel>.Instance.ToVector4(configuration, sourcePixels, destinationVectors);
}
/// <inheritdoc />
public override void FromVector4Destructive(
Configuration configuration,

6
tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs

@ -35,7 +35,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
nameof(KnownResamplers.Lanczos5),
};
private static readonly ImageComparer ValidatorComparer = ImageComparer.TolerantPercentage(0.07F);
private static readonly ImageComparer ValidatorComparer =
ImageComparer.TolerantPercentage(TestEnvironment.IsOSX && TestEnvironment.RunsOnCI ? 0.26F : 0.07F);
[Fact]
public void Resize_PixelAgnostic()
@ -355,7 +356,6 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
}
[Theory]
[PlatformSpecific(~TestPlatforms.OSX)]
[WithFileCollection(nameof(CommonTestImages), DefaultPixelType)]
public void ResizeFromSourceRectangle<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
@ -438,7 +438,6 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
}
[Theory]
[PlatformSpecific(~TestPlatforms.OSX)]
[WithFileCollection(nameof(CommonTestImages), DefaultPixelType)]
public void ResizeWithBoxPadMode<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
@ -549,7 +548,6 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
}
[Theory]
[PlatformSpecific(~TestPlatforms.OSX)]
[WithFileCollection(nameof(CommonTestImages), DefaultPixelType)]
public void ResizeWithPadMode<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>

2
tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs

@ -108,6 +108,8 @@ namespace SixLabors.ImageSharp.Tests
internal static bool IsLinux => RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
internal static bool IsOSX => RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
internal static bool IsMono => Type.GetType("Mono.Runtime") != null; // https://stackoverflow.com/a/721194
internal static bool IsWindows => RuntimeInformation.IsOSPlatform(OSPlatform.Windows);

Loading…
Cancel
Save