[Pixman] [PATCH] Optimize handling of repeats with image.width==1 and bilinear

Chris Wilson chris at chris-wilson.co.uk
Wed Sep 14 02:58:57 PDT 2011


Similar to the earily optimisation off width==1 and nearest scaling
f5da52b6774bdefdfa88a28fdc3904797adb7e26 (bits: optimise fetching
width==1 repeats) we hit a similar situation when the same pages are
zoomed in.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 pixman/pixman-bits-image.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
index f382c65..df1e6ae 100644
--- a/pixman/pixman-bits-image.c
+++ b/pixman/pixman-bits-image.c
@@ -694,18 +694,27 @@ bits_image_fetch_bilinear_affine (pixman_image_t * image,
 
 	    mask = PIXMAN_FORMAT_A (format)? 0 : 0xff000000;
 
-	    repeat (repeat_mode, &x1, width);
 	    repeat (repeat_mode, &y1, height);
-	    repeat (repeat_mode, &x2, width);
 	    repeat (repeat_mode, &y2, height);
 
 	    row1 = (uint8_t *)bits->bits + bits->rowstride * 4 * y1;
 	    row2 = (uint8_t *)bits->bits + bits->rowstride * 4 * y2;
 
-	    tl = convert_pixel (row1, x1) | mask;
-	    tr = convert_pixel (row1, x2) | mask;
-	    bl = convert_pixel (row2, x1) | mask;
-	    br = convert_pixel (row2, x2) | mask;
+	    if (width == 1)
+	    {
+		tr = tl = convert_pixel (row1, 0) | mask;
+		br = bl = convert_pixel (row2, 0) | mask;
+	    }
+	    else
+	    {
+		repeat (repeat_mode, &x1, width);
+		repeat (repeat_mode, &x2, width);
+
+		tl = convert_pixel (row1, x1) | mask;
+		tr = convert_pixel (row1, x2) | mask;
+		bl = convert_pixel (row2, x1) | mask;
+		br = convert_pixel (row2, x2) | mask;
+	    }
 	}
 	else
 	{
-- 
1.7.5.4



More information about the Pixman mailing list