Add pixel alpha multiply to SDL

This commit is contained in:
Michel-FK 2020-05-11 17:17:08 +02:00
parent 012d02e011
commit 7f2052f328
1 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,23 @@
SDL_blit_A.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/video/SDL_blit_A.c b/src/video/SDL_blit_A.c
index 219cdcc..d8e921e 100644
--- a/src/video/SDL_blit_A.c
+++ b/src/video/SDL_blit_A.c
@@ -2679,6 +2985,7 @@ static void BlitNtoNPixelAlpha(SDL_BlitInfo *info)
int dstskip = info->d_skip;
SDL_PixelFormat *srcfmt = info->src;
SDL_PixelFormat *dstfmt = info->dst;
+ uint8_t alpha_multiply = srcfmt->alpha;
int srcbpp;
int dstbpp;
@@ -2705,6 +3012,7 @@ static void BlitNtoNPixelAlpha(SDL_BlitInfo *info)
unsigned sA;
unsigned dA;
DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA);
+ sA=(sA*alpha_multiply)>>8;
if(sA) {
DISEMBLE_RGBA(dst, dstbpp, dstfmt, Pixel, dR, dG, dB, dA);
ALPHA_BLEND(sR, sG, sB, sA, dR, dG, dB);