diff options
author | Søren Sandmann Pedersen <ssp@redhat.com> | 2010-09-11 10:00:09 -0400 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@redhat.com> | 2010-10-31 03:24:10 -0400 |
commit | bfdb64636c74eb5f41f25167877bb0150924cd9d (patch) | |
tree | 1aef5097b594c194b614d5ecd50e9b94ae761d84 | |
parent | 5446aae36a02b1ea20e36662e98281f3d8f325a0 (diff) |
general: Replace the switch with a tableimpacc
The switch that determined which fetcher to use is replaced with a
table indexed by image type.
-rw-r--r-- | pixman/pixman-general.c | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c index e54485ef..a4fb94ba 100644 --- a/pixman/pixman-general.c +++ b/pixman/pixman-general.c @@ -41,38 +41,31 @@ #define SCANLINE_BUFFER_LENGTH 8192 -static fetch_scanline_t -general_get_fetcher_32 (pixman_implementation_t *imp, pixman_image_t *image) +typedef struct { - switch (image->type) - { - case BITS: - return _general_bits_get_scanline_32; - - case SOLID: - return _general_solid_get_scanline_32; + fetch_scanline_t fetch_32; + fetch_scanline_t fetch_64; +} fetchers_t; - case LINEAR: - return _general_linear_get_scanline_32; - - case RADIAL: - return _general_radial_get_scanline_32; - - case CONICAL: - return _general_conical_get_scanline_32; +static const fetchers_t fetcher_table[] = +{ + { _general_bits_get_scanline_32, NULL }, + { _general_linear_get_scanline_32, NULL }, + { _general_conical_get_scanline_32, NULL }, + { _general_radial_get_scanline_32, NULL }, + { _general_solid_get_scanline_32, _general_solid_get_scanline_64 }, +}; - default: - return NULL; - } +static fetch_scanline_t +general_get_fetcher_32 (pixman_implementation_t *imp, pixman_image_t *image) +{ + return fetcher_table[image->type].fetch_32; } static fetch_scanline_t general_get_fetcher_64 (pixman_implementation_t *imp, pixman_image_t *image) { - if (image->type == SOLID) - return _general_solid_get_scanline_64; - - return NULL; + return fetcher_table[image->type].fetch_64; } typedef void (* imp_fetcher_t) (pixman_implementation_t *imp, |