Use negative strides in Xgl if pixel data have bottom-top scanline order
This commit is contained in:
		
							parent
							
								
									2dd76d646c
								
							
						
					
					
						commit
						1d994e1d14
					
				|  | @ -698,7 +698,6 @@ Bool | |||
| xglSetPixels (DrawablePtr pDrawable, | ||||
| 	      char        *src, | ||||
| 	      int	  stride, | ||||
| 	      Bool	  upsideDown, | ||||
| 	      int	  x, | ||||
| 	      int	  y, | ||||
| 	      int	  width, | ||||
|  |  | |||
|  | @ -159,7 +159,6 @@ xglPutImage (DrawablePtr pDrawable, | |||
| 		if (xglSetPixels (pDrawable, | ||||
| 				  bits, | ||||
| 				  PixmapBytePad (w, pDrawable->depth), | ||||
| 				  FALSE, | ||||
| 				  x + pDrawable->x, y + pDrawable->y, | ||||
| 				  w, h, | ||||
| 				  REGION_RECTS (pGC->pCompositeClip), | ||||
|  |  | |||
|  | @ -30,7 +30,6 @@ Bool | |||
| xglSetPixels (DrawablePtr pDrawable, | ||||
| 	      char        *src, | ||||
| 	      int	  stride, | ||||
| 	      Bool	  upsideDown, | ||||
| 	      int	  x, | ||||
| 	      int	  y, | ||||
| 	      int	  width, | ||||
|  | @ -45,7 +44,6 @@ xglSetPixels (DrawablePtr pDrawable, | |||
|     BoxPtr		 pDstBox; | ||||
|     int			 nDstBox; | ||||
|     int			 dstXoff, dstYoff, dstBpp; | ||||
|     int			 dstY, srcY; | ||||
|     int			 x1, y1, x2, y2; | ||||
| 
 | ||||
|     XGL_DRAWABLE_PIXMAP (pDrawable); | ||||
|  | @ -94,21 +92,11 @@ xglSetPixels (DrawablePtr pDrawable, | |||
| 	 | ||||
| 	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 @@ xglSetPixels (DrawablePtr pDrawable, | |||
| 		   FB_ALLONES, | ||||
| 		   dstBpp, | ||||
| 		   FALSE, | ||||
| 		   upsideDown != XGL_INTERNAL_SCANLINE_ORDER_UPSIDE_DOWN); | ||||
| 		   FALSE); | ||||
| 
 | ||||
| 	    pDstBox[nDstBox].x1 = x1; | ||||
| 	    pDstBox[nDstBox].y1 = y1; | ||||
|  |  | |||
|  | @ -423,18 +423,30 @@ xglMapPixmapBits (PixmapPtr pPixmap) | |||
| { | ||||
|     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; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue