From 472089abfbe9eaf9771c226471752a3a7b5558fd Mon Sep 17 00:00:00 2001 From: Socolin Date: Fri, 19 Dec 2025 02:26:03 -0500 Subject: [PATCH] Use bulk overload to convert the pixel row from Vector4 to Rgb in ApplyRgbaCompatibleIccProfile --- src/ImageSharp/Formats/Png/PngDecoderCore.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/ImageSharp/Formats/Png/PngDecoderCore.cs b/src/ImageSharp/Formats/Png/PngDecoderCore.cs index 2a2b07389d..5ad2682335 100644 --- a/src/ImageSharp/Formats/Png/PngDecoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngDecoderCore.cs @@ -2178,13 +2178,8 @@ internal sealed class PngDecoderCore : ImageDecoderCore { using IMemoryOwner rgbBuffer = image.Configuration.MemoryAllocator.Allocate(pixelsRow.Length); Span rgbPacked = rgbBuffer.Memory.Span; - ref Rgb rgbPackedRef = ref MemoryMarshal.GetReference(rgbPacked); - - for (int x = 0; x < pixelsRow.Length; x++) - { - Unsafe.Add(ref rgbPackedRef, x) = Rgb.FromScaledVector4(pixelsRow[x]); - } + Rgb.FromScaledVector4(pixelsRow, rgbPacked); converter.Convert(rgbPacked, rgbPacked); Span pixelsRowAsFloats = MemoryMarshal.Cast(pixelsRow);