Fixed alpha composition when destination alpha is transparent.
authorSam Lantinga <slouken@libsdl.org>
Fri, 16 Aug 2013 09:20:33 -0700
changeset 7641 0cd36d20df2b
parent 7640 38284657fc79
child 7642 303214c66577
Fixed alpha composition when destination alpha is transparent. Jianyu Guan I found I make a big mistake that when dstA==0, I just simply let *dstp=*srcp and forgot to make dstRGB = srcRGB*srcA. The if consition "(*dstp & amask) == 0" in BlitRGBtoRGBPixelAlphaMMX and BlitRGBtoRGBPixelAlphaMMX3dNow should be removed.
src/video/SDL_blit_A.c
--- a/src/video/SDL_blit_A.c	Fri Aug 16 06:59:19 2013 -0700
+++ b/src/video/SDL_blit_A.c	Fri Aug 16 09:20:33 2013 -0700
@@ -352,7 +352,7 @@
 		Uint32 alpha = *srcp & amask;
 		if (alpha == 0) {
 			/* do nothing */
-		} else if (alpha == amask || (*dstp & amask) == 0) {
+		} else if (alpha == amask) {
 			*dstp = *srcp;
 		} else {
 			src1 = _mm_cvtsi32_si64(*srcp); /* src(ARGB) -> src1 (0000ARGB)*/
@@ -545,7 +545,7 @@
 		alpha = *srcp & amask;
 		if (alpha == 0) {
 			/* do nothing */
-		} else if (alpha == amask || (*dstp & amask) == 0) {
+		} else if (alpha == amask) {
 			*dstp = *srcp;
 		} else {
 			src1 = _mm_cvtsi32_si64(*srcp); /* src(ARGB) -> src1 (0000ARGB)*/