diff options
author | Andrea Canciani <ranma42@gmail.com> | 2010-11-15 19:36:14 +0100 |
---|---|---|
committer | Andrea Canciani <ranma42@gmail.com> | 2010-12-13 17:22:36 +0100 |
commit | 28880382f7e86de925b69c4761558864ddd7efd1 (patch) | |
tree | 84299952e2e085d17725593a87bd9293cc3ef2d0 | |
parent | aa8a2fb9ea15020ac3a2841d15bc11ab1c888ca3 (diff) |
Don't use pixel fetchers
Pixel fetch operations can be performed by fetching a single pixel
through a scanline fetcher.
-rw-r--r-- | pixman/pixman-bits-image.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c index ad32b2b..b61a6de 100644 --- a/pixman/pixman-bits-image.c +++ b/pixman/pixman-bits-image.c @@ -81,13 +81,16 @@ static force_inline uint32_t fetch_pixel_no_alpha (bits_image_t *image, int x, int y, pixman_bool_t check_bounds) { + uint32_t r; + if (check_bounds && (x < 0 || x >= image->width || y < 0 || y >= image->height)) { return 0; } - return image->fetch_pixel_32 (image, x, y); + image->fetch_scanline_32 ((pixman_image_t *) image, x, y, 1, &r, NULL); + return r; } typedef uint32_t (* get_pixel_t) (bits_image_t *image, @@ -656,7 +659,7 @@ fetch_pixel_general (bits_image_t *image, int x, int y, pixman_bool_t check_boun return 0; } - pixel = image->fetch_pixel_32 (image, x, y); + image->fetch_scanline_32 ((pixman_image_t *) image, x, y, 1, &pixel, NULL); if (image->common.alpha_map) { @@ -672,9 +675,8 @@ fetch_pixel_general (bits_image_t *image, int x, int y, pixman_bool_t check_boun } else { - pixel_a = image->common.alpha_map->fetch_pixel_32 ( - image->common.alpha_map, x, y); - + image->common.alpha_map->fetch_scanline_32 ((pixman_image_t *) image->common.alpha_map, + x, y, 1, &pixel_a, NULL); pixel_a = ALPHA_8 (pixel_a); } @@ -1069,7 +1071,7 @@ bits_image_fetch_solid_32 (pixman_image_t * image, uint32_t color; uint32_t *end; - color = image->bits.fetch_pixel_32 (&image->bits, 0, 0); + image->bits.fetch_scanline_32 (image, 0, 0, 1, &color, NULL); end = buffer + width; while (buffer < end) @@ -1088,7 +1090,7 @@ bits_image_fetch_solid_64 (pixman_image_t * image, uint64_t *buffer = (uint64_t *)b; uint64_t *end; - color = image->bits.fetch_pixel_64 (&image->bits, 0, 0); + image->bits.fetch_scanline_64 (image, 0, 0, 1, (uint32_t *)&color, NULL); end = buffer + width; while (buffer < end) |