Skip to content

Commit 41c7651

Browse files
Merge pull request #1042 from jongleur1983/PorterDuffImprovement
small improvements on the PorterDuff functions
2 parents d091027 + f076b30 commit 41c7651

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public static Vector4 Over(Vector4 destination, Vector4 source, Vector4 blend)
164164
float srcW = source.W - blendW;
165165

166166
// calculate final alpha
167-
float alpha = dstW + srcW + blendW;
167+
float alpha = dstW + source.W;
168168

169169
// calculate final color
170170
Vector4 color = (destination * dstW) + (source * srcW) + (blend * blendW);
@@ -191,7 +191,7 @@ public static Vector4 Atop(Vector4 destination, Vector4 source, Vector4 blend)
191191
float dstW = destination.W - blendW;
192192

193193
// calculate final alpha
194-
float alpha = dstW + blendW;
194+
float alpha = destination.W;
195195

196196
// calculate final color
197197
Vector4 color = (destination * dstW) + (blend * blendW);

0 commit comments

Comments
 (0)