Simplify SDL_BLENDMODE_MUL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
diff --git a/include/SDL_blendmode.h b/include/SDL_blendmode.h
index b862116..4ecbe50 100644
--- a/include/SDL_blendmode.h
+++ b/include/SDL_blendmode.h
@@ -52,7 +52,7 @@ typedef enum
dstA = dstA */
SDL_BLENDMODE_MUL = 0x00000008, /**< color multiply
dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA))
- dstA = (srcA * dstA) + (dstA * (1-srcA)) */
+ dstA = dstA */
SDL_BLENDMODE_INVALID = 0x7FFFFFFF
/* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */
diff --git a/src/render/software/SDL_draw.h b/src/render/software/SDL_draw.h
index 1492286..db593f4 100644
--- a/src/render/software/SDL_draw.h
+++ b/src/render/software/SDL_draw.h
@@ -91,7 +91,7 @@
#define DRAW_SETPIXEL_MUL(getpixel, setpixel) \
do { \
unsigned sr, sg, sb, sa; \
- sa = 0xFF; \
+ (void)sa; \
getpixel; \
sr = DRAW_MUL(sr, r) + DRAW_MUL(inva, sr); \
if (sr > 0xff) \
@@ -102,9 +102,6 @@
sb = DRAW_MUL(sb, b) + DRAW_MUL(inva, sb); \
if (sb > 0xff) \
sb = 0xff; \
- sa = DRAW_MUL(sa, a) + DRAW_MUL(inva, sa); \
- if (sa > 0xff) \
- sa = 0xff; \
setpixel; \
} while (0)
diff --git a/src/render/software/SDL_triangle.c b/src/render/software/SDL_triangle.c
index 77ae3ac..fc429db 100644
--- a/src/render/software/SDL_triangle.c
+++ b/src/render/software/SDL_triangle.c
@@ -869,10 +869,6 @@ static void SDL_BlitTriangle_Slow(SDL_BlitInfo *info,
if (dstB > 255) {
dstB = 255;
}
- dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255;
- if (dstA > 255) {
- dstA = 255;
- }
break;
}
if (FORMAT_HAS_ALPHA(dstfmt_val)) {
diff --git a/src/video/SDL_blit_slow.c b/src/video/SDL_blit_slow.c
index bbdfb1d..9ea5c38 100644
--- a/src/video/SDL_blit_slow.c
+++ b/src/video/SDL_blit_slow.c
@@ -178,10 +178,6 @@ void SDL_Blit_Slow(SDL_BlitInfo *info)
if (dstB > 255) {
dstB = 255;
}
- dstA = ((srcA * dstA) + (dstA * (255 - srcA))) / 255;
- if (dstA > 255) {
- dstA = 255;
- }
break;
}
if (FORMAT_HAS_ALPHA(dstfmt_val)) {