[Xorg-driver-geode] [PATCH] Correctly calculate the rendering region with the mask picture

Mart Raudsepp leio at gentoo.org
Mon Jul 5 23:43:32 PDT 2010


On Mon, 2010-07-05 at 16:49 +0800, Huang, FrankR wrote:
> From: Frank Huang <frankr.huang at amd.com>
> 
> If the opeartion is with a shifted position mask, then adjust the
> operation region based on the operations mask width and height
> parameters(instead of clipping based on source width/height)
> 
> Signed-off-by: Frank Huang <frankr.huang at amd.com>

Acked-by: Mart Raudsepp <leio at gentoo.org>

Pushed to fdo too.

> ---
>  src/lx_exa.c |   47 +++++++++++++++++++++++++++++++++++++++--------
>  1 files changed, 39 insertions(+), 8 deletions(-)
> 
> diff --git a/src/lx_exa.c b/src/lx_exa.c
> index 14980ae..f374589 100644
> --- a/src/lx_exa.c
> +++ b/src/lx_exa.c
> @@ -1009,13 +1009,33 @@ lx_do_composite(PixmapPtr pxDst, int srcX, int srcY, int maskX,
>  	srcPoint.y = F(0);
>      }
>  
> +    /* Get the source point offset position */
> +
>      srcOffset = GetSrcOffset(I(srcPoint.x), I(srcPoint.y));
>  
> -    if (exaScratch.srcWidth < opWidth)
> -	opWidth = exaScratch.srcWidth;
> +    /* When mask exists, exaScratch.srcWidth and exaScratch.srcHeight are
> +     * the source width and source height; Otherwise, they are mask width
> +     * and mask height */
> +    /* exaScratch.repeat is the source repeat attribute */
> +    /* If type is COMP_TYPE_MASK, maskX and maskY are not zero, we should
> +     * subtract them to do the operation in the correct region */
> +
> +    /* FIXME:  Please add the code to handle the condition when the maskX
> +     * and maskY coordinate are negative or greater than 
> +     * exaScratch.srcWidth and exaScratch.srcHeight */
>  
> -    if (exaScratch.srcHeight < opHeight)
> -	opHeight = exaScratch.srcHeight;
> +
> +    if (exaScratch.type == COMP_TYPE_MASK) {
> +	if ((exaScratch.srcWidth - maskX) < opWidth)
> +	    opWidth = exaScratch.srcWidth - maskX;
> +	if ((exaScratch.srcHeight - maskY) < opHeight)
> +	    opHeight = exaScratch.srcHeight - maskY;
> +    } else {
> +	if (exaScratch.srcWidth < opWidth)
> +	    opWidth = exaScratch.srcWidth;
> +	if (exaScratch.srcHeight < opHeight)
> +	    opHeight = exaScratch.srcHeight;
> +    }
>  
>      while (1) {
>  
> @@ -1067,10 +1087,21 @@ lx_do_composite(PixmapPtr pxDst, int srcX, int srcY, int maskX,
>  		break;
>  	}
>  
> -	opWidth = ((dstX + width) - opX) > exaScratch.srcWidth ?
> -	    exaScratch.srcWidth : (dstX + width) - opX;
> -	opHeight = ((dstY + height) - opY) > exaScratch.srcHeight ?
> -	    exaScratch.srcHeight : (dstY + height) - opY;
> +	/* FIXME:  Please add the code to handle the condition when the maskX
> +	 * and maskY coordinate are negative or greater than
> +	 * exaScratch.srcWidth and exaScratch.srcHeight */
> +
> +	if (exaScratch.type == COMP_TYPE_MASK) {
> +	    opWidth = ((dstX + width) - opX) > (exaScratch.srcWidth - maskX)
> +		? (exaScratch.srcWidth - maskX) : (dstX + width) - opX;
> +	    opHeight = ((dstY + height) - opY) > (exaScratch.srcHeight - maskY)
> +		? (exaScratch.srcHeight - maskY) : (dstY + height) - opY;
> +	} else {
> +	    opWidth = ((dstX + width) - opX) > exaScratch.srcWidth ?
> +		exaScratch.srcWidth : (dstX + width) - opX;
> +	    opHeight = ((dstY + height) - opY) > exaScratch.srcHeight ?
> +		exaScratch.srcHeight : (dstY + height) - opY;
> +	}
>      }
>  }
>  



More information about the Xorg-driver-geode mailing list