[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cairo
Subject:    Re: [cairo] The short road left to 1.6 - EXTEND_PAD
From:       Bertram Felgenhauer <bertram.felgenhauer () googlemail ! com>
Date:       2008-01-29 11:49:05
Message-ID: 20080129114905.GA4281 () zombie ! inf ! tu-dresden ! de
[Download RAW message or body]

Antoine Azar wrote:
>> Looks good to me, code-wise. However, the indentation is messed up
>> badly, and there are a few other style nits.
>
> I've had trouble with Visual Studio, hopefully everything should be fine 
> now.

Looks good now.

>> There's a conflict with commit 1d89bac5a7a5693911d8a74701bd1c0292160478
>> -- fix cairo's  a1-image-sample  test.
>
> I integrated these changes, let me know if there's still any trouble.

You applied the changes in too many places. (Which is partly my fault,
I wasn't clear about that in my previous mail.)

See http://lists.cairographics.org/archives/cairo/2008-January/012789.html
for an explanation for the different treatment of gradients.

I'll attach an updated patch.

>> > -/* Note n trailing semicolon on the above macro; if it's there, then
>> > - * the typical usage of YV12_SETUP(pict); will have an extra trailing ;
>> > - * that some compilers will interpret as a statement -- and then any 
>> further
>> > - * variable declarations will cause an error.
>> > - */
>>
>> Is there any good reason to remove that comment?
>
> I might be missing something but I don't see the usefulness of having a 
> trailing semicolon. Is the comment only there to let developers know they 
> should NOT append a semicolon to the define? if so that should probably be 
> in the coding guidelines rather than in the code. Anyhow I put it back for 
> now.

As far as I am concerned, the comment is not needed (but I'm not an
official pixman maintainer). But removing it has nothing to do with
refactoring fbFetchTransformed(), so it should be a separate patch.

Question to pixman maintainers: Is there a strong preference between
    if (foo)
    {
        bar;
    }
and
    if (foo) {
        bar;
    }
? The patch mixes both styles freely (which is ok from my perspective)

Oh and I've run the cairo performance suite now (once before and after
the patch, so the numbers should be taken with a grain of salt)

| Speedups
| ========
| image-rgb    paint_similar_rgb_source-256    0.41 1.61% ->   0.29 0.60%:  1.38x speedup
| ▍
| image-rgb      paint_similar_rgb_over-256    0.40 1.60% ->   0.29 0.86%:  1.38x speedup
| ▍
| image-rgb        paint_image_rgb_over-256    0.40 1.54% ->   0.29 0.17%:  1.37x speedup
| ▍
| image-rgb      paint_image_rgb_source-256    0.41 1.32% ->   0.29 0.46%:  1.37x speedup
| ▍
| image-rgb   paint_similar_rgba_source-256    0.53 1.17% ->   0.42 0.57%:  1.26x speedup
| ▎
| image-rgb     paint_image_rgba_source-256    0.53 1.05% ->   0.42 1.90%:  1.25x speedup
| ▎
| image-rgba      pattern_create_radial-16     4.94 0.06% ->   4.50 0.00%:  1.10x speedup
| ▏
| image-rgb        text_linear_rgb_over-64     3.08 0.14% ->   2.93 0.38%:  1.05x speedup
| Slowdowns
| =========
| image-rgba  paint_similar_rgba_source-256    0.26 0.68% ->   0.31 0.26%:  1.20x slowdown
| ▎
| image-rgba     paint_image_rgb_source-256    0.85 1.05% ->   0.98 0.16%:  1.17x slowdown
| ▏
| image-rgb       pattern_create_radial-16     4.94 0.53% ->   5.46 0.07%:  1.11x slowdown
| ▏
| image-rgba   paint_similar_rgb_source-256    0.86 1.13% ->   0.96 0.57%:  1.11x slowdown
| ▏
| image-rgb    paint_radial_rgba_source-256   10.68 0.67% ->  11.35 0.03%:  1.07x slowdown
| ▏
| image-rgb     paint_radial_rgb_source-512   43.62 0.41% ->  46.55 0.11%:  1.07x slowdown
| ▏
| image-rgb       paint_radial_rgb_over-256   11.05 0.60% ->  11.81 0.04%:  1.07x slowdown
| ▏
| image-rgb       paint_radial_rgb_over-512   44.67 0.61% ->  47.36 0.06%:  1.07x slowdown
| ▏
| image-rgb    paint_radial_rgba_source-512   44.14 0.55% ->  46.55 0.20%:  1.06x slowdown
| ▏
| image-rgb               subimage_copy-128    0.01 1.54% ->   0.01 0.22%:  1.06x slowdown
| 
| image-rgb     paint_radial_rgb_source-256   10.78 0.16% ->  11.35 0.00%:  1.06x slowdown

Looks reasonable, I think.

Bertram

["0001-pixman-compose.c-Refactor-fbFetchTransformed.patch" (text/plain)]

From 1cf41ccd13acdf85c3059932829425a4f15d9632 Mon Sep 17 00:00:00 2001
From: Antoine Azar <cairo@antoineazar.com>
Date: Tue, 29 Jan 2008 11:53:03 +0100
Subject: [PATCH] [pixman-compose.c] Refactor fbFetchTransformed()

---
 pixman/pixman-compose.c |  969 ++++++++++++++++++++++++++---------------------
 pixman/pixman-private.h |    2 +
 2 files changed, 540 insertions(+), 431 deletions(-)

diff --git a/pixman/pixman-compose.c b/pixman/pixman-compose.c
index e240850..973541e 100644
--- a/pixman/pixman-compose.c
+++ b/pixman/pixman-compose.c
@@ -3678,19 +3678,516 @@ static void pixmanFetchSourcePict(source_image_t * pict, int \
x, int y, int width  }
 }
 
-static void fbFetchTransformed(bits_image_t * pict, int x, int y, int width, \
uint32_t *buffer, uint32_t *mask, uint32_t maskBits) +/*
+ * Fetch from region strategies
+ */
+typedef FASTCALL uint32_t (*fetchFromRegionProc)(bits_image_t *pict, int x, int y, \
uint32_t *buffer, fetchPixelProc fetch, pixman_box16_t *box); +
+static inline uint32_t
+fbFetchFromNoRegion(bits_image_t *pict, int x, int y, uint32_t *buffer, \
fetchPixelProc fetch, pixman_box16_t *box) +{
+    return fetch (pict, x, y);
+}
+
+static uint32_t
+fbFetchFromNRectangles(bits_image_t *pict, int x, int y, uint32_t *buffer, \
fetchPixelProc fetch, pixman_box16_t *box) +{
+    if (pixman_region_contains_point (pict->common.src_clip, x, y, box))
+        return fbFetchFromNoRegion(pict, x, y, buffer, fetch, box);
+    else
+        return 0;
+}
+
+static uint32_t
+fbFetchFromOneRectangle(bits_image_t *pict, int x, int y, uint32_t *buffer, \
fetchPixelProc fetch, pixman_box16_t *box) +{
+    pixman_box16_t box2 = *box;
+    return ((x < box2.x1) | (x >= box2.x2) | (y < box2.y1) | (y >= box2.y2)) ?
+        0 : fbFetchFromNoRegion(pict, x, y, buffer, fetch, box);
+}
+
+/*
+ * Fetching Algorithms
+ */
+static void
+fbFetchTransformed_Nearest_Normal(bits_image_t * pict, int width, uint32_t *buffer, \
uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, \
pixman_vector_t unit) +{
+    pixman_box16_t* box = NULL;
+    fetchPixelProc   fetch;
+    fetchFromRegionProc fetchFromRegion;
+    int x, y, i;
+
+    /* initialize the two function pointers */
+    fetch = fetchPixelProcForPicture(pict);
+
+    if(pixman_region_n_rects (pict->common.src_clip) == 1)
+        fetchFromRegion = fbFetchFromNoRegion;
+    else
+        fetchFromRegion = fbFetchFromNRectangles;
+
+    for ( i = 0; i < width; ++i)
+    {
+        if (!mask || mask[i] & maskBits)
+        {
+            if (!v.vector[2])
+            {
+                *(buffer + i) = 0;
+            }
+            else
+            {
+                if (!affine)
+                {
+                    y = MOD(DIV(v.vector[1],v.vector[2]), pict->height);
+                    x = MOD(DIV(v.vector[0],v.vector[2]), pict->width);
+                }
+                else
+                {
+                    y = MOD(v.vector[1]>>16, pict->height);
+                    x = MOD(v.vector[0]>>16, pict->width);
+                }
+                *(buffer + i) = fetchFromRegion(pict, x, y, buffer, fetch, box);
+            }
+        }
+
+        v.vector[0] += unit.vector[0];
+        v.vector[1] += unit.vector[1];
+        v.vector[2] += unit.vector[2];
+    }
+}
+
+static void
+fbFetchTransformed_Nearest_Pad(bits_image_t * pict, int width, uint32_t *buffer, \
uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, \
pixman_vector_t unit) +{
+    pixman_box16_t *box = NULL;
+    fetchPixelProc   fetch;
+    fetchFromRegionProc fetchFromRegion;
+    int x, y, i;
+
+    /* initialize the two function pointers */
+    fetch = fetchPixelProcForPicture(pict);
+
+    if(pixman_region_n_rects (pict->common.src_clip) == 1)
+        fetchFromRegion = fbFetchFromNoRegion;
+    else
+        fetchFromRegion = fbFetchFromNRectangles;
+
+    for (i = 0; i < width; ++i)
+    {
+        if (!mask || mask[i] & maskBits)
+        {
+            if (!v.vector[2])
+            {
+                *(buffer + i) = 0;
+            }
+            else
+            {
+                if (!affine)
+                {
+                    y = CLIP(DIV(v.vector[1], v.vector[2]), 0, pict->height-1);
+                    x = CLIP(DIV(v.vector[0], v.vector[2]), 0, pict->width-1);
+                }
+                else
+                {
+                    y = CLIP(v.vector[1]>>16, 0, pict->height-1);
+                    x = CLIP(v.vector[0]>>16, 0, pict->width-1);
+                }
+
+                *(buffer + i) = fetchFromRegion(pict, x, y, buffer, fetch, box);
+            }
+        }
+
+        v.vector[0] += unit.vector[0];
+        v.vector[1] += unit.vector[1];
+        v.vector[2] += unit.vector[2];
+    }
+}
+
+static void
+fbFetchTransformed_Nearest_General(bits_image_t * pict, int width, uint32_t *buffer, \
uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, \
pixman_vector_t unit) +{
+    pixman_box16_t *box;
+    fetchPixelProc   fetch;
+    fetchFromRegionProc fetchFromRegion;
+    int x, y, i;
+
+    /* initialize the two function pointers */
+    fetch = fetchPixelProcForPicture(pict);
+
+    if(pixman_region_n_rects (pict->common.src_clip) == 1)
+    {
+        box = &(pict->common.src_clip->extents);
+        fetchFromRegion = fbFetchFromOneRectangle;
+    }
+    else
+    {
+        fetchFromRegion = fbFetchFromNRectangles;
+    }
+
+    for (i = 0; i < width; ++i) {
+        if (!mask || mask[i] & maskBits)
+        {
+            if (!v.vector[2]) {
+                *(buffer + i) = 0;
+            } else {
+                if (!affine) {
+                    y = DIV(v.vector[1],v.vector[2]);
+                    x = DIV(v.vector[0],v.vector[2]);
+                } else {
+                    y = v.vector[1]>>16;
+                    x = v.vector[0]>>16;
+                }
+                *(buffer + i) = fetchFromRegion(pict, x, y, buffer, fetch, box);
+            }
+        }
+        v.vector[0] += unit.vector[0];
+        v.vector[1] += unit.vector[1];
+        v.vector[2] += unit.vector[2];
+    }
+}
+
+static void
+fbFetchTransformed_Bilinear_Normal(bits_image_t * pict, int width, uint32_t *buffer, \
uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, \
pixman_vector_t unit) +{
+    pixman_box16_t *box = NULL;
+    fetchPixelProc   fetch;
+    fetchFromRegionProc fetchFromRegion;
+    int i;
+
+    /* initialize the two function pointers */
+    fetch = fetchPixelProcForPicture(pict);
+
+    if(pixman_region_n_rects (pict->common.src_clip) == 1)
+        fetchFromRegion = fbFetchFromNoRegion;
+    else
+        fetchFromRegion = fbFetchFromNRectangles;
+
+    for (i = 0; i < width; ++i) {
+        if (!mask || mask[i] & maskBits)
+        {
+            if (!v.vector[2]) {
+                *(buffer + i) = 0;
+            } else {
+                int x1, x2, y1, y2, distx, idistx, disty, idisty;
+                uint32_t tl, tr, bl, br, r;
+                uint32_t ft, fb;
+
+                if (!affine) {
+                    pixman_fixed_48_16_t div;
+                    div = ((pixman_fixed_48_16_t)v.vector[0] << 16)/v.vector[2];
+                    x1 = div >> 16;
+                    distx = ((pixman_fixed_t)div >> 8) & 0xff;
+                    div = ((pixman_fixed_48_16_t)v.vector[1] << 16)/v.vector[2];
+                    y1 = div >> 16;
+                    disty = ((pixman_fixed_t)div >> 8) & 0xff;
+                } else {
+                    x1 = v.vector[0] >> 16;
+                    distx = (v.vector[0] >> 8) & 0xff;
+                    y1 = v.vector[1] >> 16;
+                    disty = (v.vector[1] >> 8) & 0xff;
+                }
+                x2 = x1 + 1;
+                y2 = y1 + 1;
+
+                idistx = 256 - distx;
+                idisty = 256 - disty;
+
+                x1 = MOD (x1, pict->width);
+                x2 = MOD (x2, pict->width);
+                y1 = MOD (y1, pict->height);
+                y2 = MOD (y2, pict->height);
+
+                tl = fetchFromRegion(pict, x1, y1, buffer, fetch, box);
+                tr = fetchFromRegion(pict, x2, y1, buffer, fetch, box);
+                bl = fetchFromRegion(pict, x1, y2, buffer, fetch, box);
+                br = fetchFromRegion(pict, x2, y2, buffer, fetch, box);
+
+                ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx;
+                fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx;
+                r = (((ft * idisty + fb * disty) >> 16) & 0xff);
+                ft = FbGet8(tl,8) * idistx + FbGet8(tr,8) * distx;
+                fb = FbGet8(bl,8) * idistx + FbGet8(br,8) * distx;
+                r |= (((ft * idisty + fb * disty) >> 8) & 0xff00);
+                ft = FbGet8(tl,16) * idistx + FbGet8(tr,16) * distx;
+                fb = FbGet8(bl,16) * idistx + FbGet8(br,16) * distx;
+                r |= (((ft * idisty + fb * disty)) & 0xff0000);
+                ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx;
+                fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx;
+                r |= (((ft * idisty + fb * disty) << 8) & 0xff000000);
+                *(buffer + i) = r;
+            }
+        }
+        v.vector[0] += unit.vector[0];
+        v.vector[1] += unit.vector[1];
+        v.vector[2] += unit.vector[2];
+    }
+}
+
+static void
+fbFetchTransformed_Bilinear_Pad(bits_image_t * pict, int width, uint32_t *buffer, \
uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, \
pixman_vector_t unit) +{
+    pixman_box16_t *box = NULL;
+    fetchPixelProc   fetch;
+    fetchFromRegionProc fetchFromRegion;
+    int i;
+
+    /* initialize the two function pointers */
+    fetch = fetchPixelProcForPicture(pict);
+
+    if(pixman_region_n_rects (pict->common.src_clip) == 1)
+        fetchFromRegion = fbFetchFromNoRegion;
+    else
+        fetchFromRegion = fbFetchFromNRectangles;
+
+    for (i = 0; i < width; ++i) {
+        if (!mask || mask[i] & maskBits)
+        {
+            if (!v.vector[2]) {
+                *(buffer + i) = 0;
+            } else {
+                int x1, x2, y1, y2, distx, idistx, disty, idisty;
+                uint32_t tl, tr, bl, br, r;
+                uint32_t ft, fb;
+
+                if (!affine) {
+                    pixman_fixed_48_16_t div;
+                    div = ((pixman_fixed_48_16_t)v.vector[0] << 16)/v.vector[2];
+                    x1 = div >> 16;
+                    distx = ((pixman_fixed_t)div >> 8) & 0xff;
+                    div = ((pixman_fixed_48_16_t)v.vector[1] << 16)/v.vector[2];
+                    y1 = div >> 16;
+                    disty = ((pixman_fixed_t)div >> 8) & 0xff;
+                } else {
+                    x1 = v.vector[0] >> 16;
+                    distx = (v.vector[0] >> 8) & 0xff;
+                    y1 = v.vector[1] >> 16;
+                    disty = (v.vector[1] >> 8) & 0xff;
+                }
+                x2 = x1 + 1;
+                y2 = y1 + 1;
+
+                idistx = 256 - distx;
+                idisty = 256 - disty;
+
+                x1 = CLIP (x1, 0, pict->width-1);
+                x2 = CLIP (x2, 0, pict->width-1);
+                y1 = CLIP (y1, 0, pict->height-1);
+                y2 = CLIP (y2, 0, pict->height-1);
+
+                tl = fetchFromRegion(pict, x1, y1, buffer, fetch, box);
+                tr = fetchFromRegion(pict, x2, y1, buffer, fetch, box);
+                bl = fetchFromRegion(pict, x1, y2, buffer, fetch, box);
+                br = fetchFromRegion(pict, x2, y2, buffer, fetch, box);
+
+                ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx;
+                fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx;
+                r = (((ft * idisty + fb * disty) >> 16) & 0xff);
+                ft = FbGet8(tl,8) * idistx + FbGet8(tr,8) * distx;
+                fb = FbGet8(bl,8) * idistx + FbGet8(br,8) * distx;
+                r |= (((ft * idisty + fb * disty) >> 8) & 0xff00);
+                ft = FbGet8(tl,16) * idistx + FbGet8(tr,16) * distx;
+                fb = FbGet8(bl,16) * idistx + FbGet8(br,16) * distx;
+                r |= (((ft * idisty + fb * disty)) & 0xff0000);
+                ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx;
+                fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx;
+                r |= (((ft * idisty + fb * disty) << 8) & 0xff000000);
+                *(buffer + i) = r;
+            }
+        }
+        v.vector[0] += unit.vector[0];
+        v.vector[1] += unit.vector[1];
+        v.vector[2] += unit.vector[2];
+    }
+}
+
+static void
+fbFetchTransformed_Bilinear_General(bits_image_t * pict, int width, uint32_t \
*buffer, uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, \
pixman_vector_t unit) +{
+    pixman_box16_t *box;
+    fetchPixelProc   fetch;
+    fetchFromRegionProc fetchFromRegion;
+    int i;
+
+    /* initialize the two function pointers */
+    fetch = fetchPixelProcForPicture(pict);
+
+    if(pixman_region_n_rects (pict->common.src_clip) == 1)
+    {
+        box = &(pict->common.src_clip->extents);
+        fetchFromRegion = fbFetchFromOneRectangle;
+    }
+    else
+    {
+        fetchFromRegion = fbFetchFromNRectangles;
+    }
+
+    for (i = 0; i < width; ++i)
+    {
+        if (!mask || mask[i] & maskBits)
+        {
+            if (!v.vector[2]) {
+                *(buffer + i) = 0;
+            } else {
+                int x1, x2, y1, y2, distx, idistx, disty, idisty;
+                uint32_t tl, tr, bl, br, r;
+                uint32_t ft, fb;
+
+                if (!affine) {
+                    pixman_fixed_48_16_t div;
+                    div = ((pixman_fixed_48_16_t)v.vector[0] << 16)/v.vector[2];
+                    x1 = div >> 16;
+                    distx = ((pixman_fixed_t)div >> 8) & 0xff;
+                    div = ((pixman_fixed_48_16_t)v.vector[1] << 16)/v.vector[2];
+                    y1 = div >> 16;
+                    disty = ((pixman_fixed_t)div >> 8) & 0xff;
+                } else {
+                    x1 = v.vector[0] >> 16;
+                    distx = (v.vector[0] >> 8) & 0xff;
+                    y1 = v.vector[1] >> 16;
+                    disty = (v.vector[1] >> 8) & 0xff;
+                }
+                x2 = x1 + 1;
+                y2 = y1 + 1;
+
+                idistx = 256 - distx;
+                idisty = 256 - disty;
+
+                tl = fetchFromRegion(pict, x1, y1, buffer, fetch, box);
+                tr = fetchFromRegion(pict, x2, y1, buffer, fetch, box);
+                bl = fetchFromRegion(pict, x1, y2, buffer, fetch, box);
+                br = fetchFromRegion(pict, x2, y2, buffer, fetch, box);
+
+                ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx;
+                fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx;
+                r = (((ft * idisty + fb * disty) >> 16) & 0xff);
+                ft = FbGet8(tl,8) * idistx + FbGet8(tr,8) * distx;
+                fb = FbGet8(bl,8) * idistx + FbGet8(br,8) * distx;
+                r |= (((ft * idisty + fb * disty) >> 8) & 0xff00);
+                ft = FbGet8(tl,16) * idistx + FbGet8(tr,16) * distx;
+                fb = FbGet8(bl,16) * idistx + FbGet8(br,16) * distx;
+                r |= (((ft * idisty + fb * disty)) & 0xff0000);
+                ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx;
+                fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx;
+                r |= (((ft * idisty + fb * disty) << 8) & 0xff000000);
+                *(buffer + i) = r;
+            }
+        }
+
+        v.vector[0] += unit.vector[0];
+        v.vector[1] += unit.vector[1];
+        v.vector[2] += unit.vector[2];
+    }
+}
+
+static void
+fbFetchTransformed_Convolution(bits_image_t * pict, int width, uint32_t *buffer, \
uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, \
pixman_vector_t unit) +{
+    pixman_box16_t *box = NULL;
+    fetchPixelProc fetch;
+    int i;
+
+    pixman_fixed_t *params = pict->common.filter_params;
+    int32_t cwidth = pixman_fixed_to_int(params[0]);
+    int32_t cheight = pixman_fixed_to_int(params[1]);
+    int xoff = (params[0] - pixman_fixed_1) >> 1;
+    int yoff = (params[1] - pixman_fixed_1) >> 1;
+    fetch = fetchPixelProcForPicture(pict);
+
+    params += 2;
+    for (i = 0; i < width; ++i) {
+        if (!mask || mask[i] & maskBits)
+        {
+            if (!v.vector[2]) {
+                *(buffer + i) = 0;
+            } else {
+                int x1, x2, y1, y2, x, y;
+                int32_t srtot, sgtot, sbtot, satot;
+                pixman_fixed_t *p = params;
+
+                if (!affine) {
+                    pixman_fixed_48_16_t tmp;
+                    tmp = ((pixman_fixed_48_16_t)v.vector[0] << 16)/v.vector[2] - \
xoff; +                    x1 = pixman_fixed_to_int(tmp);
+                    tmp = ((pixman_fixed_48_16_t)v.vector[1] << 16)/v.vector[2] - \
yoff; +                    y1 = pixman_fixed_to_int(tmp);
+                } else {
+                    x1 = pixman_fixed_to_int(v.vector[0] - xoff);
+                    y1 = pixman_fixed_to_int(v.vector[1] - yoff);
+                }
+                x2 = x1 + cwidth;
+                y2 = y1 + cheight;
+
+                srtot = sgtot = sbtot = satot = 0;
+
+                for (y = y1; y < y2; y++) {
+                    int ty;
+                    switch (pict->common.repeat) {
+                        case PIXMAN_REPEAT_NORMAL:
+                            ty = MOD (y, pict->height);
+                            break;
+                        case PIXMAN_REPEAT_PAD:
+                            ty = CLIP (y, 0, pict->height-1);
+                            break;
+                        default:
+                            ty = y;
+                    }
+                    for (x = x1; x < x2; x++) {
+                        if (*p) {
+                            int tx;
+                            switch (pict->common.repeat) {
+                                case PIXMAN_REPEAT_NORMAL:
+                                    tx = MOD (x, pict->width);
+                                    break;
+                                case PIXMAN_REPEAT_PAD:
+                                    tx = CLIP (x, 0, pict->width-1);
+                                    break;
+                                default:
+                                    tx = x;
+                            }
+                            if (pixman_region_contains_point (pict->common.src_clip, \
tx, ty, box)) { +                                uint32_t c = fetch(pict, tx, ty);
+
+                                srtot += Red(c) * *p;
+                                sgtot += Green(c) * *p;
+                                sbtot += Blue(c) * *p;
+                                satot += Alpha(c) * *p;
+                            }
+                        }
+                        p++;
+                    }
+                }
+
+                satot >>= 16;
+                srtot >>= 16;
+                sgtot >>= 16;
+                sbtot >>= 16;
+
+                if (satot < 0) satot = 0; else if (satot > 0xff) satot = 0xff;
+                if (srtot < 0) srtot = 0; else if (srtot > 0xff) srtot = 0xff;
+                if (sgtot < 0) sgtot = 0; else if (sgtot > 0xff) sgtot = 0xff;
+                if (sbtot < 0) sbtot = 0; else if (sbtot > 0xff) sbtot = 0xff;
+
+                *(buffer + i) = ((satot << 24) |
+                                 (srtot << 16) |
+                                 (sgtot <<  8) |
+                                 (sbtot       ));
+            }
+        }
+        v.vector[0] += unit.vector[0];
+        v.vector[1] += unit.vector[1];
+        v.vector[2] += unit.vector[2];
+    }
+}
+
+static void
+fbFetchTransformed(bits_image_t * pict, int x, int y, int width, uint32_t *buffer, \
uint32_t *mask, uint32_t maskBits)  {
     uint32_t     *bits;
     int32_t    stride;
-    fetchPixelProc   fetch;
-    pixman_vector_t	v;
-    pixman_vector_t  unit;
     int         i;
-    pixman_box16_t box;
+    pixman_vector_t v;
+    pixman_vector_t unit;
     pixman_bool_t affine = TRUE;
 
-    fetch = fetchPixelProcForPicture(pict);
-
     bits = pict->bits;
     stride = pict->rowstride;
 
@@ -3703,7 +4200,7 @@ static void fbFetchTransformed(bits_image_t * pict, int x, int \
y, int width, uin  if (pict->common.transform)
     {
         if (!pixman_transform_point_3d (pict->common.transform, &v))
-	{
+        {
             fbFinishAccess (pict->pDrawable);
             return;
         }
@@ -3721,104 +4218,18 @@ static void fbFetchTransformed(bits_image_t * pict, int x, \
int y, int width, uin  
     if (pict->common.filter == PIXMAN_FILTER_NEAREST || pict->common.filter == \
PIXMAN_FILTER_FAST)  {
-        if (pict->common.repeat == PIXMAN_REPEAT_NORMAL) {
-            if (pixman_region_n_rects (pict->common.src_clip) == 1) {
-		for (i = 0; i < width; ++i) {
-		    if (!mask || mask[i] & maskBits)
-		    {
-			if (!v.vector[2]) {
-			    *(buffer + i) = 0;
-			} else {
-			    if (!affine) {
-				y = MOD(DIV(v.vector[1],v.vector[2]), pict->height);
-				x = MOD(DIV(v.vector[0],v.vector[2]), pict->width);
-			    } else {
-				y = MOD(v.vector[1]>>16, pict->height);
-				x = MOD(v.vector[0]>>16, pict->width);
-			    }
-			    *(buffer + i) = fetch(pict, x, y);
-			}
-		    }
-
-                    v.vector[0] += unit.vector[0];
-                    v.vector[1] += unit.vector[1];
-                    v.vector[2] += unit.vector[2];
-                }
-            } else {
-                for (i = 0; i < width; ++i) {
-		    if (!mask || mask[i] & maskBits)
-		    {
-			if (!v.vector[2]) {
-			    *(buffer + i) = 0;
-			} else {
-			    if (!affine) {
-				y = MOD(DIV(v.vector[1],v.vector[2]), pict->height);
-				x = MOD(DIV(v.vector[0],v.vector[2]), pict->width);
-			    } else {
-				y = MOD(v.vector[1]>>16, pict->height);
-				x = MOD(v.vector[0]>>16, pict->width);
-			    }
-			    if (pixman_region_contains_point (pict->common.src_clip, x, y, &box))
-				*(buffer + i) = fetch (pict, x, y);
-			    else
-				*(buffer + i) = 0;
-			}
-		    }
+        if (pict->common.repeat == PIXMAN_REPEAT_NORMAL)
+        {
+            fbFetchTransformed_Nearest_Normal(pict, width, buffer, mask, maskBits, \
affine, v, unit);  
-                    v.vector[0] += unit.vector[0];
-                    v.vector[1] += unit.vector[1];
-                    v.vector[2] += unit.vector[2];
-                }
-            }
-        } else {
-            if (pixman_region_n_rects(pict->common.src_clip) == 1) {
-                box = pict->common.src_clip->extents;
-                for (i = 0; i < width; ++i) {
-		    if (!mask || mask[i] & maskBits)
-		    {
-			if (!v.vector[2]) {
-			    *(buffer + i) = 0;
-			} else {
-			    if (!affine) {
-				y = DIV(v.vector[1],v.vector[2]);
-				x = DIV(v.vector[0],v.vector[2]);
-			    } else {
-				y = v.vector[1]>>16;
-				x = v.vector[0]>>16;
-			    }
-			    *(buffer + i) = ((x < box.x1) | (x >= box.x2) | (y < box.y1) | (y >= box.y2)) \
                ?
-				0 : fetch(pict, x, y);
-			}
-		    }
-                    v.vector[0] += unit.vector[0];
-                    v.vector[1] += unit.vector[1];
-                    v.vector[2] += unit.vector[2];
-                }
-            } else {
-                for (i = 0; i < width; ++i) {
-                    if (!mask || mask[i] & maskBits)
-		    {
-			if (!v.vector[2]) {
-			    *(buffer + i) = 0;
-			} else {
-			    if (!affine) {
-				y = DIV(v.vector[1],v.vector[2]);
-				x = DIV(v.vector[0],v.vector[2]);
-			    } else {
-				y = v.vector[1]>>16;
-				x = v.vector[0]>>16;
-			    }
-			    if (pixman_region_contains_point (pict->common.src_clip, x, y, &box))
-				*(buffer + i) = fetch(pict, x, y);
-			    else
-				*(buffer + i) = 0;
-			}
-		    }
-                    v.vector[0] += unit.vector[0];
-                    v.vector[1] += unit.vector[1];
-                    v.vector[2] += unit.vector[2];
-                }
-            }
+        }
+        else if (pict->common.repeat == PIXMAN_REPEAT_PAD)
+        {
+            fbFetchTransformed_Nearest_Pad(pict, width, buffer, mask, maskBits, \
affine, v, unit); +        }
+        else
+        {
+            fbFetchTransformed_Nearest_General(pict, width, buffer, mask, maskBits, \
affine, v, unit);  }
     } else if (pict->common.filter == PIXMAN_FILTER_BILINEAR	||
 	       pict->common.filter == PIXMAN_FILTER_GOOD	||
@@ -3830,336 +4241,30 @@ static void fbFetchTransformed(bits_image_t * pict, int x, \
int y, int width, uin  unit.vector[0] -= unit.vector[2] / 2;
         unit.vector[1] -= unit.vector[2] / 2;
 
-        if (pict->common.repeat == PIXMAN_REPEAT_NORMAL) {
-            if (pixman_region_n_rects(pict->common.src_clip) == 1) {
-                for (i = 0; i < width; ++i) {
-                    if (!mask || mask[i] & maskBits)
-		    {
-			if (!v.vector[2]) {
-			    *(buffer + i) = 0;
-			} else {
-			    int x1, x2, y1, y2, distx, idistx, disty, idisty;
-			    uint32_t tl, tr, bl, br, r;
-			    uint32_t ft, fb;
-
-			    if (!affine) {
-				pixman_fixed_48_16_t div;
-				div = ((pixman_fixed_48_16_t)v.vector[0] << 16)/v.vector[2];
-				x1 = div >> 16;
-				distx = ((pixman_fixed_t)div >> 8) & 0xff;
-				div = ((pixman_fixed_48_16_t)v.vector[1] << 16)/v.vector[2];
-				y1 = div >> 16;
-				disty = ((pixman_fixed_t)div >> 8) & 0xff;
-			    } else {
-				x1 = v.vector[0] >> 16;
-				distx = (v.vector[0] >> 8) & 0xff;
-				y1 = v.vector[1] >> 16;
-				disty = (v.vector[1] >> 8) & 0xff;
-			    }
-			    x2 = x1 + 1;
-			    y2 = y1 + 1;
-
-			    idistx = 256 - distx;
-			    idisty = 256 - disty;
-
-			    x1 = MOD (x1, pict->width);
-			    x2 = MOD (x2, pict->width);
-			    y1 = MOD (y1, pict->height);
-			    y2 = MOD (y2, pict->height);
-
-			    tl = fetch(pict, x1, y1);
-			    tr = fetch(pict, x2, y1);
-			    bl = fetch(pict, x1, y2);
-			    br = fetch(pict, x2, y2);
-
-			    ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx;
-			    fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx;
-			    r = (((ft * idisty + fb * disty) >> 16) & 0xff);
-			    ft = FbGet8(tl,8) * idistx + FbGet8(tr,8) * distx;
-			    fb = FbGet8(bl,8) * idistx + FbGet8(br,8) * distx;
-			    r |= (((ft * idisty + fb * disty) >> 8) & 0xff00);
-			    ft = FbGet8(tl,16) * idistx + FbGet8(tr,16) * distx;
-			    fb = FbGet8(bl,16) * idistx + FbGet8(br,16) * distx;
-			    r |= (((ft * idisty + fb * disty)) & 0xff0000);
-			    ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx;
-			    fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx;
-			    r |= (((ft * idisty + fb * disty) << 8) & 0xff000000);
-			    *(buffer + i) = r;
-			}
-		    }
-                    v.vector[0] += unit.vector[0];
-                    v.vector[1] += unit.vector[1];
-                    v.vector[2] += unit.vector[2];
-                }
-            } else {
-                for (i = 0; i < width; ++i) {
-		    if (!mask || mask[i] & maskBits)
-		    {
-			if (!v.vector[2]) {
-			    *(buffer + i) = 0;
-			} else {
-			    int x1, x2, y1, y2, distx, idistx, disty, idisty;
-			    uint32_t tl, tr, bl, br, r;
-			    uint32_t ft, fb;
-
-			    if (!affine) {
-				pixman_fixed_48_16_t div;
-				div = ((pixman_fixed_48_16_t)v.vector[0] << 16)/v.vector[2];
-				x1 = div >> 16;
-				distx = ((pixman_fixed_t)div >> 8) & 0xff;
-				div = ((pixman_fixed_48_16_t)v.vector[1] << 16)/v.vector[2];
-				y1 = div >> 16;
-				disty = ((pixman_fixed_t)div >> 8) & 0xff;
-			    } else {
-				x1 = v.vector[0] >> 16;
-				distx = (v.vector[0] >> 8) & 0xff;
-				y1 = v.vector[1] >> 16;
-				disty = (v.vector[1] >> 8) & 0xff;
-			    }
-			    x2 = x1 + 1;
-			    y2 = y1 + 1;
-
-			    idistx = 256 - distx;
-			    idisty = 256 - disty;
-
-			    x1 = MOD (x1, pict->width);
-			    x2 = MOD (x2, pict->width);
-			    y1 = MOD (y1, pict->height);
-			    y2 = MOD (y2, pict->height);
-
-			    tl = pixman_region_contains_point(pict->common.src_clip, x1, y1, &box)
-				? fetch(pict, x1, y1) : 0;
-			    tr = pixman_region_contains_point(pict->common.src_clip, x2, y1, &box)
-				? fetch(pict, x2, y1) : 0;
-			    bl = pixman_region_contains_point(pict->common.src_clip, x1, y2, &box)
-				? fetch(pict, x1, y2) : 0;
-			    br = pixman_region_contains_point(pict->common.src_clip, x2, y2, &box)
-				? fetch(pict, x2, y2) : 0;
-
-			    ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx;
-			    fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx;
-			    r = (((ft * idisty + fb * disty) >> 16) & 0xff);
-			    ft = FbGet8(tl,8) * idistx + FbGet8(tr,8) * distx;
-			    fb = FbGet8(bl,8) * idistx + FbGet8(br,8) * distx;
-			    r |= (((ft * idisty + fb * disty) >> 8) & 0xff00);
-			    ft = FbGet8(tl,16) * idistx + FbGet8(tr,16) * distx;
-			    fb = FbGet8(bl,16) * idistx + FbGet8(br,16) * distx;
-			    r |= (((ft * idisty + fb * disty)) & 0xff0000);
-			    ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx;
-			    fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx;
-			    r |= (((ft * idisty + fb * disty) << 8) & 0xff000000);
-			    *(buffer + i) = r;
-			}
-		    }
-
-                    v.vector[0] += unit.vector[0];
-                    v.vector[1] += unit.vector[1];
-                    v.vector[2] += unit.vector[2];
-                }
-            }
-        } else {
-            if (pixman_region_n_rects(pict->common.src_clip) == 1) {
-                box = pict->common.src_clip->extents;
-                for (i = 0; i < width; ++i) {
-		    if (!mask || mask[i] & maskBits)
-		    {
-			if (!v.vector[2]) {
-			    *(buffer + i) = 0;
-			} else {
-			    int x1, x2, y1, y2, distx, idistx, disty, idisty;
-			    uint32_t tl, tr, bl, br, r;
-			    pixman_bool_t x1_out, x2_out, y1_out, y2_out;
-			    uint32_t ft, fb;
-
-			    if (!affine) {
-				pixman_fixed_48_16_t div;
-				div = ((pixman_fixed_48_16_t)v.vector[0] << 16)/v.vector[2];
-				x1 = div >> 16;
-				distx = ((pixman_fixed_t)div >> 8) & 0xff;
-				div = ((pixman_fixed_48_16_t)v.vector[1] << 16)/v.vector[2];
-				y1 = div >> 16;
-				disty = ((pixman_fixed_t)div >> 8) & 0xff;
-			    } else {
-				x1 = v.vector[0] >> 16;
-				distx = (v.vector[0] >> 8) & 0xff;
-				y1 = v.vector[1] >> 16;
-				disty = (v.vector[1] >> 8) & 0xff;
-			    }
-			    x2 = x1 + 1;
-			    y2 = y1 + 1;
-
-			    idistx = 256 - distx;
-			    idisty = 256 - disty;
-
-			    x1_out = (x1 < box.x1) | (x1 >= box.x2);
-			    x2_out = (x2 < box.x1) | (x2 >= box.x2);
-			    y1_out = (y1 < box.y1) | (y1 >= box.y2);
-			    y2_out = (y2 < box.y1) | (y2 >= box.y2);
-
-			    tl = x1_out|y1_out ? 0 : fetch(pict, x1, y1);
-			    tr = x2_out|y1_out ? 0 : fetch(pict, x2, y1);
-			    bl = x1_out|y2_out ? 0 : fetch(pict, x1, y2);
-			    br = x2_out|y2_out ? 0 : fetch(pict, x2, y2);
-
-			    ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx;
-			    fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx;
-			    r = (((ft * idisty + fb * disty) >> 16) & 0xff);
-			    ft = FbGet8(tl,8) * idistx + FbGet8(tr,8) * distx;
-			    fb = FbGet8(bl,8) * idistx + FbGet8(br,8) * distx;
-			    r |= (((ft * idisty + fb * disty) >> 8) & 0xff00);
-			    ft = FbGet8(tl,16) * idistx + FbGet8(tr,16) * distx;
-			    fb = FbGet8(bl,16) * idistx + FbGet8(br,16) * distx;
-			    r |= (((ft * idisty + fb * disty)) & 0xff0000);
-			    ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx;
-			    fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx;
-			    r |= (((ft * idisty + fb * disty) << 8) & 0xff000000);
-			    *(buffer + i) = r;
-			}
-		    }
-
-                    v.vector[0] += unit.vector[0];
-                    v.vector[1] += unit.vector[1];
-                    v.vector[2] += unit.vector[2];
-                }
-            } else {
-                for (i = 0; i < width; ++i) {
-                    if (!mask || mask[i] & maskBits)
-		    {
-			if (!v.vector[2]) {
-			    *(buffer + i) = 0;
-			} else {
-			    int x1, x2, y1, y2, distx, idistx, disty, idisty;
-			    uint32_t tl, tr, bl, br, r;
-			    uint32_t ft, fb;
-
-			    if (!affine) {
-				pixman_fixed_48_16_t div;
-				div = ((pixman_fixed_48_16_t)v.vector[0] << 16)/v.vector[2];
-				x1 = div >> 16;
-				distx = ((pixman_fixed_t)div >> 8) & 0xff;
-				div = ((pixman_fixed_48_16_t)v.vector[1] << 16)/v.vector[2];
-				y1 = div >> 16;
-				disty = ((pixman_fixed_t)div >> 8) & 0xff;
-			    } else {
-				x1 = v.vector[0] >> 16;
-				distx = (v.vector[0] >> 8) & 0xff;
-				y1 = v.vector[1] >> 16;
-				disty = (v.vector[1] >> 8) & 0xff;
-			    }
-			    x2 = x1 + 1;
-			    y2 = y1 + 1;
-
-			    idistx = 256 - distx;
-			    idisty = 256 - disty;
-
-			    tl = pixman_region_contains_point(pict->common.src_clip, x1, y1, &box)
-				? fetch(pict, x1, y1) : 0;
-			    tr = pixman_region_contains_point(pict->common.src_clip, x2, y1, &box)
-				? fetch(pict, x2, y1) : 0;
-			    bl = pixman_region_contains_point(pict->common.src_clip, x1, y2, &box)
-				? fetch(pict, x1, y2) : 0;
-			    br = pixman_region_contains_point(pict->common.src_clip, x2, y2, &box)
-				? fetch(pict, x2, y2) : 0;
-
-			    ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx;
-			    fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx;
-			    r = (((ft * idisty + fb * disty) >> 16) & 0xff);
-			    ft = FbGet8(tl,8) * idistx + FbGet8(tr,8) * distx;
-			    fb = FbGet8(bl,8) * idistx + FbGet8(br,8) * distx;
-			    r |= (((ft * idisty + fb * disty) >> 8) & 0xff00);
-			    ft = FbGet8(tl,16) * idistx + FbGet8(tr,16) * distx;
-			    fb = FbGet8(bl,16) * idistx + FbGet8(br,16) * distx;
-			    r |= (((ft * idisty + fb * disty)) & 0xff0000);
-			    ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx;
-			    fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx;
-			    r |= (((ft * idisty + fb * disty) << 8) & 0xff000000);
-			    *(buffer + i) = r;
-			}
-		    }
-
-                    v.vector[0] += unit.vector[0];
-                    v.vector[1] += unit.vector[1];
-                    v.vector[2] += unit.vector[2];
-                }
-            }
+        if (pict->common.repeat == PIXMAN_REPEAT_NORMAL)
+        {
+            fbFetchTransformed_Bilinear_Normal(pict, width, buffer, mask, maskBits, \
affine, v, unit);  }
-    } else if (pict->common.filter == PIXMAN_FILTER_CONVOLUTION) {
-        pixman_fixed_t *params = pict->common.filter_params;
-        int32_t cwidth = pixman_fixed_to_int(params[0]);
-        int32_t cheight = pixman_fixed_to_int(params[1]);
-        int xoff = (params[0] - pixman_fixed_1) >> 1;
-	int yoff = (params[1] - pixman_fixed_1) >> 1;
-        params += 2;
-        for (i = 0; i < width; ++i) {
-	    if (!mask || mask[i] & maskBits)
-	    {
-		if (!v.vector[2]) {
-		    *(buffer + i) = 0;
-		} else {
-		    int x1, x2, y1, y2, x, y;
-		    int32_t srtot, sgtot, sbtot, satot;
-		    pixman_fixed_t *p = params;
-
-		    if (!affine) {
-			pixman_fixed_48_16_t tmp;
-			tmp = ((pixman_fixed_48_16_t)v.vector[0] << 16)/v.vector[2] - xoff;
-			x1 = pixman_fixed_to_int(tmp);
-			tmp = ((pixman_fixed_48_16_t)v.vector[1] << 16)/v.vector[2] - yoff;
-			y1 = pixman_fixed_to_int(tmp);
-		    } else {
-			x1 = pixman_fixed_to_int(v.vector[0] - xoff);
-			y1 = pixman_fixed_to_int(v.vector[1] - yoff);
-		    }
-		    x2 = x1 + cwidth;
-		    y2 = y1 + cheight;
-
-		    srtot = sgtot = sbtot = satot = 0;
-
-		    for (y = y1; y < y2; y++) {
-			int ty = (pict->common.repeat == PIXMAN_REPEAT_NORMAL) ? MOD (y, pict->height) : \
                y;
-			for (x = x1; x < x2; x++) {
-			    if (*p) {
-				int tx = (pict->common.repeat == PIXMAN_REPEAT_NORMAL) ? MOD (x, pict->width) : \
                x;
-				if (pixman_region_contains_point (pict->common.src_clip, tx, ty, &box)) {
-				    uint32_t c = fetch(pict, tx, ty);
-
-				    srtot += Red(c) * *p;
-				    sgtot += Green(c) * *p;
-				    sbtot += Blue(c) * *p;
-				    satot += Alpha(c) * *p;
-				}
-			    }
-			    p++;
-			}
-		    }
-
-		    satot >>= 16;
-		    srtot >>= 16;
-		    sgtot >>= 16;
-		    sbtot >>= 16;
-
-		    if (satot < 0) satot = 0; else if (satot > 0xff) satot = 0xff;
-		    if (srtot < 0) srtot = 0; else if (srtot > 0xff) srtot = 0xff;
-		    if (sgtot < 0) sgtot = 0; else if (sgtot > 0xff) sgtot = 0xff;
-		    if (sbtot < 0) sbtot = 0; else if (sbtot > 0xff) sbtot = 0xff;
-
-		    *(buffer + i) = ((satot << 24) |
-				     (srtot << 16) |
-				     (sgtot <<  8) |
-				     (sbtot       ));
-		}
-	    }
-            v.vector[0] += unit.vector[0];
-            v.vector[1] += unit.vector[1];
-            v.vector[2] += unit.vector[2];
+        else if (pict->common.repeat == PIXMAN_REPEAT_PAD)
+        {
+            fbFetchTransformed_Bilinear_Pad(pict, width, buffer, mask, maskBits, \
affine, v, unit);  }
+        else
+        {
+            fbFetchTransformed_Bilinear_General(pict, width, buffer, mask, maskBits, \
affine, v, unit); +        }
+    }
+    else if (pict->common.filter == PIXMAN_FILTER_CONVOLUTION)
+    {
+        fbFetchTransformed_Convolution(pict, width, buffer, mask, maskBits, affine, \
v, unit);  }
 
     fbFinishAccess (pict->pDrawable);
 }
 
 
-static void fbFetchExternalAlpha(bits_image_t * pict, int x, int y, int width, \
uint32_t *buffer, uint32_t *mask, uint32_t maskBits) +static void
+fbFetchExternalAlpha(bits_image_t * pict, int x, int y, int width, uint32_t *buffer, \
uint32_t *mask, uint32_t maskBits)  {
     int i;
     uint32_t _alpha_buffer[SCANLINE_BUFFER_LENGTH];
@@ -4191,7 +4296,8 @@ static void fbFetchExternalAlpha(bits_image_t * pict, int x, \
int y, int width, u  free(alpha_buffer);
 }
 
-static void fbStore(bits_image_t * pict, int x, int y, int width, uint32_t *buffer)
+static void
+fbStore(bits_image_t * pict, int x, int y, int width, uint32_t *buffer)
 {
     uint32_t *bits;
     int32_t stride;
@@ -4205,7 +4311,8 @@ static void fbStore(bits_image_t * pict, int x, int y, int \
width, uint32_t *buff  fbFinishAccess (pict->pDrawable);
 }
 
-static void fbStoreExternalAlpha(bits_image_t * pict, int x, int y, int width, \
uint32_t *buffer) +static void
+fbStoreExternalAlpha(bits_image_t * pict, int x, int y, int width, uint32_t *buffer)
 {
     uint32_t *bits, *alpha_bits;
     int32_t stride, astride;
@@ -4284,7 +4391,7 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data,
 	{
 	    fetchSrc = (scanFetchProc)fbFetchExternalAlpha;
 	}
-	else if (bits->common.repeat == PIXMAN_REPEAT_NORMAL &&
+	else if ((bits->common.repeat == PIXMAN_REPEAT_NORMAL || bits->common.repeat == \
PIXMAN_REPEAT_PAD) &&  bits->width == 1 &&
 		 bits->height == 1)
 	{
@@ -4322,7 +4429,7 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data,
 	    {
 		fetchMask = (scanFetchProc)fbFetchExternalAlpha;
 	    }
-	    else if (bits->common.repeat == PIXMAN_REPEAT_NORMAL &&
+	    else if ((bits->common.repeat == PIXMAN_REPEAT_NORMAL || bits->common.repeat == \
PIXMAN_REPEAT_PAD) &&  bits->width == 1 && bits->height == 1)
 	    {
 		fetchMask = (scanFetchProc)fbFetchSolid;
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 7ddb635..10bb8fc 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -600,6 +600,8 @@ union pixman_image
 #define DIV(a,b) ((((a) < 0) == ((b) < 0)) ? (a) / (b) :		\
 		  ((a) - (b) + 1 - (((b) < 0) << 1)) / (b))
 
+#define CLIP(a,b,c) ((a) < (b) ? (b) : ((a) > (c) ? (c) : (a)))
+
 #if 0
 /* FIXME: the MOD macro above is equivalent, but faster I think */
 #define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
-- 
1.5.3



_______________________________________________
cairo mailing list
cairo@cairographics.org
http://lists.cairographics.org/mailman/listinfo/cairo

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic