xserver/fb fbcompose.c,1.28,1.29 fbpict.h,1.22,1.23

Lars Knoll xserver-commit at pdx.freedesktop.org
Mon Jul 4 05:18:53 PDT 2005


Committed by: lars

Update of /cvs/xserver/xserver/fb
In directory gabe:/tmp/cvs-serv9995/fb

Modified Files:
	fbcompose.c fbpict.h 
Log Message:
Fix handling of "super luminescent" colors
Fix off by one error in the transformation handling.


Index: fbcompose.c
===================================================================
RCS file: /cvs/xserver/xserver/fb/fbcompose.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- fbcompose.c	29 Jun 2005 15:14:17 -0000	1.28
+++ fbcompose.c	4 Jul 2005 12:18:51 -0000	1.29
@@ -1467,8 +1467,8 @@
         CARD32 d = dest[i];
         CARD32 ia = Alpha(~s);
 
-        FbByteMul(d, ia);
-        dest[i] = s + d;
+        FbByteMulAdd(d, ia, s);
+        dest[i] = d;
     }
 }
 
@@ -1478,9 +1478,10 @@
     int i;
     for (i = 0; i < width; ++i) {
         CARD32 s = src[i];
+        CARD32 d = dest[i];
         CARD32 ia = Alpha(~dest[i]);
-        FbByteMul(s, ia);
-        dest[i] += s;
+        FbByteMulAdd(s, ia, d);
+        dest[i] = s;
     }
 }
 
@@ -1739,8 +1740,8 @@
             {
                 CARD32 d = dest[i];
                 a = fbCombineDisjointOutPart (d >> 24, a);
-                FbByteMul(d, a);
-                s += d;
+                FbByteMulAdd(d, a, s);
+                s = d;
             }
             dest[i] = s;
         }
@@ -2085,8 +2086,8 @@
             if (a)
             {
                 CARD32 d = dest[i];
-                FbByteMulC(d, a);
-                s += d;
+                FbByteMulAddC(d, a, s);
+                s = d;
             }
             dest[i] = s;
         }
@@ -2107,8 +2108,7 @@
             CARD32 s = src[i];
             if (a != 0xff)
             {
-                FbByteMul(s, a);
-                d += s;
+                FbByteMulAdd(s, a, d);
             }
             dest[i] = s;
         }
@@ -2890,65 +2890,65 @@
             if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) {
                 box = pict->pCompositeClip->extents;
                 for (i = 0; i < width; ++i) {
-                    v.vector[0] += unit.vector[0];
-                    v.vector[1] += unit.vector[1];
-                    v.vector[2] += unit.vector[2];
                     if (!v.vector[2]) {
                         buffer[i] = 0;
-                        continue;
+                    } else {
+                        y = MOD((v.vector[1]/v.vector[2]), pict->pDrawable->height);
+                        x = MOD((v.vector[0]/v.vector[2]), pict->pDrawable->width);
+                        buffer[i] = fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed);
                     }
-                    y = MOD((v.vector[1]/v.vector[2]), pict->pDrawable->height);
-                    x = MOD((v.vector[0]/v.vector[2]), pict->pDrawable->width);
-                    buffer[i] = fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed);
-                }
-            } else {
-                for (i = 0; i < width; ++i) {
                     v.vector[0] += unit.vector[0];
                     v.vector[1] += unit.vector[1];
                     v.vector[2] += unit.vector[2];
+                }
+            } else {
+                for (i = 0; i < width; ++i) {
                     if (!v.vector[2]) {
                         buffer[i] = 0;
-                        continue;
+                    } else {
+                        y = MOD((v.vector[1]/v.vector[2]), pict->pDrawable->height);
+                        x = MOD((v.vector[0]/v.vector[2]), pict->pDrawable->width);
+                        if (POINT_IN_REGION (0, pict->pCompositeClip, x, y, &box))
+                            buffer[i] = fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed);
+                        else
+                            buffer[i] = 0;
                     }
-                    y = MOD((v.vector[1]/v.vector[2]), pict->pDrawable->height);
-                    x = MOD((v.vector[0]/v.vector[2]), pict->pDrawable->width);
-                    if (POINT_IN_REGION (0, pict->pCompositeClip, x, y, &box))
-                        buffer[i] = fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed);
-                    else
-                        buffer[i] = 0;
+                    v.vector[0] += unit.vector[0];
+                    v.vector[1] += unit.vector[1];
+                    v.vector[2] += unit.vector[2];
                 }
             }
         } else {
             if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) {
                 box = pict->pCompositeClip->extents;
                 for (i = 0; i < width; ++i) {
-                    v.vector[0] += unit.vector[0];
-                    v.vector[1] += unit.vector[1];
-                    v.vector[2] += unit.vector[2];
                     if (!v.vector[2]) {
                         buffer[i] = 0;
-                        continue;
+                    } else {
+                        y = (v.vector[1]/v.vector[2]);
+                        x = (v.vector[0]/v.vector[2]);
+                        buffer[i] = ((x < box.x1) | (x >= box.x2) | (y < box.y1) | (y >= box.y2)) ?
+                                    0 : fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed);
                     }
-                    y = (v.vector[1]/v.vector[2]);
-                    x = (v.vector[0]/v.vector[2]);
-                    buffer[i] = ((x < box.x1) | (x >= box.x2) | (y < box.y1) | (y >= box.y2)) ?
-                                0 : fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed);
-                }
-            } else {
-                for (i = 0; i < width; ++i) {
                     v.vector[0] += unit.vector[0];
                     v.vector[1] += unit.vector[1];
                     v.vector[2] += unit.vector[2];
+                }
+            } else {
+                for (i = 0; i < width; ++i) {
                     if (!v.vector[2]) {
                         buffer[i] = 0;
-                        continue;
+                    } else {
+                        y = (v.vector[1]/v.vector[2]);
+                        x = (v.vector[0]/v.vector[2]);
+                        if (POINT_IN_REGION (0, pict->pCompositeClip, x, y, &box))
+                            buffer[i] = fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed);
+                        else
+                            buffer[i] = 0;
                     }
-                    y = (v.vector[1]/v.vector[2]);
-                    x = (v.vector[0]/v.vector[2]);
-                    if (POINT_IN_REGION (0, pict->pCompositeClip, x, y, &box))
-                        buffer[i] = fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed);
-                    else
-                        buffer[i] = 0;
+                    v.vector[0] += unit.vector[0];
+                    v.vector[1] += unit.vector[1];
+                    v.vector[2] += unit.vector[2];
                 }
             }
         }
@@ -2957,192 +2957,188 @@
             if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) {
                 box = pict->pCompositeClip->extents;
                 for (i = 0; i < width; ++i) {
-                    int x1, x2, y1, y2, distx, idistx, disty, idisty;
-                    FbBits *b;
-                    CARD32 tl, tr, bl, br;
-                    xFixed_48_16 div;
-
-                    v.vector[0] += unit.vector[0];
-                    v.vector[1] += unit.vector[1];
-                    v.vector[2] += unit.vector[2];
-
                     if (!v.vector[2]) {
                         buffer[i] = 0;
-                        continue;
-                    }
-                    div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2];
-                    x1 = div >> 16;
-                    distx = ((xFixed)div >> 8) & 0xff;
-                    x2 = x1 + 1;
-                    div = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2];
-                    y1 = div >> 16;
-                    y2 = y1 + 1;
-                    disty = ((xFixed)div >> 8) & 0xff;
+                    } else {
+                        int x1, x2, y1, y2, distx, idistx, disty, idisty;
+                        FbBits *b;
+                        CARD32 tl, tr, bl, br;
+                        xFixed_48_16 div;
 
-                    idistx = 256 - distx;
-                    idisty = 256 - disty;
+                        div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2];
+                        x1 = div >> 16;
+                        distx = ((xFixed)div >> 8) & 0xff;
+                        x2 = x1 + 1;
+                        div = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2];
+                        y1 = div >> 16;
+                        y2 = y1 + 1;
+                        disty = ((xFixed)div >> 8) & 0xff;
 
-                    x1 = MOD (x1, pict->pDrawable->width);
-                    x2 = MOD (x2, pict->pDrawable->width);
-                    y1 = MOD (y1, pict->pDrawable->height);
-                    y2 = MOD (y2, pict->pDrawable->height);
+                        idistx = 256 - distx;
+                        idisty = 256 - disty;
 
-                    b = bits + (y1 + pict->pDrawable->y)*stride;
+                        x1 = MOD (x1, pict->pDrawable->width);
+                        x2 = MOD (x2, pict->pDrawable->width);
+                        y1 = MOD (y1, pict->pDrawable->height);
+                        y2 = MOD (y2, pict->pDrawable->height);
 
-                    tl = fetch(b, x1 + pict->pDrawable->x, indexed);
-                    tr = fetch(b, x2 + pict->pDrawable->x, indexed);
-                    b = bits + (y2 + pict->pDrawable->y)*stride;
-                    bl = fetch(b, x1 + pict->pDrawable->x, indexed);
-                    br = fetch(b, x2 + pict->pDrawable->x, indexed);
+                        b = bits + (y1 + pict->pDrawable->y)*stride;
 
-                    FbByteAddMul_256(tl, idistx, tr, distx);
-                    FbByteAddMul_256(bl, idistx, br, distx);
-                    FbByteAddMul_256(tl, idisty, bl, disty);
-                    buffer[i] = tl;
-                }
-            } else {
-                for (i = 0; i < width; ++i) {
-                    int x1, x2, y1, y2, distx, idistx, disty, idisty;
-                    FbBits *b;
-                    CARD32 tl, tr, bl, br;
-                    xFixed_48_16 div;
+                        tl = fetch(b, x1 + pict->pDrawable->x, indexed);
+                        tr = fetch(b, x2 + pict->pDrawable->x, indexed);
+                        b = bits + (y2 + pict->pDrawable->y)*stride;
+                        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;
+                    }
                     v.vector[0] += unit.vector[0];
                     v.vector[1] += unit.vector[1];
                     v.vector[2] += unit.vector[2];
+                }
+            } else {
+                for (i = 0; i < width; ++i) {
                     if (!v.vector[2]) {
                         buffer[i] = 0;
-                        continue;
-                    }
+                    } else {
+                        int x1, x2, y1, y2, distx, idistx, disty, idisty;
+                        FbBits *b;
+                        CARD32 tl, tr, bl, br;
+                        xFixed_48_16 div;
 
-                    div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2];
-                    x1 = div >> 16;
-                    distx = ((xFixed)div >> 8) & 0xff;
-                    x2 = x1 + 1;
-                    div = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2];
-                    y1 = div >> 16;
-                    y2 = y1 + 1;
-                    disty = ((xFixed)div >> 8) & 0xff;
+                        div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2];
+                        x1 = div >> 16;
+                        distx = ((xFixed)div >> 8) & 0xff;
+                        x2 = x1 + 1;
+                        div = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2];
+                        y1 = div >> 16;
+                        y2 = y1 + 1;
+                        disty = ((xFixed)div >> 8) & 0xff;
 
-                    idistx = 256 - distx;
-                    idisty = 256 - disty;
+                        idistx = 256 - distx;
+                        idisty = 256 - disty;
 
-                    x1 = MOD (x1, pict->pDrawable->width);
-                    x2 = MOD (x2, pict->pDrawable->width);
-                    y1 = MOD (y1, pict->pDrawable->height);
-                    y2 = MOD (y2, pict->pDrawable->height);
+                        x1 = MOD (x1, pict->pDrawable->width);
+                        x2 = MOD (x2, pict->pDrawable->width);
+                        y1 = MOD (y1, pict->pDrawable->height);
+                        y2 = MOD (y2, pict->pDrawable->height);
 
-                    b = bits + (y1 + pict->pDrawable->y)*stride;
+                        b = bits + (y1 + pict->pDrawable->y)*stride;
 
-                    tl = POINT_IN_REGION(0, pict->pCompositeClip, x1, y1, &box)
-                         ? fetch(b, x1 + pict->pDrawable->x, indexed) : 0;
-                    tr = POINT_IN_REGION(0, pict->pCompositeClip, x2, y1, &box)
-                         ? fetch(b, x2 + pict->pDrawable->x, indexed) : 0;
-                    b = bits + (y2 + pict->pDrawable->y)*stride;
-                    bl = POINT_IN_REGION(0, pict->pCompositeClip, x1, y2, &box)
-                         ? fetch(b, x1 + pict->pDrawable->x, indexed) : 0;
-                    br = POINT_IN_REGION(0, pict->pCompositeClip, x2, y2, &box)
-                         ? fetch(b, x2 + pict->pDrawable->x, indexed) : 0;
+                        tl = POINT_IN_REGION(0, pict->pCompositeClip, x1, y1, &box)
+                             ? fetch(b, x1 + pict->pDrawable->x, indexed) : 0;
+                        tr = POINT_IN_REGION(0, pict->pCompositeClip, x2, y1, &box)
+                             ? fetch(b, x2 + pict->pDrawable->x, indexed) : 0;
+                        b = bits + (y2 + pict->pDrawable->y)*stride;
+                        bl = POINT_IN_REGION(0, pict->pCompositeClip, x1, y2, &box)
+                             ? fetch(b, x1 + pict->pDrawable->x, indexed) : 0;
+                        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;
+                        FbByteAddMul_256(tl, idistx, tr, distx);
+                        FbByteAddMul_256(bl, idistx, br, distx);
+                        FbByteAddMul_256(tl, idisty, bl, disty);
+                        buffer[i] = tl;
+                    }
+                    v.vector[0] += unit.vector[0];
+                    v.vector[1] += unit.vector[1];
+                    v.vector[2] += unit.vector[2];
                 }
             }
         } else {
             if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) {
                 box = pict->pCompositeClip->extents;
                 for (i = 0; i < width; ++i) {
-                    int x1, x2, y1, y2, distx, idistx, disty, idisty, x_off;
-                    FbBits *b;
-                    CARD32 tl, tr, bl, br;
-                    Bool x1_out, x2_out, y1_out, y2_out;
-                    xFixed_48_16 div;
-
-                    v.vector[0] += unit.vector[0];
-                    v.vector[1] += unit.vector[1];
-                    v.vector[2] += unit.vector[2];
                     if (!v.vector[2]) {
                         buffer[i] = 0;
-                        continue;
-                    }
-
-                    div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2];
-                    x1 = div >> 16;
-                    distx = ((xFixed)div >> 8) & 0xff;
-                    x2 = x1 + 1;
-                    div = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2];
-                    y1 = div >> 16;
-                    y2 = y1 + 1;
-                    disty = ((xFixed)div >> 8) & 0xff;
+                    } else {
+                        int x1, x2, y1, y2, distx, idistx, disty, idisty, x_off;
+                        FbBits *b;
+                        CARD32 tl, tr, bl, br;
+                        Bool x1_out, x2_out, y1_out, y2_out;
+                        xFixed_48_16 div;
 
-                    idistx = 256 - distx;
-                    idisty = 256 - disty;
+                        div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2];
+                        x1 = div >> 16;
+                        distx = ((xFixed)div >> 8) & 0xff;
+                        x2 = x1 + 1;
+                        div = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2];
+                        y1 = div >> 16;
+                        y2 = y1 + 1;
+                        disty = ((xFixed)div >> 8) & 0xff;
 
-                    b = bits + (y1 + pict->pDrawable->y)*stride;
-                    x_off = x1 + pict->pDrawable->x;
+                        idistx = 256 - distx;
+                        idisty = 256 - disty;
 
-                    x1_out = (x1 < box.x1) | (x1 >= box.x2);
-                    x2_out = (x2 < box.x1) | (x2 >= box.x2);
-                    y1_out = (y1 < box.y1) | (y1 >= box.y2);
-                    y2_out = (y2 < box.y1) | (y2 >= box.y2);
+                        b = bits + (y1 + pict->pDrawable->y)*stride;
+                        x_off = x1 + pict->pDrawable->x;
 
-                    tl = x1_out|y1_out ? 0 : fetch(b, x_off, indexed);
-                    tr = x2_out|y1_out ? 0 : fetch(b, x_off + 1, indexed);
-                    b += stride;
-                    bl = x1_out|y2_out ? 0 : fetch(b, x_off, indexed);
-                    br = x2_out|y2_out ? 0 : fetch(b, x_off + 1, indexed);
+                        x1_out = (x1 < box.x1) | (x1 >= box.x2);
+                        x2_out = (x2 < box.x1) | (x2 >= box.x2);
+                        y1_out = (y1 < box.y1) | (y1 >= box.y2);
+                        y2_out = (y2 < box.y1) | (y2 >= box.y2);
 
-                    FbByteAddMul_256(tl, idistx, tr, distx);
-                    FbByteAddMul_256(bl, idistx, br, distx);
-                    FbByteAddMul_256(tl, idisty, bl, disty);
-                    buffer[i] = tl;
-                }
-            } else {
-                for (i = 0; i < width; ++i) {
-                    int x1, x2, y1, y2, distx, idistx, disty, idisty, x_off;
-                    FbBits *b;
-                    CARD32 tl, tr, bl, br;
-                    xFixed_48_16 div;
+                        tl = x1_out|y1_out ? 0 : fetch(b, x_off, indexed);
+                        tr = x2_out|y1_out ? 0 : fetch(b, x_off + 1, indexed);
+                        b += stride;
+                        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;
+                    }
                     v.vector[0] += unit.vector[0];
                     v.vector[1] += unit.vector[1];
                     v.vector[2] += unit.vector[2];
+                }
+            } else {
+                for (i = 0; i < width; ++i) {
                     if (!v.vector[2]) {
                         buffer[i] = 0;
-                        continue;
-                    }
+                    } else {
+                        int x1, x2, y1, y2, distx, idistx, disty, idisty, x_off;
+                        FbBits *b;
+                        CARD32 tl, tr, bl, br;
+                        xFixed_48_16 div;
 
-                    div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2];
-                    x1 = div >> 16;
-                    distx = ((xFixed)div >> 8) & 0xff;
-                    x2 = x1 + 1;
-                    div = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2];
-                    y1 = div >> 16;
-                    y2 = y1 + 1;
-                    disty = ((xFixed)div >> 8) & 0xff;
+                        div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2];
+                        x1 = div >> 16;
+                        distx = ((xFixed)div >> 8) & 0xff;
+                        x2 = x1 + 1;
+                        div = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2];
+                        y1 = div >> 16;
+                        y2 = y1 + 1;
+                        disty = ((xFixed)div >> 8) & 0xff;
 
-                    idistx = 256 - distx;
-                    idisty = 256 - disty;
+                        idistx = 256 - distx;
+                        idisty = 256 - disty;
 
-                    b = bits + (y1 + pict->pDrawable->y)*stride;
-                    x_off = x1 + pict->pDrawable->x;
+                        b = bits + (y1 + pict->pDrawable->y)*stride;
+                        x_off = x1 + pict->pDrawable->x;
 
-                    tl = POINT_IN_REGION(0, pict->pCompositeClip, x1, y1, &box)
-                         ? fetch(b, x_off, indexed) : 0;
-                    tr = POINT_IN_REGION(0, pict->pCompositeClip, x2, y1, &box)
-                         ? fetch(b, x_off + 1, indexed) : 0;
-                    b += stride;
-                    bl = POINT_IN_REGION(0, pict->pCompositeClip, x1, y2, &box)
-                         ? fetch(b, x_off, indexed) : 0;
-                    br = POINT_IN_REGION(0, pict->pCompositeClip, x2, y2, &box)
-                         ? fetch(b, x_off + 1, indexed) : 0;
+                        tl = POINT_IN_REGION(0, pict->pCompositeClip, x1, y1, &box)
+                             ? fetch(b, x_off, indexed) : 0;
+                        tr = POINT_IN_REGION(0, pict->pCompositeClip, x2, y1, &box)
+                             ? fetch(b, x_off + 1, indexed) : 0;
+                        b += stride;
+                        bl = POINT_IN_REGION(0, pict->pCompositeClip, x1, y2, &box)
+                             ? fetch(b, x_off, indexed) : 0;
+                        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;
+                        FbByteAddMul_256(tl, idistx, tr, distx);
+                        FbByteAddMul_256(bl, idistx, br, distx);
+                        FbByteAddMul_256(tl, idisty, bl, disty);
+                        buffer[i] = tl;
+                    }
+                    v.vector[0] += unit.vector[0];
+                    v.vector[1] += unit.vector[1];
+                    v.vector[2] += unit.vector[2];
                 }
             }
         }
@@ -3154,56 +3150,54 @@
         int yoff = params[1] >> 1;
         params += 2;
         for (i = 0; i < width; ++i) {
-            int x1, x2, y1, y2, x, y;
-            INT32 srtot, sgtot, sbtot, satot;
-            xFixed *p = params;
-            xFixed_48_16 tmp;
-
-            v.vector[0] += unit.vector[0];
-            v.vector[1] += unit.vector[1];
-            v.vector[2] += unit.vector[2];
             if (!v.vector[2]) {
                 buffer[i] = 0;
-                continue;
-            }
-
-            tmp = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2] - xoff;
-            x1 = xFixedToInt(tmp);
-            x2 = x1 + cwidth;
-            tmp = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2] - yoff;
-            y1 = xFixedToInt(tmp);
-            y2 = y1 + cheight;
+            } else {
+                int x1, x2, y1, y2, x, y;
+                INT32 srtot, sgtot, sbtot, satot;
+                xFixed *p = params;
+                xFixed_48_16 tmp;
+                tmp = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2] - xoff;
+                x1 = xFixedToInt(tmp);
+                x2 = x1 + cwidth;
+                tmp = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2] - yoff;
+                y1 = xFixedToInt(tmp);
+                y2 = y1 + cheight;
 
-            srtot = sgtot = sbtot = satot = 0;
+                srtot = sgtot = sbtot = satot = 0;
 
-            for (y = y1; y < y2; y++) {
-                int ty = (pict->repeat == RepeatNormal) ? MOD (y, pict->pDrawable->height) : y;
-                for (x = x1; x < x2; x++) {
-                    if (*p) {
-                        int tx = (pict->repeat == RepeatNormal) ? MOD (x, pict->pDrawable->width) : x;
-                        if (POINT_IN_REGION (0, pict->pCompositeClip, tx, ty, &box)) {
-                            FbBits *b = bits + (ty + pict->pDrawable->y)*stride;
-                            CARD32 c = fetch(b, tx + pict->pDrawable->x, indexed);
+                for (y = y1; y < y2; y++) {
+                    int ty = (pict->repeat == RepeatNormal) ? MOD (y, pict->pDrawable->height) : y;
+                    for (x = x1; x < x2; x++) {
+                        if (*p) {
+                            int tx = (pict->repeat == RepeatNormal) ? MOD (x, pict->pDrawable->width) : x;
+                            if (POINT_IN_REGION (0, pict->pCompositeClip, tx, ty, &box)) {
+                                FbBits *b = bits + (ty + pict->pDrawable->y)*stride;
+                                CARD32 c = fetch(b, tx + pict->pDrawable->x, indexed);
 
-                            srtot += Red(c) * *p;
-                            sgtot += Green(c) * *p;
-                            sbtot += Blue(c) * *p;
-                            satot += Alpha(c) * *p;
+                                srtot += Red(c) * *p;
+                                sgtot += Green(c) * *p;
+                                sbtot += Blue(c) * *p;
+                                satot += Alpha(c) * *p;
+                            }
                         }
+                        p++;
                     }
-                    p++;
                 }
-            }
 
-            if (satot < 0) satot = 0; else if (satot > 0xff) satot = 0xff;
-            if (srtot < 0) srtot = 0; else if (srtot > satot) srtot = satot;
-            if (sgtot < 0) sgtot = 0; else if (sgtot > satot) sgtot = satot;
-            if (sbtot < 0) sbtot = 0; else if (sbtot > satot) sbtot = satot;
+                if (satot < 0) satot = 0; else if (satot > 0xff) satot = 0xff;
+                if (srtot < 0) srtot = 0; else if (srtot > satot) srtot = satot;
+                if (sgtot < 0) sgtot = 0; else if (sgtot > satot) sgtot = satot;
+                if (sbtot < 0) sbtot = 0; else if (sbtot > satot) sbtot = satot;
 
-            buffer[i] = ((satot << 24) |
-                         (srtot << 16) |
-                         (sgtot <<  8) |
-                         (sbtot       ));
+                buffer[i] = ((satot << 24) |
+                             (srtot << 16) |
+                             (sgtot <<  8) |
+                             (sbtot       ));
+            }
+            v.vector[0] += unit.vector[0];
+            v.vector[1] += unit.vector[1];
+            v.vector[2] += unit.vector[2];
         }
     }
 }
@@ -3375,10 +3369,9 @@
             }
             fetchSrc = 0;
             fetchMask = 0;
-    }
+        }
 
-        for (i = 0; i < data->height; ++i)
-	    {
+        for (i = 0; i < data->height; ++i) {
             /* fill first half of scanline with source */
             if (fetchSrc) {
                 fetchSrc(data->src, data->xSrc, data->ySrc + i, data->width, src_buffer);
@@ -3388,7 +3381,7 @@
                     fetchMask(data->mask, data->xMask, data->yMask + i, data->width, dest_buffer);
                     fbCombineMaskU(src_buffer, dest_buffer, data->width);
                 }
-		}
+            }
 
             /* fill dest into second half of scanline */
             if (fetchDest)
@@ -3399,7 +3392,7 @@
 
             /* write back */
             store(data->dest, data->xDest, data->yDest + i, data->width, dest_buffer);
-	    }
+        }
     }
 }
 

Index: fbpict.h
===================================================================
RCS file: /cvs/xserver/xserver/fb/fbpict.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- fbpict.h	27 May 2005 14:15:13 -0000	1.22
+++ fbpict.h	4 Jul 2005 12:18:51 -0000	1.23
@@ -147,7 +147,7 @@
   x_c = (x_c * a) / 255
 */
 #define FbByteMul(x, a) do {                                      \
-        CARD32 t = (x & 0xff00ff) *a;                           \
+        CARD32 t = (x & 0xff00ff) *a;                             \
         t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;          \
         t &= 0xff00ff;                                            \
                                                                   \
@@ -158,17 +158,55 @@
     } while (0)
 
 /*
+  x_c = (x_c * a) / 255 + y
+*/
+#define FbByteMulAdd(x, a, y) do {                                \
+        CARD32 t = (x & 0xff00ff) * a;                            \
+        t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >&g *  reportCallback	ReportCallback	Pointer		NULL
 *  width		Width		Dimension	0
 *  x 			Position	Position	0
 *  y			Position	Position	0
 * 
 *****************************************************************************/

extern WidgetClass portholeWidgetClass;
typedef struct _PortholeClassRec *PortholeWidgetClass;
typedef struct _PortholeRec      *PortholeWidget;

#endif /* _XawPorthole_h */
@


1.1
log
@Initial revision
@
text
@@


1.1.1.1
log
@Import XFree 3.9.16
@
text
@@


1.1.1.2
log
@Import of XFree86 4.0.1d-pre
@
text
@d24 1
a24 1
/* $XFree86: xc/lib/Xaw/Porthole.h,v 1.3 1998/08/20 13:59:06 dawes Exp $ */
@


1.1.1.3
log
@Import of XFree86 4.0.1d-pre (2)
@
text
@d24 1
a24 1
/* $XFree86: xc/lib/Xaw/Porthole.h,v 1.4 1998/10/03 08:42:15 dawes Exp $ */
@


1.1.1.3.20.1
log
@Initial merge of trunk onto branch.
@
text
@d2 1
a2 1
 * $Xorg: Porthole.h,v 1.4 2000/08/17 19:45:36 cpqbld Exp $
d24 1
a24 1
/* $XFree86: xc/lib/Xaw/Porthole.h,v 1.5 2001/01/17 19:42:29 dawes Exp $ */
a28 1
#include 
@


1.1.1.4
log
@Import of XFree86 4.0.99.1
@
text
@d2 1
a2 1
 * $Xorg: Porthole.h,v 1.4 2000/08/17 19:45:36 cpqbld Exp $
d24 1
a24 1
/* $XFree86: xc/lib/Xaw/Porthole.h,v 1.5 2001/01/17 19:42:29 dawes Exp $ */
a28 1
#include 
@


1.1.1.4.4.1
log
@merge from trunk.
@
text
@@


1-0-0-20000530-merge:1.1.1.1
	bsd-1-0-0-20000530-freeze:1.1.1.1
	tdfx-2-0-20000222-merge:1.1.1.1
	tdfx-2-0-20000222-freeze:1.1.1.1
	ati-4-0-1-20000518-merge:1.1.1.1
	ati-4-0-1-20000518:1.1.1.1
	video-1-0-0-branch:1.1.1.1.0.40
	gamma-1-0-0-branch:1.1.1.1.0.38
	mgadh-0-0-3-branch:1.1.1.1.0.36
	glxmisc-3-0-0-branch:1.1.1.1.0.34
	glxmisc-2-0-0-20000503-merge:1.1.1.1
	bsd-1-0-0-branch:1.1.1.1.0.32
	glxmisc-2-0-0-20000503:1.1.1.1
	glxmisc-2-0-0-branch:1.1.1.1.0.30
	tdfx-2-0-branch:1.1.1.1.0.28
	tdfx-2-0-trunk:1.1.1.1
	glxmisc-1-0-0-20000420-merge:1.1.1.1
	glxmisc-1-0-0-20000420:1.1.1.1
	ati-4-0-1-beta:1.1.1.1
	glxmisc-1-0-0-branch:1.1.1.1.0.26
	mga-0-0-3-branch:1.1.1.1.0.24
	mga-0-0-2-20000404-merge:1.1.1.1
	ati-4-0-1-alpha:1.1.1.1
	ati-4-0-1-20000319-base:1.1.1.1
	ati-4-0-1-branch:1.1.1.1.0.22
	ati-4-0-0-20000319:1.1.1.1
	X_4_0-20000315-merge:1.1.1.1
	X_4_0:1.1.1.1
	freeze-20000226:1.1.1.1
	dispatch-0-0-3-20000225-merge:1.1.1.1
	dispatch-0-0-3-20000225:1.1.1.1
	mga-0-0-1-20000225-merge:1.1.1.1
	mga-0-0-2-branch:1.1.1.1.0.20
	smt-0-0-2-branch:1.1.1.1.0.18
	smt-0-0-1-20000222-freeze:1.1.1.1
	X_3_9_18-20000222-merge:1.1.1.1
	X_3_9_18:1.1.1.1
	smt-0-0-1-stage2c:1.1.1.1
	smt-0-0-1-stage2b:1.1.1.1.0.16
	dispatch-0-0-3-branch:1.1.1.1.0.14
	i810-20000214-beta2:1.1.1.1
	dispatch-0-0-2-20000212:1.1.1.1
	dispatch-0-0-2-branch:1.1.1.1.0.12
	i810-20000201-beta1:1.1.1.1
	dispatch-0-0-1-20000129-merge:1.1.1.1
	dispatch-0-0-1-20000128:1.1.1.1
	smt-0-0-1-20000112-base:1.1.1.1
	smt-0-0-1-branch:1.1.1.1.0.6
	dispatch-0-0-1-branch:1.1.1.1.0.10
	tdfx-1-1:1.1.1.1.0.4
	X_3_9_17:1.1.1.1
	ati-4-0-0-branch:1.1.1.1.0.8
	mga-0-0-1-branch:1.1.1.1.0.2
	X_3_9_16:1.1.1.1
	XFree:1.1.1;
locks; strict;
comment	@ * @;


1.2
date	2001.08.23.21.35.15;	author dawes;	state dead;
branches;
next	1.1;

1.1
date	99.12.05.01.01.49;	author daryll;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	99.12.05.01.01.49;	author daryll;	state Exp;
branches
	1.1.1.1.48.1
	1.1.1.1.52.1
	1.1.1.1.58.1
	1.1.1.1.66.1;
next	1.1.1.2;

1.1.1.2
date	2000.09.22.17.21.47;	author alanh;	state Exp;
branches;
next	1.1.1.3;

1.1.1.3
date	2000.09.23.20.55.01;	author alanh;	state Exp;
branches
	1.1.1.3.2.1;
next	1.1.1.4;

1.1.1.4
date	2000.11.07.22.09.51;	author dawes;	state Exp;
branches
	1.1.1.4.10.1;
next	1.1.1.5;

1.1.1.5
date	2001.03.19.17.45.16;	author dawes;	state Exp;
branches
	1.1.1.5.4.1;
next	;

1.1.1.5.4.1
date	2001.08.29.17.24.54;	author alanh;	state dead;
branches;
next	;

1.1.1.4.10.1
date	2001.03.27.20.02.50;	author gareth;	state Exp;
branches;
next	;

1.1.1.3.2.1
date	2000.11.09.22.36.24;	author alanh;	state Exp;
branches;
next	;

1.1.1.1.48.1
date	2000.10.02.14.49.50;	author mdaenzer;	state Exp;
branches;
next	;

1.1.1.1.52.1
date	2000.10.10.04.22.25;	author gareth;	state Exp;
branches;
next	1.1.1.1.52.2;

1.1.1.1.52.2
date	2000.11.26.16.19.47;	author gareth;	state Exp;
branches;
next	;

1.1.1.1.58.1
date	2001.02.15.16.59.06;	author alanh;	state Exp;
branches;
next	;

1.1.1.1.66.1
date	2000.10.18.13.02.42;	author alanh;	state Exp;
branches;
next	;


desc
@@


1.2
log
@Remove client-side libraries not needed for the DRI components.
@
text
@/* $TOG: Scrollbar.c /main/73 1998/02/06 12:48:56 kaleb $ */

/***********************************************************

Copyright 1987, 1988, 1994, 1998  The Open Group

All Rights Reserved.

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.


Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.

                        All Rights Reserved

Permission to use, copy, modify, and distribute this software and its 
documentation for any purpose and without fee is hereby granted, 
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in 
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.  

DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.

******************************************************************/
/* $XFree86: xc/lib/Xaw/Scrollbar.c,v 1.9 1999/06/06 08:48:08 dawes Exp $ */

#include 
#include 
#include 
#include 
#include 
#include "Private.h"

#define NoButton	-1
#define PICKLENGTH(widget, x, y)					\
(((widget)->scrollbar.orientation == XtorientHorizontal) ? (x) : (y))

/*
 * Class Methods
 */
static void XawScrollbarClassInitialize(void);
static void XawScrollbarDestroy(Widget);
static void XawScrollbarInitialize(Widget, Widget, ArgList, Cardinal*_args);
static void XawScrollbarRealize(Widget, Mask*, XSetWindowAttributes*);
static void XawScrollbarRedisplay(Widget, XEvent*, Region);
static void XawScrollbarResize(Widget);
static Boolean XawScrollbarSetValues(Widget, Widget, Widget,
				     ArgList, Cardinal*);

/*
 * Prototypes
 */
static Boolean CompareEvents(XEvent*, XEvent*);
static void CreateGC(Widget);
static float FloatInRange(float, float, float);
static float FractionLoc(ScrollbarWidget, int, int);
static void ExtractPosition(XEvent*, Position*, Position*);
static int InRange(int, int, int);
static void FillArea(ScrollbarWidget, int, int, int);
static Bool LookAhead(Widget, XEvent*);
static void PaintThumb(ScrollbarWidget);
static Bool PeekNotifyEvent(Display*, XEvent*, char*);
static void SetDimensions(ScrollbarWidget);

/*
 * Actions
 */
static void EndScroll(Widget, XEvent*, String*, Cardinal*);
static void MoveThumb(Widget, XEvent*, String*, Cardinal*);
static void NotifyScroll(Widget, XEvent*, String*, Cardinal*);
static void NotifyThumb(Widget, XEvent*, String*, Cardinal*);
static void StartScroll(Widget, XEvent*, String*, Cardinal*);

/*
 * Initialization
 */
static char defaultTranslations[] =
":"	"StartScroll(Forward)\n"
":"	"StartScroll(Continuous) MoveThumb() NotifyThumb()\n"
":"	"StartScroll(Backward)\n"
":"	"MoveThumb() NotifyThumb()\n"
":"	"NotifyScroll(Proportional) EndScroll()\n";

static float floatZero = 0.0;

#define Offset(field) XtOffsetOf(ScrollbarRec, field)

static XtResource resources[] = {
  {
    XtNlength,
    XtCLength,
    XtRDimension,
    sizeof(Dimension),
    Offset(scrollbar.length),
    XtRImmediate,
    (XtPointer)1
  },
  {
    XtNthickness,
    XtCThickness,
    XtRDimension,
    sizeof(Dimension),
    Offset(scrollbar.thickness),
    XtRImmediate,
    (XtPointer)14
  },
  {
    XtNorientation,
    XtCOrientation,
    XtROrientation,
    sizeof(XtOrientation),
    Offset(scrollbar.orientation),
    XtRImmediate,
    (XtPointer)XtorientVertical
  },
  {
    XtNscrollProc,
    XtCCallback,
    XtRCallback,
    sizeof(XtPointer),
    Offset(scrollbar.scrollProc),
    XtRCallback,
    NULL
  },
  {
    XtNthumbProc,
    XtCCallback,
    XtRCallback,
    sizeof(XtPointer),
    Offset(scrollbar.thumbProc),
    XtRCallback,
    NULL
  },
  {
    XtNjumpProc,
    XtCCallback,
    XtRCallback,
    sizeof(XtPointer),
    Offset(scrollbar.jumpProc),
    XtRCallback,
    NULL
  },
  {
    XtNthumb,
    XtCThumb,
    XtRBitmap,
    sizeof(Pixmap),
    Offset(scrollbar.thumb),
    XtRImmediate,
    (XtPointer)XtUnspecifiedPixmap
  },
  {
    XtNforeground,
    XtCForeground,
    XtRPixel,
    sizeof(Pixel),
    Offset(scrollbar.foreground),
    XtRString,
    XtDefaultForeground
  },
  {
    XtNshown,
    XtCShown,
    XtRFloat,
    sizeof(float