summaryrefslogtreecommitdiff
path: root/pixman/pixman-bits-image.c
diff options
context:
space:
mode:
authorSiarhei Siamashka <siarhei.siamashka@gmail.com>2012-06-26 01:06:10 +0300
committerSiarhei Siamashka <siarhei.siamashka@gmail.com>2012-07-01 21:45:43 +0300
commitccd31896bc2f1f323b3be9e8b1447cab892ee62d (patch)
tree2857dd43c40fc1157b376cdd9104205667f23d88 /pixman/pixman-bits-image.c
parentad9f1d020188fe90ae742041195baebdfbe6fe27 (diff)
downloadpixman-ccd31896bc2f1f323b3be9e8b1447cab892ee62d.tar.gz
Bilinear interpolation precision is now configurable at compile time
Macro BILINEAR_INTERPOLATION_BITS in pixman-private.h selects the number of fractional bits used for bilinear interpolation. scaling-test and affine-test have checksums for 4-bit, 7-bit and 8-bit configurations.
Diffstat (limited to 'pixman/pixman-bits-image.c')
-rw-r--r--pixman/pixman-bits-image.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
index 05eab96..b6c8630 100644
--- a/pixman/pixman-bits-image.c
+++ b/pixman/pixman-bits-image.c
@@ -131,8 +131,8 @@ bits_image_fetch_pixel_bilinear (bits_image_t *image,
x1 = x - pixman_fixed_1 / 2;
y1 = y - pixman_fixed_1 / 2;
- distx = (x1 >> 8) & 0xff;
- disty = (y1 >> 8) & 0xff;
+ distx = pixman_fixed_to_bilinear_weight (x1);
+ disty = pixman_fixed_to_bilinear_weight (y1);
x1 = pixman_fixed_to_int (x1);
y1 = pixman_fixed_to_int (y1);
@@ -200,7 +200,7 @@ bits_image_fetch_bilinear_no_repeat_8888 (pixman_iter_t *iter,
x = x_top = x_bottom = v.vector[0] - pixman_fixed_1/2;
y = v.vector[1] - pixman_fixed_1/2;
- disty = (y >> 8) & 0xff;
+ disty = pixman_fixed_to_bilinear_weight (y);
/* Load the pointers to the first and second lines from the source
* image that bilinear code must read.
@@ -309,7 +309,7 @@ bits_image_fetch_bilinear_no_repeat_8888 (pixman_iter_t *iter,
tr = top_row[pixman_fixed_to_int (x_top) + 1] | top_mask;
br = bottom_row[pixman_fixed_to_int (x_bottom) + 1] | bottom_mask;
- distx = (x >> 8) & 0xff;
+ distx = pixman_fixed_to_bilinear_weight (x);
*buffer++ = bilinear_interpolation (0, tr, 0, br, distx, disty);
@@ -334,7 +334,7 @@ bits_image_fetch_bilinear_no_repeat_8888 (pixman_iter_t *iter,
bl = bottom_row [pixman_fixed_to_int (x_bottom)] | bottom_mask;
br = bottom_row [pixman_fixed_to_int (x_bottom) + 1] | bottom_mask;
- distx = (x >> 8) & 0xff;
+ distx = pixman_fixed_to_bilinear_weight (x);
*buffer = bilinear_interpolation (tl, tr, bl, br, distx, disty);
}
@@ -358,7 +358,7 @@ bits_image_fetch_bilinear_no_repeat_8888 (pixman_iter_t *iter,
tl = top_row [pixman_fixed_to_int (x_top)] | top_mask;
bl = bottom_row [pixman_fixed_to_int (x_bottom)] | bottom_mask;
- distx = (x >> 8) & 0xff;
+ distx = pixman_fixed_to_bilinear_weight (x);
*buffer = bilinear_interpolation (tl, 0, bl, 0, distx, disty);
}
@@ -695,8 +695,8 @@ bits_image_fetch_bilinear_affine (pixman_image_t * image,
x1 = x - pixman_fixed_1 / 2;
y1 = y - pixman_fixed_1 / 2;
- distx = (x1 >> 8) & 0xff;
- disty = (y1 >> 8) & 0xff;
+ distx = pixman_fixed_to_bilinear_weight (x1);
+ disty = pixman_fixed_to_bilinear_weight (y1);
y1 = pixman_fixed_to_int (y1);
y2 = y1 + 1;