Browse Source

Merge pull request #1772 from SixLabors/af/fix-MagicReferenceDecoder

Fix a bug in MagickReferenceDecoder
pull/1779/head
Anton Firszov 5 years ago
committed by GitHub
parent
commit
4ce2d0c55b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/MagickReferenceDecoder.cs

10
tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/MagickReferenceDecoder.cs

@ -32,15 +32,15 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs
private static void FromRgba32Bytes<TPixel>(Configuration configuration, Span<byte> rgbaBytes, IMemoryGroup<TPixel> destinationGroup) private static void FromRgba32Bytes<TPixel>(Configuration configuration, Span<byte> rgbaBytes, IMemoryGroup<TPixel> destinationGroup)
where TPixel : unmanaged, ImageSharp.PixelFormats.IPixel<TPixel> where TPixel : unmanaged, ImageSharp.PixelFormats.IPixel<TPixel>
{ {
Span<Rgba32> sourcePixels = MemoryMarshal.Cast<byte, Rgba32>(rgbaBytes);
foreach (Memory<TPixel> m in destinationGroup) foreach (Memory<TPixel> m in destinationGroup)
{ {
Span<TPixel> destBuffer = m.Span; Span<TPixel> destBuffer = m.Span;
PixelOperations<TPixel>.Instance.FromRgba32Bytes( PixelOperations<TPixel>.Instance.FromRgba32(
configuration, configuration,
rgbaBytes, sourcePixels.Slice(0, destBuffer.Length),
destBuffer, destBuffer);
destBuffer.Length); sourcePixels = sourcePixels.Slice(destBuffer.Length);
rgbaBytes = rgbaBytes.Slice(destBuffer.Length * 4);
} }
} }

Loading…
Cancel
Save