From 8fb339305538f0de2213089bb89dd9f5b91120ff Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Sat, 5 Dec 2020 22:02:27 +0100 Subject: [PATCH] fix scalar code --- src/ImageSharp/Common/Helpers/SimdUtils.Pack.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ImageSharp/Common/Helpers/SimdUtils.Pack.cs b/src/ImageSharp/Common/Helpers/SimdUtils.Pack.cs index 8cd15e01bc..fe02bd0072 100644 --- a/src/ImageSharp/Common/Helpers/SimdUtils.Pack.cs +++ b/src/ImageSharp/Common/Helpers/SimdUtils.Pack.cs @@ -78,7 +78,7 @@ namespace SixLabors.ImageSharp ref ByteTuple4 b = ref Unsafe.As(ref MemoryMarshal.GetReference(blueChannel)); ref Rgb24 rgb = ref MemoryMarshal.GetReference(destination); - int count = destination.Length / 4; + int count = redChannel.Length / 4; for (int i = 0; i < count; i++) { ref Rgb24 d0 = ref Unsafe.Add(ref rgb, i * 4); @@ -125,7 +125,7 @@ namespace SixLabors.ImageSharp ref ByteTuple4 b = ref Unsafe.As(ref MemoryMarshal.GetReference(blueChannel)); ref Rgba32 rgb = ref MemoryMarshal.GetReference(destination); - int count = destination.Length / 4; + int count = redChannel.Length / 4; destination.Fill(new Rgba32(0, 0, 0, 255)); for (int i = 0; i < count; i++) {