[Pixman] [PATCH] bits: optimise fetching width==1 repeats

Soeren Sandmann sandmann at cs.au.dk
Mon Aug 22 06:27:05 PDT 2011


Chris Wilson <chris at chris-wilson.co.uk> writes:

> diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
> index 4e9ed14..a762c27 100644
> --- a/pixman/pixman-bits-image.c
> +++ b/pixman/pixman-bits-image.c
> @@ -1149,7 +1149,34 @@ bits_image_fetch_untransformed_repeat_normal (bits_image_t *image,
>      while (y >= image->height)
>  	y -= image->height;
>  
> -    while (width)
> +    if (image->width == 1)
> +    {
> +	    /* XXX duplication from fetch solid */
> +	    if (wide)
> +	    {
> +		    uint64_t color;
> +		    uint64_t *b = (uint64_t *)buffer;
> +		    uint64_t *end;
> +
> +		    color = image->fetch_pixel_64 (image, 0, y);
> +
> +		    end = b + width;
> +		    while (b < end)
> +			    *(b++) = color;
> +	    }
> +	    else
> +	    {
> +		    uint32_t color;
> +		    uint32_t *end;
> +
> +		    color = image->fetch_pixel_32 (image, 0, y);
> +
> +		    end = buffer + width;
> +		    while (buffer < end)
> +			    *(buffer++) = color;
> +	    }
> +    }
> +    else while (width)
>      {
>  	while (x < 0)
>  	    x += image->width;

Makes sense to me, but I think the duplicated code should be in a new
force_inline function "replicate_pixel()" or something. Also, maybe the
patch got mangled in the mail, but it looks to me like it uses
eight-space indents.


Soren


More information about the Pixman mailing list