summaryrefslogtreecommitdiff
path: root/pixman/pixman-noop.c
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2011-01-24 12:16:03 -0500
committerSøren Sandmann Pedersen <ssp@redhat.com>2011-05-19 13:46:50 +0000
commitd4fff4a95921f734f26ef51953f4dddfcf423eab (patch)
tree548203d447c00b846b5d95080277da24f9a76308 /pixman/pixman-noop.c
parent13ce88f80095d0fa18330a23e03819368987e277 (diff)
downloadpixman-d4fff4a95921f734f26ef51953f4dddfcf423eab.tar.gz
Move noop dest fetching to noop implementation
It will at some point become useful to have CPU specific destination iterators. However, a problem with that, is that such iterators should not be used if we can composite directly in the destination image. By moving the noop destination iterator to the noop implementation, we can ensure that it will be chosen before any CPU specific iterator.
Diffstat (limited to 'pixman/pixman-noop.c')
-rw-r--r--pixman/pixman-noop.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/pixman/pixman-noop.c b/pixman/pixman-noop.c
index 673a02a..e54272b 100644
--- a/pixman/pixman-noop.c
+++ b/pixman/pixman-noop.c
@@ -48,6 +48,36 @@ noop_composite (pixman_implementation_t *imp,
return;
}
+static void
+dest_write_back_direct (pixman_iter_t *iter)
+{
+ iter->buffer += iter->image->bits.rowstride;
+}
+
+static void
+noop_dest_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter)
+{
+ pixman_image_t *image = iter->image;
+ uint32_t image_flags = image->common.flags;
+ uint32_t iter_flags = iter->flags;
+
+ if ((image_flags & FAST_PATH_STD_DEST_FLAGS) == FAST_PATH_STD_DEST_FLAGS &&
+ (iter_flags & ITER_NARROW) == ITER_NARROW &&
+ ((image->common.extended_format_code == PIXMAN_a8r8g8b8) ||
+ (image->common.extended_format_code == PIXMAN_x8r8g8b8 &&
+ (iter_flags & (ITER_LOCALIZED_ALPHA)))))
+ {
+ iter->buffer = image->bits.bits + iter->y * image->bits.rowstride + iter->x;
+
+ iter->get_scanline = _pixman_iter_get_scanline_noop;
+ iter->write_back = dest_write_back_direct;
+ }
+ else
+ {
+ (* imp->delegate->dest_iter_init) (imp->delegate, iter);
+ }
+}
+
static const pixman_fast_path_t noop_fast_paths[] =
{
{ PIXMAN_OP_DST, PIXMAN_any, 0, PIXMAN_any, 0, PIXMAN_any, 0, noop_composite },
@@ -60,5 +90,7 @@ _pixman_implementation_create_noop (pixman_implementation_t *fallback)
pixman_implementation_t *imp =
_pixman_implementation_create (fallback, noop_fast_paths);
+ imp->dest_iter_init = noop_dest_iter_init;
+
return imp;
}