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,
 | 
					xglSetPixels (DrawablePtr pDrawable,
 | 
				
			||||||
	      char        *src,
 | 
						      char        *src,
 | 
				
			||||||
	      int	  stride,
 | 
						      int	  stride,
 | 
				
			||||||
	      Bool	  upsideDown,
 | 
					 | 
				
			||||||
	      int	  x,
 | 
						      int	  x,
 | 
				
			||||||
	      int	  y,
 | 
						      int	  y,
 | 
				
			||||||
	      int	  width,
 | 
						      int	  width,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -159,7 +159,6 @@ xglPutImage (DrawablePtr pDrawable,
 | 
				
			||||||
		if (xglSetPixels (pDrawable,
 | 
							if (xglSetPixels (pDrawable,
 | 
				
			||||||
				  bits,
 | 
									  bits,
 | 
				
			||||||
				  PixmapBytePad (w, pDrawable->depth),
 | 
									  PixmapBytePad (w, pDrawable->depth),
 | 
				
			||||||
				  FALSE,
 | 
					 | 
				
			||||||
				  x + pDrawable->x, y + pDrawable->y,
 | 
									  x + pDrawable->x, y + pDrawable->y,
 | 
				
			||||||
				  w, h,
 | 
									  w, h,
 | 
				
			||||||
				  REGION_RECTS (pGC->pCompositeClip),
 | 
									  REGION_RECTS (pGC->pCompositeClip),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,7 +30,6 @@ Bool
 | 
				
			||||||
xglSetPixels (DrawablePtr pDrawable,
 | 
					xglSetPixels (DrawablePtr pDrawable,
 | 
				
			||||||
	      char        *src,
 | 
						      char        *src,
 | 
				
			||||||
	      int	  stride,
 | 
						      int	  stride,
 | 
				
			||||||
	      Bool	  upsideDown,
 | 
					 | 
				
			||||||
	      int	  x,
 | 
						      int	  x,
 | 
				
			||||||
	      int	  y,
 | 
						      int	  y,
 | 
				
			||||||
	      int	  width,
 | 
						      int	  width,
 | 
				
			||||||
| 
						 | 
					@ -45,7 +44,6 @@ xglSetPixels (DrawablePtr pDrawable,
 | 
				
			||||||
    BoxPtr		 pDstBox;
 | 
					    BoxPtr		 pDstBox;
 | 
				
			||||||
    int			 nDstBox;
 | 
					    int			 nDstBox;
 | 
				
			||||||
    int			 dstXoff, dstYoff, dstBpp;
 | 
					    int			 dstXoff, dstYoff, dstBpp;
 | 
				
			||||||
    int			 dstY, srcY;
 | 
					 | 
				
			||||||
    int			 x1, y1, x2, y2;
 | 
					    int			 x1, y1, x2, y2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    XGL_DRAWABLE_PIXMAP (pDrawable);
 | 
					    XGL_DRAWABLE_PIXMAP (pDrawable);
 | 
				
			||||||
| 
						 | 
					@ -94,21 +92,11 @@ xglSetPixels (DrawablePtr pDrawable,
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if (x1 < x2 && y1 < y2)
 | 
						if (x1 < x2 && y1 < y2)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	    if (XGL_INTERNAL_SCANLINE_ORDER_UPSIDE_DOWN)
 | 
						    fbBlt (srcBits + (y1 - y) * srcStride,
 | 
				
			||||||
		dstY = pDrawable->height - (y2 + dstYoff);
 | 
					 | 
				
			||||||
	    else
 | 
					 | 
				
			||||||
		dstY = y1 + dstYoff;
 | 
					 | 
				
			||||||
	    
 | 
					 | 
				
			||||||
	    if (upsideDown)
 | 
					 | 
				
			||||||
		srcY = height - (y2 - y);
 | 
					 | 
				
			||||||
	    else
 | 
					 | 
				
			||||||
		srcY = y1 - y;
 | 
					 | 
				
			||||||
	    
 | 
					 | 
				
			||||||
	    fbBlt (srcBits + srcY * srcStride,
 | 
					 | 
				
			||||||
		   srcStride,
 | 
							   srcStride,
 | 
				
			||||||
		   (x1 - x) * dstBpp,
 | 
							   (x1 - x) * dstBpp,
 | 
				
			||||||
		   
 | 
							   
 | 
				
			||||||
		   dstBits + dstY * dstStride,
 | 
							   dstBits + (y1 + dstYoff) * dstStride,
 | 
				
			||||||
		   dstStride,
 | 
							   dstStride,
 | 
				
			||||||
		   (x1 + dstXoff) * dstBpp,
 | 
							   (x1 + dstXoff) * dstBpp,
 | 
				
			||||||
		   
 | 
							   
 | 
				
			||||||
| 
						 | 
					@ -119,7 +107,7 @@ xglSetPixels (DrawablePtr pDrawable,
 | 
				
			||||||
		   FB_ALLONES,
 | 
							   FB_ALLONES,
 | 
				
			||||||
		   dstBpp,
 | 
							   dstBpp,
 | 
				
			||||||
		   FALSE,
 | 
							   FALSE,
 | 
				
			||||||
		   upsideDown != XGL_INTERNAL_SCANLINE_ORDER_UPSIDE_DOWN);
 | 
							   FALSE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	    pDstBox[nDstBox].x1 = x1;
 | 
						    pDstBox[nDstBox].x1 = x1;
 | 
				
			||||||
	    pDstBox[nDstBox].y1 = y1;
 | 
						    pDstBox[nDstBox].y1 = y1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -423,18 +423,30 @@ xglMapPixmapBits (PixmapPtr pPixmap)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (!pPixmap->devPrivate.ptr)
 | 
					    if (!pPixmap->devPrivate.ptr)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
						CARD8 *bits;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	XGL_PIXMAP_PRIV (pPixmap);
 | 
						XGL_PIXMAP_PRIV (pPixmap);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if (!pPixmapPriv->buffer)
 | 
						if (!pPixmapPriv->buffer)
 | 
				
			||||||
	    if (!xglAllocatePixmapBits (pPixmap))
 | 
						    if (!xglAllocatePixmapBits (pPixmap))
 | 
				
			||||||
		return FALSE;
 | 
							return FALSE;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	pPixmap->devKind = pPixmapPriv->stride;
 | 
						bits = glitz_buffer_map (pPixmapPriv->buffer,
 | 
				
			||||||
	pPixmap->devPrivate.ptr =
 | 
					 | 
				
			||||||
	    glitz_buffer_map (pPixmapPriv->buffer,
 | 
					 | 
				
			||||||
				 GLITZ_BUFFER_ACCESS_READ_WRITE);
 | 
									 GLITZ_BUFFER_ACCESS_READ_WRITE);
 | 
				
			||||||
	if (!pPixmap->devPrivate.ptr)
 | 
						if (!bits)
 | 
				
			||||||
	    return FALSE;
 | 
						    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;
 | 
					    return TRUE;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue