summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTilman Sauerbeck <tilman@code-monkey.de>2006-09-11 14:22:24 +0200
committerTilman Sauerbeck <tilman@code-monkey.de>2006-09-11 14:22:24 +0200
commit14202e7c47326e8678bf38a6bda63d608f1f152b (patch)
tree4affe2eb27dd674a0edc60c0691b4d5a42ccd4c8
parent35651deb8fc3b8b7b0cf4895732f2edeecdabeb7 (diff)
Support masks without alpha.
-rw-r--r--src/mga_exa.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/mga_exa.c b/src/mga_exa.c
index ad6f5eb..c5d1705 100644
--- a/src/mga_exa.c
+++ b/src/mga_exa.c
@@ -386,11 +386,6 @@ mgaCheckComposite(int op, PicturePtr pSrcPict, PicturePtr pMaskPict,
return FALSE;
if (pMaskPict) {
- if (!PICT_FORMAT_A(pMaskPict->format)) {
- DEBUG_MSG(("Mask without alpha unsupported\n"));
- return FALSE;
- }
-
if (!mgaCheckSourceTexture(1, pMaskPict))
return FALSE;
@@ -619,6 +614,15 @@ mgaPrepareComposite(int op, PicturePtr pSrcPict, PicturePtr pMaskPict,
blendcntl = (blendcntl & ~MGA_SRC_BLEND_MASK) | MGA_SRC_ZERO;
}
+ if (!PICT_FORMAT_A(pSrcPict->format) && mgaBlendOp[op].src_alpha) {
+ int dblend = blendcntl & MGA_DST_BLEND_MASK;
+
+ if (dblend == MGA_DST_SRC_ALPHA)
+ blendcntl = (blendcntl & ~MGA_DST_BLEND_MASK) | MGA_DST_ONE;
+ else if (dblend == MGA_DST_ONE_MINUS_SRC_ALPHA)
+ blendcntl = (blendcntl & ~MGA_DST_BLEND_MASK) | MGA_DST_ZERO;
+ }
+
WAITFIFO(4);
OUTREG(MGAREG_TDUALSTAGE0, ds0);
OUTREG(MGAREG_TDUALSTAGE1, ds1);