From 7f2052f328cd7830e93be0d93c9682eeb0d1503e Mon Sep 17 00:00:00 2001 From: Michel-FK Date: Mon, 11 May 2020 17:17:08 +0200 Subject: [PATCH] Add pixel alpha multiply to SDL --- .../patches/0001-pixel-alpha-multiply.patch | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 FunKey/board/funkey/patches/0001-pixel-alpha-multiply.patch diff --git a/FunKey/board/funkey/patches/0001-pixel-alpha-multiply.patch b/FunKey/board/funkey/patches/0001-pixel-alpha-multiply.patch new file mode 100644 index 0000000..9539276 --- /dev/null +++ b/FunKey/board/funkey/patches/0001-pixel-alpha-multiply.patch @@ -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);