From 056c6d97db753a928ac2794ec215c86cceffe901 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Wed, 5 Nov 2008 23:58:56 -0500 Subject: [PATCH] Various formatting fixes, and a simplification of the adjusting code --- pixman/pixman-transformed.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/pixman/pixman-transformed.c b/pixman/pixman-transformed.c index 389fabb..8372e18 100644 --- a/pixman/pixman-transformed.c +++ b/pixman/pixman-transformed.c @@ -59,7 +59,7 @@ typedef FASTCALL uint32_t (*fetchFromRegionProc)(bits_image_t *pict, int x, int * for is when src_clip is false. Since inside_bounds is statically known, * the last part of the if statement will normally be optimized away. */ -static inline uint32_t +static force_inline uint32_t do_fetch (bits_image_t *pict, int x, int y, fetchPixelProc32 fetch, pixman_bool_t src_clip, pixman_bool_t inside_bounds) @@ -234,7 +234,8 @@ fetch_bilinear (bits_image_t *pict, } 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) +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) { fetchPixelProc32 fetch; int i; @@ -371,7 +372,8 @@ ACCESS(fbFetchTransformed)(bits_image_t * pict, int x, int y, int width, unit.vector[0] = pict->common.transform->matrix[0][0]; unit.vector[1] = pict->common.transform->matrix[1][0]; unit.vector[2] = pict->common.transform->matrix[2][0]; - affine = v.vector[2] == pixman_fixed_1 && unit.vector[2] == 0; + + affine = (v.vector[2] == pixman_fixed_1 && unit.vector[2] == 0); } else { @@ -381,8 +383,6 @@ ACCESS(fbFetchTransformed)(bits_image_t * pict, int x, int y, int width, } /* This allows filtering code to pretend that pixels are located at integer coordinates */ - adjust (&v, &unit, -(pixman_fixed_1 / 2)); - if (pict->common.filter == PIXMAN_FILTER_NEAREST || pict->common.filter == PIXMAN_FILTER_FAST) { fetchPixelProc32 fetch; @@ -390,9 +390,8 @@ ACCESS(fbFetchTransformed)(bits_image_t * pict, int x, int y, int width, int i; /* Round down to closest integer, ensuring that 0.5 rounds to 0, not 1 */ - adjust (&v, &unit, pixman_fixed_1 / 2 - pixman_fixed_e); + adjust (&v, &unit, - pixman_fixed_e); - /* initialize the two function pointers */ fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict); src_clip = pict->common.src_clip != &(pict->common.full_region); @@ -414,7 +413,10 @@ ACCESS(fbFetchTransformed)(bits_image_t * pict, int x, int y, int width, pixman_bool_t src_clip; fetchPixelProc32 fetch; int i; - + + /* Let the bilinear code pretend that pixels fall on integer coordinaters */ + adjust (&v, &unit, -(pixman_fixed_1 / 2)); + fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict); src_clip = pict->common.src_clip != &(pict->common.full_region); @@ -431,7 +433,7 @@ ACCESS(fbFetchTransformed)(bits_image_t * pict, int x, int y, int width, else if (pict->common.filter == PIXMAN_FILTER_CONVOLUTION) { /* Round to closest integer, ensuring that 0.5 rounds to 0, not 1 */ - adjust (&v, &unit, pixman_fixed_1 / 2 - pixman_fixed_e); + adjust (&v, &unit, - pixman_fixed_e); fbFetchTransformed_Convolution(pict, width, buffer, mask, maskBits, affine, v, unit); } -- 2.7.4