xserver/render picture.c,1.42,1.43 render.c,1.35,1.36

Lars Knoll <xserver-commit-u7BhqnqprCWvj1b/[email protected]> Wed, 29 Jun 2005 08:14:19 -0700 (PDT)
Newsgroups gmane.comp.freedesktop.xserver.cvs
Message-ID <[email protected]>
Committed by: lars

Update of /cvs/xserver/xserver/render
In directory gabe:/tmp/cvs-serv6914/render

Modified Files:
	picture.c render.c 
Log Message:
do not use // type comments
Fix a bug in the byteswapping code for gradients and
a memory leak in FreePicture.


Index: picture.c
===================================================================
RCS file: /cvs/xserver/xserver/render/picture.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- picture.c	29 Jun 2005 11:57:18 -0000	1.42
+++ picture.c	29 Jun 2005 15:14:17 -0000	1.43
@@ -839,24 +839,24 @@
     PictGradientStopPtr stops = pGradient->linear.stops;
     int nstops = pGradient->linear.nstops;
 
-    // The position where the gradient begins and ends
+    /* The position where the gradient begins and ends */
     begin_pos = (stops[0].x * PICT_GRADIENT_STOPTABLE_SIZE) >> 16;
     end_pos = (stops[nstops - 1].x * PICT_GRADIENT_STOPTABLE_SIZE) >> 16;
 
-    pos = 0; // The position in the color table.
+    pos = 0; /* The position in the color table. */
 
-    // Up to first point
+    /* Up to first point */
     while (pos <= begin_pos) {
         pGradient->linear.colorTable[pos] = xRenderColorToCard32(stops[0].color);
         ++pos;
     }
 
-    incr =  (1<<16)/ PICT_GRADIENT_STOPTABLE_SIZE; // the double increment.
-    dpos = incr * pos; // The position in terms of 0-1.
+    incr =  (1<<16)/ PICT_GRADIENT_STOPTABLE_SIZE; /* the double increment. */
+    dpos = incr * pos; /* The position in terms of 0-1. */
 
-    current_stop = 0; // We always interpolate between current and current + 1.
+    current_stop = 0; /* We always interpolate between current and current + 1. */
 
-    // Gradient area
+    /* Gradient area */
     while (pos < end_pos) {
         uint current_color = xRenderColorToCard32(stops[current_stop].color);
         uint next_color = xRenderColorToCard32(stops[current_stop + 1].color);
@@ -874,7 +874,7 @@
             ++current_stop;
     }
 
-    // After last point
+    /* After last point */
     while (pos < PICT_GRADIENT_STOPTABLE_SIZE) {
         pGradient->linear.colorTable[pos] = xRenderColorToCard32(stops[nstops - 1].color);
         ++pos;
@@ -1461,6 +1461,8 @@
 
     if (--pPicture->refcnt == 0)
     {
+        if (pPicture->transform)
+            xfree (pPicture->transform);
         if (!pPicture->pDrawable) {
             if (pPicture->pSourcePict) {
                 if (pPicture->pSourcePict->type != SourcePictTypeSolidFill)
@@ -1475,8 +1477,6 @@
                 FreePicture ((pointer) pPicture->alphaMap, (XID) 0);
             (*ps->DestroyPicture) (pPicture);
             (*ps->DestroyPictureClip) (pPicture);
-            if (pPicture->transform)
-                xfree (pPicture->transform);
             if (pPicture->pDrawable->type == DRAWABLE_WINDOW)
             {
                 WindowPtr	pWindow = (WindowPtr) pPicture->pDrawable;

Index: render.c
===================================================================
RCS file: /cvs/xserver/xserver/render/render.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- render.c	29 Jun 2005 11:57:18 -0000	1.35
+++ render.c	29 Jun 2005 15:14:17 -0000	1.36
@@ -2506,7 +2506,7 @@
     swapl(&stuff->p1.y, n);
     swapl(&stuff->p2.x, n);
     swapl(&stuff->p2.y, n);
-    swaps(&stuff->nStops, n);
+    swapl(&stuff->nStops, n);
 
     len = (client->req_len << 2) - sizeof(xRenderCreateLinearGradientReq);
     if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor)))
@@ -2533,7 +2533,7 @@
     swapl(&stuff->outer.y, n);
     swapl(&stuff->inner_radius, n);
     swapl(&stuff->outer_radius, n);
-    swaps(&stuff->nStops, n);
+    swapl(&stuff->nStops, n);
 
     len = (client->req_len << 2) - sizeof(xRenderCreateRadialGradientReq);
     if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor)))
@@ -2557,7 +2557,7 @@
     swapl(&stuff->center.x, n);
     swapl(&stuff->center.y, n);
     swapl(&stuff->angle, n);
-    swaps(&stuff->nStops, n);
+    swapl(&stuff->nStops, n);
 
     len = (client->req_len << 2) - sizeof(xRenderCreateConicalGradientReq);
     if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor)))