mirror of
https://github.com/thorvg/thorvg.git
synced 2025-07-28 09:05:52 +00:00
sw_engine common: improving the alpha blending algorithm
Calculations accuracy in ALPHA_BLEND function has been improved. Until now blending resulted in a slight hue change (all color channels affected). The chosen method of calculation is a compromise between the accuracy and the performance.
This commit is contained in:
parent
c7a156d5a6
commit
6ccebb3234
1 changed files with 2 additions and 2 deletions
|
@ -268,8 +268,8 @@ static inline SwCoord TO_SWCOORD(float val)
|
|||
|
||||
static inline uint32_t ALPHA_BLEND(uint32_t c, uint32_t a)
|
||||
{
|
||||
return (((((c >> 8) & 0x00ff00ff) * a) & 0xff00ff00) +
|
||||
((((c & 0x00ff00ff) * a) >> 8) & 0x00ff00ff));
|
||||
return (((((c >> 8) & 0x00ff00ff) * a + 0x00ff00ff) & 0xff00ff00) +
|
||||
((((c & 0x00ff00ff) * a + 0x00ff00ff) >> 8) & 0x00ff00ff));
|
||||
}
|
||||
|
||||
static inline uint32_t COLOR_INTERPOLATE(uint32_t c1, uint32_t a1, uint32_t c2, uint32_t a2)
|
||||
|
|
Loading…
Add table
Reference in a new issue