xserver/fb fbcompose.c,1.34,1.35
Billy Biggs
xserver-commit at pdx.freedesktop.org
Wed Aug 10 18:51:28 PDT 2005
Committed by: vektor
Update of /cvs/xserver/xserver/fb
In directory gabe:/tmp/cvs-serv8674/fb
Modified Files:
fbcompose.c
Log Message:
reviewed by: keithp
* fb/fbcompose.c: (fbFetchTransformed): Use more bits for the
intermediate values when performing bilinear interpolation to improve
the accuracy of the result. This fixes a failure in the cairo tests.
Index: fbcompose.c
===================================================================
RCS file: /cvs/xserver/xserver/fb/fbcompose.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- fbcompose.c 1 Aug 2005 19:40:34 -0000 1.34
+++ fbcompose.c 11 Aug 2005 01:51:25 -0000 1.35
@@ -2963,9 +2963,9 @@
if (!v.vector[2]) {
buffer[i] = 0;
} else {
- int x1, x2, y1, y2, distx, idistx, disty, idisty;
+ int x1, x2, y1, y2, distx, idistx, disty, idisty, k;
FbBits *b;
- CARD32 tl, tr, bl, br;
+ CARD32 tl, tr, bl, br, r;
xFixed_48_16 div;
div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2];
@@ -2993,10 +2993,14 @@
bl = fetch(b, x1 + pict->pDrawable->x, indexed);
br = fetch(b, x2 + pict->pDrawable->x, indexed);
- FbByteAddMul_256(tl, idistx, tr, distx);
- FbByteAddMul_256(bl, idistx, br, distx);
- FbByteAddMul_256(tl, idisty, bl, disty);
- buffer[i] = tl;
+ r = 0;
+ for (k = 0; k < 32; k += 8) {
+ CARD32 t, b;
+ t = FbGet8(tl,k) * idistx + FbGet8(tr,k) * distx;
+ b = FbGet8(bl,k) * idistx + FbGet8(br,k) * distx;
+ r |= ((((t * idisty) + (b * disty)) >> 16) & 0xff) << k;
+ }
+ buffer[i] = r;
}
v.vector[0] += unit.vector[0];
v.vector[1] += unit.vector[1];
@@ -3007,9 +3011,9 @@
if (!v.vector[2]) {
buffer[i] = 0;
} else {
- int x1, x2, y1, y2, distx, idistx, disty, idisty;
+ int x1, x2, y1, y2, distx, idistx, disty, idisty, k;
FbBits *b;
- CARD32 tl, tr, bl, br;
+ CARD32 tl, tr, bl, br, r;
xFixed_48_16 div;
div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2];
@@ -3041,10 +3045,14 @@
br = POINT_IN_REGION(0, pict->pCompositeClip, x2, y2, &box)
? fetch(b, x2 + pict->pDrawable->x, indexed) : 0;
- FbByteAddMul_256(tl, idistx, tr, distx);
- FbByteAddMul_256(bl, idistx, br, distx);
- FbByteAddMul_256(tl, idisty, bl, disty);
- buffer[i] = tl;
+ r = 0;
+ for (k = 0; k < 32; k += 8) {
+ CARD32 t, b;
+ t = FbGet8(tl,k) * idistx + FbGet8(tr,k) * distx;
+ b = FbGet8(bl,k) * idistx + FbGet8(br,k) * distx;
+ r |= ((((t * idisty) + (b * disty)) >> 16) & 0xff) << k;
+ }
+ buffer[i] = r;
}
v.vector[0] += unit.vector[0];
v.vector[1] += unit.vector[1];
@@ -3058,9 +3066,9 @@
if (!v.vector[2]) {
buffer[i] = 0;
} else {
- int x1, x2, y1, y2, distx, idistx, disty, idisty, x_off;
+ int x1, x2, y1, y2, distx, idistx, disty, idisty, x_off, k;
FbBits *b;
- CARD32 tl, tr, bl, br;
+ CARD32 tl, tr, bl, br, r;
Bool x1_out, x2_out, y1_out, y2_out;
xFixed_48_16 div;
@@ -3090,10 +3098,14 @@
bl = x1_out|y2_out ? 0 : fetch(b, x_off, indexed);
br = x2_out|y2_out ? 0 : fetch(b, x_off + 1, indexed);
- FbByteAddMul_256(tl, idistx, tr, distx);
- FbByteAddMul_256(bl, idistx, br, distx);
- FbByteAddMul_256(tl, idisty, bl, disty);
- buffer[i] = tl;
+ r = 0;
+ for (k = 0; k < 32; k += 8) {
+ CARD32 t, b;
+ t = FbGet8(tl,k) * idistx + FbGet8(tr,k) * distx;
+ b = FbGet8(bl,k) * idistx + FbGet8(br,k) * distx;
+ r |= ((((t * idisty) + (b * disty)) >> 16) & 0xff) << k;
+ }
+ buffer[i] = r;
}
v.vector[0] += unit.vector[0];
v.vector[1] += unit.vector[1];
@@ -3104,9 +3116,9 @@
if (!v.vector[2]) {
buffer[i] = 0;
} else {
- int x1, x2, y1, y2, distx, idistx, disty, idisty, x_off;
+ int x1, x2, y1, y2, distx, idistx, disty, idisty, x_off, k;
FbBits *b;
- CARD32 tl, tr, bl, br;
+ CARD32 tl, tr, bl, br, r;
xFixed_48_16 div;
div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2];
@@ -3134,10 +3146,14 @@
br = POINT_IN_REGION(0, pict->pCompositeClip, x2, y2, &box)
? fetch(b, x_off + 1, indexed) : 0;
- FbByteAddMul_256(tl, idistx, tr, distx);
- FbByteAddMul_256(bl, idistx, br, distx);
- FbByteAddMul_256(tl, idisty, bl, disty);
- buffer[i] = tl;
+ r = 0;
+ for (k = 0; k < 32; k += 8) {
+ CARD32 t, b;
+ t = FbGet8(tl,k) * idistx + FbGet8(tr,k) * distx;
+ b = FbGet8(bl,k) * idistx + FbGet8(br,k) * distx;
+ r |= ((((t * idisty) + (b * disty)) >> 16) & 0xff) << k;
+ }
+ buffer[i] = r;
}
v.vector[0] += unit.vector[0];
v.vector[1] += unit.vector[1];
More information about the xserver-commit
mailing list