From: Søren Sandmann Pedersen Date: Sun, 29 Aug 2010 21:07:40 +0000 (-0400) Subject: Remove FAST_PATH_NARROW_FORMAT flag if there is a wide alpha map X-Git-Tag: pixman-0.19.4~28 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=af2f0080feada1abe569e2031acacf51be7f8f68;p=platform%2Fupstream%2Fpixman.git Remove FAST_PATH_NARROW_FORMAT flag if there is a wide alpha map If an image has an alpha map that has wide components, then we need to use 64 bit processing for that image. We detect this situation in pixman-image.c and remove the FAST_PATH_NARROW_FORMAT flag. In pixman-general, the wide/narrow decision is now based on the flags instead of on the formats. --- diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c index fc276bd..4d234a0 100644 --- a/pixman/pixman-general.c +++ b/pixman/pixman-general.c @@ -57,17 +57,6 @@ general_composite_rect (pixman_implementation_t *imp, int32_t height) { uint8_t stack_scanline_buffer[SCANLINE_BUFFER_LENGTH * 3]; - const pixman_format_code_t src_format = - src->type == BITS ? src->bits.format : 0; - const pixman_format_code_t mask_format = - mask && mask->type == BITS ? mask->bits.format : 0; - const pixman_format_code_t dest_format = - dest->type == BITS ? dest->bits.format : 0; - const int src_narrow = !PIXMAN_FORMAT_IS_WIDE (src_format); - const int mask_narrow = !mask || !PIXMAN_FORMAT_IS_WIDE (mask_format); - const int dest_narrow = !PIXMAN_FORMAT_IS_WIDE (dest_format); - const int narrow = src_narrow && mask_narrow && dest_narrow; - const int Bpp = narrow ? 4 : 8; uint8_t *scanline_buffer = stack_scanline_buffer; uint8_t *src_buffer, *mask_buffer, *dest_buffer; fetch_scanline_t fetch_src = NULL, fetch_mask = NULL, fetch_dest = NULL; @@ -77,8 +66,15 @@ general_composite_rect (pixman_implementation_t *imp, pixman_bool_t component_alpha; uint32_t *bits; int32_t stride; + int narrow, Bpp; int i; + narrow = + (src->common.flags & FAST_PATH_NARROW_FORMAT) && + (!mask || mask->common.flags & FAST_PATH_NARROW_FORMAT) && + (dest->common.flags & FAST_PATH_NARROW_FORMAT); + Bpp = narrow ? 4 : 8; + if (width * Bpp > SCANLINE_BUFFER_LENGTH) { scanline_buffer = pixman_malloc_abc (width, 3, Bpp); diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c index 102df6c..029a1df 100644 --- a/pixman/pixman-image.c +++ b/pixman/pixman-image.c @@ -327,10 +327,6 @@ compute_image_info (pixman_image_t *image) flags |= FAST_PATH_Y_UNIT_ZERO; } - /* Alpha map */ - if (!image->common.alpha_map) - flags |= FAST_PATH_NO_ALPHA_MAP; - /* Filter */ switch (image->common.filter) { @@ -454,6 +450,17 @@ compute_image_info (pixman_image_t *image) break; } + /* Alpha map */ + if (!image->common.alpha_map) + { + flags |= FAST_PATH_NO_ALPHA_MAP; + } + else + { + if (PIXMAN_FORMAT_IS_WIDE (image->common.alpha_map->format)) + flags &= ~FAST_PATH_NARROW_FORMAT; + } + /* Both alpha maps and convolution filters can introduce * non-opaqueness in otherwise opaque images. Also * an image with component alpha turned on is only opaque