summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTilman Sauerbeck <tilman@code-monkey.de>2006-09-13 14:56:29 +0200
committerTilman Sauerbeck <tilman@code-monkey.de>2006-09-13 14:56:29 +0200
commit965faa3661f73a1d4cbf6368458244dff45a76ad (patch)
treee23dc6daa375a5b90440afdfd685eb1a0028871b
parent14202e7c47326e8678bf38a6bda63d608f1f152b (diff)
Only use the source texture's alpha channel if it actually has one.
-rw-r--r--src/mga_exa.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mga_exa.c b/src/mga_exa.c
index c5d1705..f93700f 100644
--- a/src/mga_exa.c
+++ b/src/mga_exa.c
@@ -547,9 +547,15 @@ mgaPrepareComposite(int op, PicturePtr pSrcPict, PicturePtr pMaskPict,
if (pMask)
PrepareSourceTexture(1, pMaskPict, pMask);
- /* C = Cs A = As */
- ds0 = C_ARG1_CUR | COLOR_ARG1 |
- A_ARG1_CUR | ALPHA_ARG1;
+ ds0 = C_ARG1_CUR | COLOR_ARG1; /* C = Cs */
+
+ /* If the source texture has an alpha channel, use it.
+ * Otherwise, set the alpha channel to 0xff (see FCOL setting above).
+ */
+ if (PICT_FORMAT_A(pSrcPict->format))
+ ds0 |= A_ARG1_CUR | ALPHA_ARG1; /* A = As */
+ else
+ ds0 |= A_ARG2_FCOL | ALPHA_ARG2; /* A = 0xff */
if (pSrcPict->format == PICT_a8) {
if (pDstPict->format != PICT_a8) {