diff options
author | Søren Sandmann Pedersen <ssp@redhat.com> | 2010-12-10 14:39:01 -0500 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@redhat.com> | 2011-01-18 12:42:26 -0500 |
commit | 34b5633105e5e2838ac8deb32d26e3bbe73a3d1a (patch) | |
tree | 0688e2996b5c9a5f0ed1349e84e24f5448d66351 | |
parent | d6b13f99b41eac535d961b89d4b53f616c910c1e (diff) |
Move get_scanline_32/64 to the bits part of the image struct
At this point these functions are basically a cache that the bits
image uses for its fetchers, so they can be moved to the bits image.
With the scanline getters only being initialized in the bits image,
the _pixman_image_get_scanline_generic_64 can be moved to
pixman-bits-image.c. That gets rid of the final user of
_pixman_image_get_scanline_32/64, so these can be deleted.
-rw-r--r-- | pixman/pixman-bits-image.c | 49 | ||||
-rw-r--r-- | pixman/pixman-conical-gradient.c | 2 | ||||
-rw-r--r-- | pixman/pixman-image.c | 62 | ||||
-rw-r--r-- | pixman/pixman-linear-gradient.c | 2 | ||||
-rw-r--r-- | pixman/pixman-private.h | 32 | ||||
-rw-r--r-- | pixman/pixman-radial-gradient.c | 2 | ||||
-rw-r--r-- | pixman/pixman-solid-fill.c | 2 |
7 files changed, 46 insertions, 105 deletions
diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c index bf22dbfe..983e23cd 100644 --- a/pixman/pixman-bits-image.c +++ b/pixman/pixman-bits-image.c @@ -35,6 +35,43 @@ #include "pixman-private.h" #include "pixman-combine32.h" +/* + * By default, just evaluate the image at 32bpp and expand. Individual image + * types can plug in a better scanline getter if they want to. For example + * we could produce smoother gradients by evaluating them at higher color + * depth, but that's a project for the future. + */ +static void +_pixman_image_get_scanline_generic_64 (pixman_image_t * image, + int x, + int y, + int width, + uint32_t * buffer, + const uint32_t * mask) +{ + uint32_t *mask8 = NULL; + + /* Contract the mask image, if one exists, so that the 32-bit fetch + * function can use it. + */ + if (mask) + { + mask8 = pixman_malloc_ab (width, sizeof(uint32_t)); + if (!mask8) + return; + + pixman_contract (mask8, (uint64_t *)mask, width); + } + + /* Fetch the source image into the first half of buffer. */ + image->bits.get_scanline_32 (image, x, y, width, (uint32_t*)buffer, mask8); + + /* Expand from 32bpp to 64bpp in place. */ + pixman_expand ((uint64_t *)buffer, buffer, PIXMAN_a8r8g8b8, width); + + free (mask8); +} + /* Fetch functions */ static force_inline uint32_t @@ -1298,8 +1335,8 @@ bits_image_property_changed (pixman_image_t *image) if ((info->format == format || info->format == PIXMAN_any) && (info->flags & flags) == info->flags) { - image->common.get_scanline_32 = info->fetch_32; - image->common.get_scanline_64 = info->fetch_64; + image->bits.get_scanline_32 = info->fetch_32; + image->bits.get_scanline_64 = info->fetch_64; break; } @@ -1310,7 +1347,7 @@ bits_image_property_changed (pixman_image_t *image) static uint32_t * src_get_scanline_narrow (pixman_iter_t *iter, const uint32_t *mask) { - iter->image->common.get_scanline_32 ( + iter->image->bits.get_scanline_32 ( iter->image, iter->x, iter->y++, iter->width, iter->buffer, mask); return iter->buffer; @@ -1319,7 +1356,7 @@ src_get_scanline_narrow (pixman_iter_t *iter, const uint32_t *mask) static uint32_t * src_get_scanline_wide (pixman_iter_t *iter, const uint32_t *mask) { - iter->image->common.get_scanline_64 ( + iter->image->bits.get_scanline_64 ( iter->image, iter->x, iter->y++, iter->width, iter->buffer, mask); return iter->buffer; @@ -1340,7 +1377,7 @@ _pixman_bits_image_src_iter_init (pixman_image_t *image, static uint32_t * dest_get_scanline_narrow (pixman_iter_t *iter, const uint32_t *mask) { - iter->image->common.get_scanline_32 ( + iter->image->bits.get_scanline_32 ( iter->image, iter->x, iter->y, iter->width, iter->buffer, mask); return iter->buffer; @@ -1349,7 +1386,7 @@ dest_get_scanline_narrow (pixman_iter_t *iter, const uint32_t *mask) static uint32_t * dest_get_scanline_wide (pixman_iter_t *iter, const uint32_t *mask) { - iter->image->common.get_scanline_64 ( + iter->image->bits.get_scanline_64 ( iter->image, iter->x, iter->y, iter->width, iter->buffer, mask); return iter->buffer; diff --git a/pixman/pixman-conical-gradient.c b/pixman/pixman-conical-gradient.c index 35913cb3..a00170bd 100644 --- a/pixman/pixman-conical-gradient.c +++ b/pixman/pixman-conical-gradient.c @@ -159,8 +159,6 @@ conical_gradient_get_scanline_32 (pixman_image_t *image, static void conical_gradient_property_changed (pixman_image_t *image) { - image->common.get_scanline_32 = conical_gradient_get_scanline_32; - image->common.get_scanline_64 = _pixman_image_get_scanline_generic_64; } static uint32_t * diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c index b487df08..e0592864 100644 --- a/pixman/pixman-image.c +++ b/pixman/pixman-image.c @@ -50,43 +50,6 @@ _pixman_init_gradient (gradient_t * gradient, return TRUE; } -/* - * By default, just evaluate the image at 32bpp and expand. Individual image - * types can plug in a better scanline getter if they want to. For example - * we could produce smoother gradients by evaluating them at higher color - * depth, but that's a project for the future. - */ -void -_pixman_image_get_scanline_generic_64 (pixman_image_t * image, - int x, - int y, - int width, - uint32_t * buffer, - const uint32_t * mask) -{ - uint32_t *mask8 = NULL; - - /* Contract the mask image, if one exists, so that the 32-bit fetch - * function can use it. - */ - if (mask) - { - mask8 = pixman_malloc_ab (width, sizeof(uint32_t)); - if (!mask8) - return; - - pixman_contract (mask8, (uint64_t *)mask, width); - } - - /* Fetch the source image into the first half of buffer. */ - _pixman_image_get_scanline_32 (image, x, y, width, (uint32_t*)buffer, mask8); - - /* Expand from 32bpp to 64bpp in place. */ - pixman_expand ((uint64_t *)buffer, buffer, PIXMAN_a8r8g8b8, width); - - free (mask8); -} - pixman_image_t * _pixman_image_allocate (void) { @@ -132,31 +95,6 @@ _pixman_image_classify (pixman_image_t *image, return SOURCE_IMAGE_CLASS_UNKNOWN; } -void -_pixman_image_get_scanline_32 (pixman_image_t *image, - int x, - int y, - int width, - uint32_t * buffer, - const uint32_t *mask) -{ - image->common.get_scanline_32 (image, x, y, width, buffer, mask); -} - -/* Even thought the type of buffer is uint32_t *, the function actually expects - * a uint64_t *buffer. - */ -void -_pixman_image_get_scanline_64 (pixman_image_t *image, - int x, - int y, - int width, - uint32_t * buffer, - const uint32_t *unused) -{ - image->common.get_scanline_64 (image, x, y, width, buffer, unused); -} - static void image_property_changed (pixman_image_t *image) { diff --git a/pixman/pixman-linear-gradient.c b/pixman/pixman-linear-gradient.c index 5de3cc81..a19d9a84 100644 --- a/pixman/pixman-linear-gradient.c +++ b/pixman/pixman-linear-gradient.c @@ -222,8 +222,6 @@ linear_get_scanline_32 (pixman_image_t *image, static void linear_gradient_property_changed (pixman_image_t *image) { - image->common.get_scanline_32 = linear_get_scanline_32; - image->common.get_scanline_64 = _pixman_image_get_scanline_generic_64; } static uint32_t * diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h index 9028c162..d7c7a62e 100644 --- a/pixman/pixman-private.h +++ b/pixman/pixman-private.h @@ -97,8 +97,6 @@ struct image_common pixman_bool_t component_alpha; classify_func_t classify; property_changed_func_t property_changed; - fetch_scanline_t get_scanline_32; - fetch_scanline_t get_scanline_64; pixman_image_destroy_func_t destroy_func; void * destroy_data; @@ -168,6 +166,9 @@ struct bits_image uint32_t * free_me; int rowstride; /* in number of uint32_t's */ + fetch_scanline_t get_scanline_32; + fetch_scanline_t get_scanline_64; + fetch_scanline_t fetch_scanline_32; fetch_pixel_32_t fetch_pixel_32; store_scanline_t store_scanline_32; @@ -248,14 +249,6 @@ _pixman_conical_gradient_iter_init (pixman_image_t *image, int x, int y, int width, int height, uint8_t *buffer, iter_flags_t flags); -void -_pixman_image_get_scanline_generic_64 (pixman_image_t *image, - int x, - int y, - int width, - uint32_t * buffer, - const uint32_t *mask); - source_image_class_t _pixman_image_classify (pixman_image_t *image, int x, @@ -263,25 +256,6 @@ _pixman_image_classify (pixman_image_t *image, int width, int height); -void -_pixman_image_get_scanline_32 (pixman_image_t *image, - int x, - int y, - int width, - uint32_t * buffer, - const uint32_t *mask); - -/* Even thought the type of buffer is uint32_t *, the function actually expects - * a uint64_t *buffer. - */ -void -_pixman_image_get_scanline_64 (pixman_image_t *image, - int x, - int y, - int width, - uint32_t * buffer, - const uint32_t *unused); - pixman_image_t * _pixman_image_allocate (void); diff --git a/pixman/pixman-radial-gradient.c b/pixman/pixman-radial-gradient.c index 161055aa..51218272 100644 --- a/pixman/pixman-radial-gradient.c +++ b/pixman/pixman-radial-gradient.c @@ -389,8 +389,6 @@ radial_gradient_get_scanline_32 (pixman_image_t *image, static void radial_gradient_property_changed (pixman_image_t *image) { - image->common.get_scanline_32 = radial_gradient_get_scanline_32; - image->common.get_scanline_64 = _pixman_image_get_scanline_generic_64; } static uint32_t * diff --git a/pixman/pixman-solid-fill.c b/pixman/pixman-solid-fill.c index 0af4df08..f2df3c76 100644 --- a/pixman/pixman-solid-fill.c +++ b/pixman/pixman-solid-fill.c @@ -72,8 +72,6 @@ solid_fill_classify (pixman_image_t *image, static void solid_fill_property_changed (pixman_image_t *image) { - image->common.get_scanline_32 = solid_fill_get_scanline_32; - image->common.get_scanline_64 = solid_fill_get_scanline_64; } void |