[Scummvm-devel] blendPixelPtr()

Marcus Comstedt marcus at mc.pp.se
Fri Jan 10 14:36:24 CET 2014


Hi.

Could someone please explain what the deal is with commit 264ba4a9?

The message says "Keep dst alpha unchanged when blending colours", and
I can see that the code change does just that, but...  WHY?

Now the resulting alpha is incorrect.  Let's say that the old pixel
was completely transparent (R=G=B=A=0.0).  On this we want to plot a
fully opaque green pixel (R=B=0.0, G=A=1.0).  With the code change,
the result becomes a pixel with G=1.0 and R=B=A=0.0, which is clearly
wrong; the alpha should be 1.0.  If this green pixel were to appear
above a red pixel for example, then then the full colour components of
that red pixel would be added to the green pixel on display (because
A=0.0), resulting in a yellow pixel, not a green one as intended...


  // Marcus






More information about the Scummvm-devel mailing list