From: Søren Sandmann Pedersen Date: Wed, 9 Feb 2011 04:42:36 +0000 (-0500) Subject: Add a noop src iterator X-Git-Tag: pixman-0.23.2~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a4e984de19f7f2ca30b1d736cdd2dded91a75907;p=platform%2Fupstream%2Fpixman.git Add a noop src iterator When the image is a8r8g8b8 and not transformed, and the fetched rectangle is within the image bounds, scanlines can be fetched by simply returning a pointer instead of copying the bits. --- diff --git a/pixman/pixman-noop.c b/pixman/pixman-noop.c index e54272b..aaffbde 100644 --- a/pixman/pixman-noop.c +++ b/pixman/pixman-noop.c @@ -54,6 +54,44 @@ dest_write_back_direct (pixman_iter_t *iter) iter->buffer += iter->image->bits.rowstride; } +static uint32_t * +noop_get_scanline (pixman_iter_t *iter, const uint32_t *mask) +{ + uint32_t *result = iter->buffer; + + iter->buffer += iter->image->bits.rowstride; + + return result; +} + +static void +noop_src_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter) +{ + pixman_image_t *image = iter->image; + uint32_t iter_flags = iter->flags; + uint32_t image_flags = image->common.flags; + +#define FLAGS \ + (FAST_PATH_STANDARD_FLAGS | FAST_PATH_ID_TRANSFORM) + + if ((iter_flags & ITER_NARROW) && + (image_flags & FLAGS) == FLAGS && + iter->x >= 0 && iter->y >= 0 && + iter->x + iter->width <= image->bits.width && + iter->y + iter->height <= image->bits.height && + image->common.extended_format_code == PIXMAN_a8r8g8b8) + { + iter->buffer = + image->bits.bits + iter->y * image->bits.rowstride + iter->x; + + iter->get_scanline = noop_get_scanline; + } + else + { + (* imp->delegate->src_iter_init) (imp->delegate, iter); + } +} + static void noop_dest_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter) { @@ -90,6 +128,7 @@ _pixman_implementation_create_noop (pixman_implementation_t *fallback) pixman_implementation_t *imp = _pixman_implementation_create (fallback, noop_fast_paths); + imp->src_iter_init = noop_src_iter_init; imp->dest_iter_init = noop_dest_iter_init; return imp;