From afc26ae414da7d4f0555ee8c2736d7a302cb7d46 Mon Sep 17 00:00:00 2001 From: Peter Amrehn Date: Thu, 31 Oct 2019 22:32:16 +0100 Subject: [PATCH] small improvements on the PorterDuff functions line 167: dstW + srcW + blendW = dstW + (src.W - blendW) + blendW = destination.W + source.W - blendW + blendW = destination.W + source.W line 194: dstW + blendW = (destination.W - blendW) + blendW = destination.W - blendW + blendW = destination.W --- .../PixelFormats/PixelBlenders/PorterDuffFunctions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs index d42518292..97b4458af 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs +++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs @@ -164,7 +164,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders float srcW = source.W - blendW; // calculate final alpha - float alpha = dstW + srcW + blendW; + float alpha = dstW + source.W; // calculate final color Vector4 color = (destination * dstW) + (source * srcW) + (blend * blendW); @@ -191,7 +191,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders float dstW = destination.W - blendW; // calculate final alpha - float alpha = dstW + blendW; + float alpha = destination.W; // calculate final color Vector4 color = (destination * dstW) + (blend * blendW);