diff options
-rw-r--r-- | pixman/pixman-image.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c index 6a965e46..8b634a7d 100644 --- a/pixman/pixman-image.c +++ b/pixman/pixman-image.c @@ -879,13 +879,34 @@ _pixman_image_get_solid (pixman_implementation_t *imp, pixman_format_code_t format) { uint32_t result; - pixman_iter_t iter; - _pixman_implementation_src_iter_init ( - imp, &iter, image, 0, 0, 1, 1, - (uint8_t *)&result, ITER_NARROW, image->common.flags); - - result = *iter.get_scanline (&iter, NULL); + if (image->type == SOLID) + { + result = image->solid.color_32; + } + else if (image->type == BITS) + { + if (image->bits.format == PIXMAN_a8r8g8b8) + result = image->bits.bits[0]; + else if (image->bits.format == PIXMAN_x8r8g8b8) + result = image->bits.bits[0] | 0xff000000; + else if (image->bits.format == PIXMAN_a8) + result = (*(uint8_t *)image->bits.bits) << 24; + else + goto otherwise; + } + else + { + pixman_iter_t iter; + + otherwise: + _pixman_implementation_src_iter_init ( + imp, &iter, image, 0, 0, 1, 1, + (uint8_t *)&result, + ITER_NARROW, image->common.flags); + + result = *iter.get_scanline (&iter, NULL); + } /* If necessary, convert RGB <--> BGR. */ if (PIXMAN_FORMAT_TYPE (format) != PIXMAN_TYPE_ARGB) |