summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2011-02-08 23:42:36 -0500
committerSøren Sandmann Pedersen <ssp@redhat.com>2011-05-19 13:46:56 +0000
commita4e984de19f7f2ca30b1d736cdd2dded91a75907 (patch)
treeff0bb019b2c6511a8bc6fd005a1f66527d2e8f6a
parentd4fff4a95921f734f26ef51953f4dddfcf423eab (diff)
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.
-rw-r--r--pixman/pixman-noop.c39
1 files changed, 39 insertions, 0 deletions
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;