render improvements

Eric Anholt eta at lclark.edu
Wed Jun 15 11:03:00 PDT 2005


On Wed, 2005-06-15 at 19:37 +0200, Zack Rusin wrote:
> On Wednesday 15 June 2005 19:02, Keith Packard wrote:
> > On Wed, 2005-06-15 at 14:26 +0200, Lars Knoll wrote:
> > > It should be all fixed now (in xserver). I'll prepare a patch for xorg
> > > now and submit it later today.
> >
> > Thanks for fixing this.  I'm having trouble following your patches
> > because of the large number of white-space only changes.  Is there some
> > way you can convince your text editor to leave unedited lines alone?
> 
> This is an artifact of our emacs configurations. It's only a problem because 
> the freedesktop cvs script generates funky patches. We could remove it but a 
> lot more general and proper fix would be to simply add -b -B switches to the 
> script that generates the diff on the server.

It's really bad style to commit whitespace diffs in with content
changes.  It makes it harder for someone reviewing your diff later to
find what was content and what wasn't (and I find -b to often make
things confusing when looking at newly-in/outdented blocks).  If you
need to fix whitespace as part of committing, please do it beforehand.

-- 
Eric Anholt                                     eta at lcla/cvs/xorg/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/vm86
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           6Ê   .   1Ê   ..  7Ê  èCVS                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             7Ê   .   6Ê   ..  8Ê   
Repository  …É  ÔEntries É  ÄEntries.Log …É  °Entries.Backup                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          /xorg.xml/1.3/=//
/xorg.lst/1.3/=//
/xorg-it.lst/1.2/=//
/xorg/1.3/=//
/xml2lst.pl/1.1.1.1/=//
/xkb.dtd/1.1.1.2/=//
/xfree98.lst/1.2/=//
/xfree98/1.2/=//
/sun.lst/1.2/=//
/sun/1.2/=//
/sgi.lst/1.2/=//
/sgi/1.1.1.1/=//
/README/1.2/=//
/Imakefile/1.4/=//
D
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ixed_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;
+                    }
 
-                x1 = xFixedToInt(v.vector[0]);
+                    div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2];
+                    x1 = div >> 16;
+                    distx = ((xFixed)div >> 8) & 0xff;
                 x2 = x1 + 1;
-                y1 = xFixedToInt(v.vector[1]);
+                    div = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2];
+                    y1 = div >> 16;
                 y2 = y1 + 1;
-                if (pict->repeat)
-                {
-                    x1 = mod (x1, pict->pDrawable->width);
-                    y1 = mod (y1, pict->pDrawable->height);
-                    x2 = mod (x2, pict->pDrawable->width);
-                    y2 = mod (y2, pict->pDrawable->height);
-                }
+                    disty = ((xFixed)div >> 8) & 0xff;
 
-                distx = ((v.vector[0] - (x1 << 16)) >> 8);
-                disty = ((v.vector[1] - (y1 << 16)) >> 8);
                 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;
@@ -2795,36 +2932,45 @@ static void fbFetchTransformed(PicturePt
                 buffer[i] = tl;
             }
         }
+        }
     } else if (pict->filter == PictFilterConvolution) {
         xFixed *params = pict->filter_params;
         INT32 cwidth = xFixedToInt(params[0]);
         INT32 cheight = xFixedToInt(params[1]);
-        v.vector[0] -= params[0] >> 2;
-        v.vector[1] -= params[1] >> 2;
+        int xoff = params[0] >> 1;
+        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, sum;
             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;
+            }
 
-            x1 = xFixedToInt(v.vector[0]);
+            tmp = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2] - xoff;
+            x1 = xFixedToInt(tmp);
             x2 = x1 + cwidth;
-            y1 = xFixedToInt(v.vector[1]);
+            tmp = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2] - yoff;
+            y1 = xFixedToInt(tmp);
             y2 = y1 + cheight;
 
             srtot = sgtot = sbtot = satot = sum = 0;
 
             for (y = y1; y < y2; y++) {
-                int ty = (pict->repeat) ? mod (y, pict->pDrawable->height) : y;
+                int ty = (pict->repeat) ? MOD (y, pict->pDrawable->height) : y;
                 for (x = x1; x < x2; x++) {
-                    if (*params) {
-                        int tx = (pict->repeat) ? mod (x, pict->pDrawable->width) : x;
+                    if (*p) {
+                        int tx = (pict->repeat) ? 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);
+                            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;
@@ -2961,7 +3107,7 @@ fbCompositeRect (const FbComposeData *da
             fetchMask = fbFetchExternalAlpha;
         else if (data->mask->repeat && data->mask->pDrawable->width == 1 && data->mask->pDrawable->height == 1)
             fetchMask = fbFetchSolid;
-        else if (!data->mask->transform && data->src->filter != PictFilterConvolution)
+        else if (!data->mask->transform && data->mask->filter != PictFilterConvolution)
             fetchMask = fbFetch;
         else
             fetchMask = fbFetchTransformed;
@@ -3060,7 +3206,8 @@ fbCompositeGeneral (CARD8	op,
     RegionRec	    region;
     int		    n;
     BoxPtr	    pbox;
-    Bool	    srcRepeat = pSrc->repeat && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1);
+    Bool	    srcRepeat = pSrc->repeat && !pSrc->transform
+                                && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1);
     Bool	    maskRepeat = FALSE;
     int		    w, h;
     CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3];
@@ -3069,7 +3216,8 @@ fbCompositeGeneral (CARD8	op,
 
 
     if (pMask)
-	maskRepeat = pMask->repeat && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1);
+	maskRepeat = pMask->repeat  && !pMask->transform
+                     && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1);
 
     if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format))
         op = PictOpSrc;
Index: include/picturestr.h
===================================================================
RCS file: /cvs/xserver/xserver/include/picturestr.h,v
retrieving revision 1.28
diff -u -b -p -r1.28 picturestr.h
--- include/picturestr.h	26 Jan 2005 00:20:27 -0000	1.28
+++ include/picturestr.h	15 Jun 2005 12:06:05 -0000
@@ -532,6 +532,10 @@ Bool
 PictureTransformPoint (PictTransformPtr transform,
 		       PictVectorPtr	vector);
 
+Bool
+PictureTransformPoint3d (PictTransformPtr transform,
+                         PictVectorPtr	vector);
+
 void RenderExtensionInit (void);
 
 Bool
Index: render/picture.c
===================================================================
RCS file: /cvs/xserver/xserver/render/picture.c,v
retrieving revision 1.40
diff -u -b -p -r1.40 picture.c
--- render/picture.c	2 Mar 2005 15:30:04 -0000	1.40
+++ render/picture.c	15 Jun 2005 12:06:05 -0000
@@ -1353,6 +1353,35 @@ AddTraps (PicturePtr	pPicture,
 #define MIN_FIXED_48_16	    (-((xFixed_48_16) 1 << 31))
 
 Bool
+PictureTransformPoint3d (PictTransformPtr transform,
+                         PictVectorPtr	vector)
+{
+    PictVector	    result;
+    int		    i, j;
+    xFixed_32_32    partial;
+    xFixed_48_16    v;
+
+    for (j = 0; j < 3; j++)
+    {
+	v = 0;
+	for (i = 0; i < 3; i++)
+	{
+	    partial = ((xFixed_48_16) transform->matrix[j][i] *
+		       (xFixed_48_16) vector->vector[i]);
+	    v += partial >> 16;
+	}
+	if (v > MAX_FIXED_48_16 || v < MIN_FIXED_48_16)
+	    return FALSE;
+	result.vector[j] = (xFixed) v;
+    }
+    if (!result.vector[2])
+	return FALSE;
+    *vector = result;
+    return TRUE;
+}
+
+
+Bool
 PictureTransformPoint (PictTransformPtr transform,
 		       PictVectorPtr	vector)
 {

--Boundary-00=_DRHsC3GIx4Oy1HY--



More information about the xorg mailing list