diff options
author | Eric Anholt <anholt@freebsd.org> | 2004-05-12 01:49:46 +0000 |
---|---|---|
committer | Eric Anholt <anholt@freebsd.org> | 2004-05-12 01:49:46 +0000 |
commit | 4078457919708a8dbf9db8ee6e4871ecbf72518f (patch) | |
tree | c18d592ce3e44f1fcf8a7b82014033ef2434b855 /fb | |
parent | a43d5412b4d79d67af20dc8af144a9ca80263e9d (diff) | |
download | xserver-4078457919708a8dbf9db8ee6e4871ecbf72518f.tar.gz |
Fix problems in render fb implementation found by rendercheck:
- fbCombineSaturate was pointed at fbCombineDisjointOver, instead of
fbCombineDisjointOverReverse as it should. Instead, point
fbCombineDisjointOverReverse at fbCombineSaturate (which is likely to
be faster).
- fix previously-unused fbCombineSaturate implementation.
- fbCombineMaskAlphaC was just a copy of fbCombineMaskValueC. Make it do
what it's supposed to (return a cs.alpha).
- fbCombineAtopC didn't invert the source alpha value.
- fix copy'n'paste errors in fbCombine(Dis/Con)jointGeneralC, also source
alpha wasn't treated in a component fashion.
- fbCompositeSrc_8888* didn't handle when the source lacks an alpha
channel. Rather than adding that and possilby slowing down the (normal)
alpha case, don't let x8r8g8b8/x8b8g8r8 Pictures be used in
fbCompositeSrc_8888* because Over with one of these is just Src.
Diffstat (limited to 'fb')
-rw-r--r-- | fb/fbcompose.c | 136 | ||||
-rw-r--r-- | fb/fbpict.c | 2 | ||||
-rw-r--r-- | fb/fbpict.h | 11 |
3 files changed, 65 insertions, 84 deletions
diff --git a/fb/fbcompose.c b/fb/fbcompose.c index f650c972a..e0be7b155 100644 --- a/fb/fbcompose.c +++ b/fb/fbcompose.c @@ -1,5 +1,5 @@ /* - * $XdotOrg: xc/programs/Xserver/fb/fbcompose.c,v 1.18 2003/12/04 17:15:12 tsi Exp $ + * $XdotOrg: xc/programs/Xserver/fb/fbcompose.c,v 1.2 2004/04/23 19:05:14 eich Exp $ * $XFree86: xc/programs/Xserver/fb/fbcompose.c,v 1.17tsi Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. @@ -191,15 +191,15 @@ fbCombineMaskAlphaC (FbCompositeOperand *src, a = (*msk->fetcha) (msk); if (!a) return 0; - - x = (*src->fetcha) (src); - if (a == 0xffffffff) - return x; - - m = FbInC(x,0,a,t); - n = FbInC(x,8,a,t); - o = FbInC(x,16,a,t); - p = FbInC(x,24,a,t); + + x = (*src->fetch) (src) >> 24; + if (x == 0xff) + return a; + + m = FbInU(a,0,x,t); + n = FbInU(a,8,x,t); + o = FbInU(a,16,x,t); + p = FbInU(a,24,x,t); return m|n|o|p; } @@ -608,7 +608,7 @@ fbCombineAtopC (FbCompositeOperand *src, cs = fbCombineMaskC (src, msk); d = (*dst->fetch) (dst); s = cs.value; - ad = cs.alpha; + ad = ~cs.alpha; as = d >> 24; m = FbGen(s,d,0,as,FbGet8(ad,0),t,u,v); n = FbGen(s,d,8,as,FbGet8(ad,8),t,u,v); @@ -698,10 +698,10 @@ fbCombineXorC (FbCompositeOperand *src, s = cs.value; ad = ~cs.alpha; as = ~d >> 24; - m = FbGen(s,d,0,as,ad,t,u,v); - n = FbGen(s,d,8,as,ad,t,u,v); - o = FbGen(s,d,16,as,ad,t,u,v); - p = FbGen(s,d,24,as,ad,t,u,v); + m = FbGen(s,d,0,as,FbGet8(ad,0),t,u,v); + n = FbGen(s,d,8,as,FbGet8(ad,8),t,u,v); + o = FbGen(s,d,16,as,FbGet8(ad,16),t,u,v); + p = FbGen(s,d,24,as,FbGet8(ad,24),t,u,v); (*dst->store) (dst, m|n|o|p); } @@ -763,10 +763,9 @@ fbCombineSaturateU (FbCompositeOperand *src, FbCompositeOperand *dst) { CARD32 s = fbCombineMaskU (src, msk), d; -#if 0 CARD16 sa, da; CARD16 ad, as; - CARD16 t; + CARD16 t, u, v; CARD32 m,n,o,p; d = (*dst->fetch) (dst); @@ -789,16 +788,6 @@ fbCombineSaturateU (FbCompositeOperand *src, p = FbGen(s,d,24,as,ad,t,u,v); } (*dst->store) (dst, m|n|o|p); -#else - if ((s >> 24) == 0xff) - (*dst->store) (dst, s); - else - { - d = (*dst->fetch) (dst); - if ((s >> 24) > (d >> 24)) - (*dst->store) (dst, s); - } -#endif } void @@ -831,7 +820,7 @@ fbCombineSaturateC (FbCompositeOperand *src, else n = FbGen (s, d, 8, (da << 8) / sg, 0xff, t, u, v); - if (sr < da) + if (sr <= da) o = FbAdd(s,d,16,t); else o = FbGen (s, d, 16, (da << 8) / sr, 0xff, t, u, v); @@ -972,8 +961,8 @@ fbCombineDisjointGeneralC (FbCompositeOperand *src, FbCompSrc cs; CARD32 s, d; CARD32 m,n,o,p; - CARD32 Fa; - CARD16 Fb, t, u, v; + CARD32 Fa, Fb; + CARD16 t, u, v; CARD32 sa; CARD8 da; @@ -996,10 +985,10 @@ fbCombineDisjointGeneralC (FbCompositeOperand *src, Fa = m|n|o|p; break; case CombineAIn: - m = fbCombineDisjointOutPart ((CARD8) (sa >> 0), da); - n = fbCombineDisjointOutPart ((CARD8) (sa >> 8), da) << 8; - o = fbCombineDisjointOutPart ((CARD8) (sa >> 16), da) << 16; - p = fbCombineDisjointOutPart ((CARD8) (sa >> 24), da) << 24; + m = fbCombineDisjointInPart ((CARD8) (sa >> 0), da); + n = fbCombineDisjointInPart ((CARD8) (sa >> 8), da) << 8; + o = fbCombineDisjointInPart ((CARD8) (sa >> 16), da) << 16; + p = fbCombineDisjointInPart ((CARD8) (sa >> 24), da) << 24; Fa = m|n|o|p; break; case CombineA: @@ -1012,19 +1001,27 @@ fbCombineDisjointGeneralC (FbCompositeOperand *src, Fb = 0; break; case CombineBOut: - Fb = fbCombineDisjointOutPart (da, sa); + m = fbCombineDisjointOutPart (da, (CARD8) (sa >> 0)); + n = fbCombineDisjointOutPart (da, (CARD8) (sa >> 8)) << 8; + o = fbCombineDisjointOutPart (da, (CARD8) (sa >> 16)) << 16; + p = fbCombineDisjointOutPart (da, (CARD8) (sa >> 24)) << 24; + Fb = m|n|o|p; break; case CombineBIn: - Fb = fbCombineDisjointInPart (da, sa); + m = fbCombineDisjointInPart (da, (CARD8) (sa >> 0)); + n = fbCombineDisjointInPart (da, (CARD8) (sa >> 8)) << 8; + o = fbCombineDisjointInPart (da, (CARD8) (sa >> 16)) << 16; + p = fbCombineDisjointInPart (da, (CARD8) (sa >> 24)) << 24; + Fb = m|n|o|p; break; case CombineB: - Fb = 0xff; + Fb = 0xffffffff; break; } - m = FbGen (s,d,0,FbGet8(Fa,0),Fb,t,u,v); - n = FbGen (s,d,8,FbGet8(Fa,8),Fb,t,u,v); - o = FbGen (s,d,16,FbGet8(Fa,16),Fb,t,u,v); - p = FbGen (s,d,24,FbGet8(Fa,24),Fb,t,u,v); + m = FbGen (s,d,0,FbGet8(Fa,0),FbGet8(Fb,0),t,u,v); + n = FbGen (s,d,8,FbGet8(Fa,8),FbGet8(Fb,8),t,u,v); + o = FbGen (s,d,16,FbGet8(Fa,16),FbGet8(Fb,16),t,u,v); + p = FbGen (s,d,24,FbGet8(Fa,24),FbGet8(Fb,24),t,u,v); s = m|n|o|p; (*dst->store) (dst, s); } @@ -1065,21 +1062,6 @@ fbCombineDisjointOverC (FbCompositeOperand *src, fbCombineDisjointGeneralC (src, msk, dst, CombineAOver); } -void -fbCombineDisjointOverReverseU (FbCompositeOperand *src, - FbCompositeOperand *msk, - FbCompositeOperand *dst) -{ - fbCombineDisjointGeneralU (src, msk, dst, CombineBOver); -} - -void -fbCombineDisjointOverReverseC (FbCompositeOperand *src, - FbCompositeOperand *msk, - FbCompositeOperand *dst) -{ - fbCombineDisjointGeneralC (src, msk, dst, CombineBOver); -} void fbCombineDisjointInU (FbCompositeOperand *src, @@ -1281,8 +1263,8 @@ fbCombineConjointGeneralC (FbCompositeOperand *src, FbCompSrc cs; CARD32 s, d; CARD32 m,n,o,p; - CARD32 Fa; - CARD16 Fb, t, u, v; + CARD32 Fa, Fb; + CARD16 t, u, v; CARD32 sa; CARD8 da; @@ -1305,10 +1287,10 @@ fbCombineConjointGeneralC (FbCompositeOperand *src, Fa = m|n|o|p; break; case CombineAIn: - m = fbCombineConjointOutPart ((CARD8) (sa >> 0), da); - n = fbCombineConjointOutPart ((CARD8) (sa >> 8), da) << 8; - o = fbCombineConjointOutPart ((CARD8) (sa >> 16), da) << 16; - p = fbCombineConjointOutPart ((CARD8) (sa >> 24), da) << 24; + m = fbCombineConjointInPart ((CARD8) (sa >> 0), da); + n = fbCombineConjointInPart ((CARD8) (sa >> 8), da) << 8; + o = fbCombineConjointInPart ((CARD8) (sa >> 16), da) << 16; + p = fbCombineConjointInPart ((CARD8) (sa >> 24), da) << 24; Fa = m|n|o|p; break; case CombineA: @@ -1321,19 +1303,27 @@ fbCombineConjointGeneralC (FbCompositeOperand *src, Fb = 0; break; case CombineBOut: - Fb = fbCombineConjointOutPart (da, sa); + m = fbCombineConjointOutPart (da, (CARD8) (sa >> 0)); + n = fbCombineConjointOutPart (da, (CARD8) (sa >> 8)) << 8; + o = fbCombineConjointOutPart (da, (CARD8) (sa >> 16)) << 16; + p = fbCombineConjointOutPart (da, (CARD8) (sa >> 24)) << 24; + Fb = m|n|o|p; break; case CombineBIn: - Fb = fbCombineConjointInPart (da, sa); + m = fbCombineConjointInPart (da, (CARD8) (sa >> 0)); + n = fbCombineConjointInPart (da, (CARD8) (sa >> 8)) << 8; + o = fbCombineConjointInPart (da, (CARD8) (sa >> 16)) << 16; + p = fbCombineConjointInPart (da, (CARD8) (sa >> 24)) << 24; + Fb = m|n|o|p; break; case CombineB: - Fb = 0xff; + Fb = 0xffffffff; break; } - m = FbGen (s,d,0,FbGet8(Fa,0),Fb,t,u,v); - n = FbGen (s,d,8,FbGet8(Fa,8),Fb,t,u,v); - o = FbGen (s,d,16,FbGet8(Fa,16),Fb,t,u,v); - p = FbGen (s,d,24,FbGet8(Fa,24),Fb,t,u,v); + m = FbGen (s,d,0,FbGet8(Fa,0),FbGet8(Fb,0),t,u,v); + n = FbGen (s,d,8,FbGet8(Fa,8),FbGet8(Fb,8),t,u,v); + o = FbGen (s,d,16,FbGet8(Fa,16),FbGet8(Fb,16),t,u,v); + p = FbGen (s,d,24,FbGet8(Fa,24),FbGet8(Fb,24),t,u,v); s = m|n|o|p; (*dst->store) (dst, s); } @@ -1519,14 +1509,14 @@ FbCombineFunc fbCombineFuncU[] = { fbCombineAtopReverseU, fbCombineXorU, fbCombineAddU, - fbCombineDisjointOverU, /* Saturate */ + fbCombineSaturateU, 0, 0, fbCombineClear, fbCombineSrcU, fbCombineDst, fbCombineDisjointOverU, - fbCombineDisjointOverReverseU, + fbCombineSaturateU, /* DisjointOverReverse */ fbCombineDisjointInU, fbCombineDisjointInReverseU, fbCombineDisjointOutU, @@ -1566,14 +1556,14 @@ FbCombineFunc fbCombineFuncC[] = { fbCombineAtopReverseC, fbCombineXorC, fbCombineAddC, - fbCombineDisjointOverC, /* Saturate */ + fbCombineSaturateC, 0, 0, fbCombineClear, /* 0x10 */ fbCombineSrcC, fbCombineDst, fbCombineDisjointOverC, - fbCombineDisjointOverReverseC, + fbCombineSaturateC, /* DisjointOverReverse */ fbCombineDisjointInC, fbCombineDisjointInReverseC, fbCombineDisjointOutC, diff --git a/fb/fbpict.c b/fb/fbpict.c index 533f08d01..3f989bc56 100644 --- a/fb/fbpict.c +++ b/fb/fbpict.c @@ -1001,7 +1001,6 @@ fbComposite (CARD8 op, { switch (pSrc->format) { case PICT_a8r8g8b8: - case PICT_x8r8g8b8: switch (pDst->format) { case PICT_a8r8g8b8: case PICT_x8r8g8b8: @@ -1016,7 +1015,6 @@ fbComposite (CARD8 op, } break; case PICT_a8b8g8r8: - case PICT_x8b8g8r8: switch (pDst->format) { case PICT_a8b8g8r8: case PICT_x8b8g8r8: diff --git a/fb/fbpict.h b/fb/fbpict.h index 9ecc7a909..927434950 100644 --- a/fb/fbpict.h +++ b/fb/fbpict.h @@ -333,15 +333,8 @@ fbCombineDisjointOverC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst); -void -fbCombineDisjointOverReverseU (FbCompositeOperand *src, - FbCompositeOperand *msk, - FbCompositeOperand *dst); - -void -fbCombineDisjointOverReverseC (FbCompositeOperand *src, - FbCompositeOperand *msk, - FbCompositeOperand *dst); +#define fbCombineDisjointOverReverseU fbCombineSaturateU +#define fbCombineDisjointOverReverseC fbCombineSaturateC void fbCombineDisjointInU (FbCompositeOperand *src, |