xserver/hw/xgl xgl.h, 1.2, 1.3 xglgc.c, 1.2, 1.3 xglpixel.c, 1.1, 1.2 xglpixmap.c, 1.2, 1.3

David Reveman <xserver-commit-u7BhqnqprCWvj1b/[email protected]>
Newsgroups gmane.comp.freedesktop.xserver.cvs
Message-ID <[email protected]>
Committed by: davidr

Update of /cvs/xserver/xserver/hw/xgl
In directory gabe:/tmp/cvs-serv8048/hw/xgl

Modified Files:
	xgl.h xglgc.c xglpixel.c xglpixmap.c 
Log Message:
Use negative strides in Xgl if pixel data have bottom-top scanline order

Index: xgl.h
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xgl.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- xgl.h	4 Nov 2004 23:19:13 -0000	1.2
+++ xgl.h	5 Nov 2004 12:46:29 -0000	1.3
@@ -698,7 +698,6 @@
 xglSetPixels (DrawablePtr pDrawable,
 	      char        *src,
 	      int	  stride,
-	      Bool	  upsideDown,
 	      int	  x,
 	      int	  y,
 	      int	  width,

Index: xglgc.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglgc.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- xglgc.c	4 Nov 2004 23:19:13 -0000	1.2
+++ xglgc.c	5 Nov 2004 12:46:29 -0000	1.3
@@ -159,7 +159,6 @@
 		if (xglSetPixels (pDrawable,
 				  bits,
 				  PixmapBytePad (w, pDrawable->depth),
-				  FALSE,
 				  x + pDrawable->x, y + pDrawable->y,
 				  w, h,
 				  REGION_RECTS (pGC->pCompositeClip),

Index: xglpixel.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglpixel.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- xglpixel.c	4 Nov 2004 23:19:13 -0000	1.1
+++ xglpixel.c	5 Nov 2004 12:46:29 -0000	1.2
@@ -30,7 +30,6 @@
 xglSetPixels (DrawablePtr pDrawable,
 	      char        *src,
 	      int	  stride,
-	      Bool	  upsideDown,
 	      int	  x,
 	      int	  y,
 	      int	  width,
@@ -45,7 +44,6 @@
     BoxPtr		 pDstBox;
     int			 nDstBox;
     int			 dstXoff, dstYoff, dstBpp;
-    int			 dstY, srcY;
     int			 x1, y1, x2, y2;
 
     XGL_DRAWABLE_PIXMAP (pDrawable);
@@ -94,21 +92,11 @@
 	
 	if (x1 < x2 && y1 < y2)
 	{
-	    if (XGL_INTERNAL_SCANLINE_ORDER_UPSIDE_DOWN)
-		dstY = pDrawable->height - (y2 + dstYoff);
-	    else
-		dstY = y1 + dstYoff;
-	    
-	    if (upsideDown)
-		srcY = height - (y2 - y);
-	    else
-		srcY = y1 - y;
-	    
-	    fbBlt (srcBits + srcY * srcStride,
+	    fbBlt (srcBits + (y1 - y) * srcStride,
 		   srcStride,
 		   (x1 - x) * dstBpp,
 		   
-		   dstBits + dstY * dstStride,
+		   dstBits + (y1 + dstYoff) * dstStride,
 		   dstStride,
 		   (x1 + dstXoff) * dstBpp,
 		   
@@ -119,7 +107,7 @@
 		   FB_ALLONES,
 		   dstBpp,
 		   FALSE,
-		   upsideDown != XGL_INTERNAL_SCANLINE_ORDER_UPSIDE_DOWN);
+		   FALSE);
 
 	    pDstBox[nDstBox].x1 = x1;
 	    pDstBox[nDstBox].y1 = y1;

Index: xglpixmap.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglpixmap.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- xglpixmap.c	4 Nov 2004 23:19:13 -0000	1.2
+++ xglpixmap.c	5 Nov 2004 12:46:29 -0000	1.3
@@ -423,18 +423,30 @@
 {
     if (!pPixmap->devPrivate.ptr)
     {
+	CARD8 *bits;
+	
 	XGL_PIXMAP_PRIV (pPixmap);
 	
 	if (!pPixmapPriv->buffer)
 	    if (!xglAllocatePixmapBits (pPixmap))
 		return FALSE;
 	
-	pPixmap->devKind = pPixmapPriv->stride;
-	pPixmap->devPrivate.ptr =
-	    glitz_buffer_map (pPixmapPriv->buffer,
-			      GLITZ_BUFFER_ACCESS_READ_WRITE);
-	if (!pPixmap->devPrivate.ptr)
+	bits = glitz_buffer_map (pPixmapPriv->buffer,
+				 GLITZ_BUFFER_ACCESS_READ_WRITE);
+	if (!bits)
 	    return FALSE;
+
+	if (XGL_INTERNAL_SCANLINE_ORDER_UPSIDE_DOWN && pPixmapPriv->format)
+	{
+	    pPixmap->devKind = -pPixmapPriv->stride;
+	    pPixmap->devPrivate.ptr =
+		bits + (pPixmap->drawable.height - 1) * pPixmapPriv->stride;
+	}
+	else
+	{
+	    pPixmap->devKind = pPixmapPriv->stride;
+	    pPixmap->devPrivate.ptr = bits;
+	}
     }
     
     return TRUE;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.