diff options
| author | Roy Qu <[email protected]> | 2022-06-16 20:47:46 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-06-16 14:47:46 +0200 |
| commit | 09643530738aca2674029b3d045b9492dc9bf86c (patch) | |
| tree | 130141e55ef46aa4f1501a300e5f6b0fc1b1725f /src | |
| parent | 309ad3e08b8ec55d4690b628a2987d568d0f3cb1 (diff) | |
| download | raylib-09643530738aca2674029b3d045b9492dc9bf86c.tar.gz raylib-09643530738aca2674029b3d045b9492dc9bf86c.zip | |
fix: round off error in ColorAlphaBlend (#2524)
Diffstat (limited to 'src')
| -rw-r--r-- | src/rtextures.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/rtextures.c b/src/rtextures.c index d10fc8a8..3328553c 100644 --- a/src/rtextures.c +++ b/src/rtextures.c @@ -3809,10 +3809,10 @@ Color ColorAlphaBlend(Color dst, Color src, Color tint) Color out = WHITE; // Apply color tint to source color - src.r = (unsigned char)(((unsigned int)src.r*(unsigned int)tint.r) >> 8); - src.g = (unsigned char)(((unsigned int)src.g*(unsigned int)tint.g) >> 8); - src.b = (unsigned char)(((unsigned int)src.b*(unsigned int)tint.b) >> 8); - src.a = (unsigned char)(((unsigned int)src.a*(unsigned int)tint.a) >> 8); + src.r = (unsigned char)(((unsigned int)src.r*((unsigned int)tint.r+1)) >> 8); + src.g = (unsigned char)(((unsigned int)src.g*((unsigned int)tint.g+1)) >> 8); + src.b = (unsigned char)(((unsigned int)src.b*((unsigned int)tint.b+1)) >> 8); + src.a = (unsigned char)(((unsigned int)src.a*((unsigned int)tint.a+1)) >> 8); //#define COLORALPHABLEND_FLOAT #define COLORALPHABLEND_INTEGERS |
