summaryrefslogtreecommitdiff
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
parent13ce88f80095d0fa18330a23e03819368987e277 (diff)
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.
-rw-r--r--pixman/pixman-bits-image.c31
-rw-r--r--pixman/pixman-noop.c32
2 files changed, 37 insertions, 26 deletions
diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
index 835ecfb..4e9ed14 100644
--- a/pixman/pixman-bits-image.c
+++ b/pixman/pixman-bits-image.c
@@ -1462,43 +1462,22 @@ dest_write_back_wide (pixman_iter_t *iter)
iter->y++;
}
-static void
-dest_write_back_direct (pixman_iter_t *iter)
-{
- iter->buffer += iter->image->bits.rowstride;
-}
-
void
_pixman_bits_image_dest_iter_init (pixman_image_t *image, pixman_iter_t *iter)
{
if (iter->flags & ITER_NARROW)
{
- if (((image->common.flags &
- (FAST_PATH_NO_ALPHA_MAP | FAST_PATH_NO_ACCESSORS)) ==
- (FAST_PATH_NO_ALPHA_MAP | FAST_PATH_NO_ACCESSORS)) &&
- (image->bits.format == PIXMAN_a8r8g8b8 ||
- (image->bits.format == PIXMAN_x8r8g8b8 &&
- (iter->flags & ITER_LOCALIZED_ALPHA))))
+ if ((iter->flags & (ITER_IGNORE_RGB | ITER_IGNORE_ALPHA)) ==
+ (ITER_IGNORE_RGB | ITER_IGNORE_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
{
- if ((iter->flags & (ITER_IGNORE_RGB | ITER_IGNORE_ALPHA)) ==
- (ITER_IGNORE_RGB | ITER_IGNORE_ALPHA))
- {
- iter->get_scanline = _pixman_iter_get_scanline_noop;
- }
- else
- {
- iter->get_scanline = dest_get_scanline_narrow;
- }
-
- iter->write_back = dest_write_back_narrow;
+ iter->get_scanline = dest_get_scanline_narrow;
}
+
+ iter->write_back = dest_write_back_narrow;
}
else
{
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;
}