summaryrefslogtreecommitdiff
path: root/fb/fbcompose.c
diff options
context:
space:
mode:
Diffstat (limited to 'fb/fbcompose.c')
-rw-r--r--fb/fbcompose.c136
1 files changed, 63 insertions, 73 deletions
diff --git a/fb/fbcompose.c b/fb/fbcompose.c
index e374de692..181a85f4f 100644
--- a/fb/fbcompose.c
+++ b/fb/fbcompose.c
@@ -1,5 +1,5 @@
/*
- * $XdotOrg: xc/programs/Xserver/fb/fbcompose.c,v 1.1.4.2.4.2 2004/03/04 20:16:09 kaleb Exp $
+ * $XdotOrg: xc/programs/Xserver/fb/fbcompose.c,v 1.3 2004/05/12 01:49:46 anholt 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,