From 78eb2f176473b332fa318ab5ac87d878dba46a43 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Mon, 20 Feb 2023 13:28:44 +1000 Subject: [PATCH] Use WithW --- .../PixelBlenders/PorterDuffFunctions.cs | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs index cd85939e03..bc7958f857 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs +++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs @@ -278,9 +278,7 @@ internal static partial class PorterDuffFunctions // unpremultiply color /= Vector4.Max(alpha, new(Constants.Epsilon)); - color.W = alpha.W; - - return color; + return WithW(color, alpha); } /// @@ -339,9 +337,7 @@ internal static partial class PorterDuffFunctions // unpremultiply color /= Vector4.Max(alpha, new(Constants.Epsilon)); - color.W = alpha.W; - - return color; + return WithW(color, alpha); } /// @@ -385,9 +381,7 @@ internal static partial class PorterDuffFunctions Vector4 color = source * alpha; // premultiply color /= Vector4.Max(alpha, new(Constants.Epsilon)); // unpremultiply - color.W = alpha.W; - - return color; + return WithW(color, alpha); } /// @@ -425,9 +419,7 @@ internal static partial class PorterDuffFunctions Vector4 color = source * alpha; // premultiply color /= Vector4.Max(alpha, new(Constants.Epsilon)); // unpremultiply - color.W = alpha.W; - - return color; + return WithW(color, alpha); } /// @@ -470,9 +462,7 @@ internal static partial class PorterDuffFunctions // unpremultiply color /= Vector4.Max(alpha, new(Constants.Epsilon)); - color.W = alpha.W; - - return color; + return WithW(color, alpha); } ///