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-04-21 17:06:06 -0400
commit104177c599175331db60901e81508ff85d75b01f (patch)
tree5d942cd0d5ee5826e16f43b4765079eefaf30e1f
parentce2939b6c75f59cc5ae1d05473d8b6d53ac5e914 (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.c35
2 files changed, 40 insertions, 26 deletions
diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
index 835ecfb3..c3ba05e1 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 979e7c65..9bb640e8 100644
--- a/pixman/pixman-noop.c
+++ b/pixman/pixman-noop.c
@@ -48,6 +48,39 @@ 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;
+ iter_flags_t flags = iter->flags;
+ int x = iter->x;
+ int y = iter->y;
+
+ if (((image->common.flags & (FAST_PATH_NO_ALPHA_MAP | FAST_PATH_NO_ACCESSORS)) ==
+ (FAST_PATH_NO_ALPHA_MAP | FAST_PATH_NO_ACCESSORS)) &&
+ (flags & ITER_NARROW) &&
+ ((image->common.extended_format_code == PIXMAN_a8r8g8b8) ||
+ (image->common.extended_format_code == PIXMAN_x8r8g8b8 &&
+ (flags & (ITER_LOCALIZED_ALPHA)))))
+ {
+ iter->image = image;
+ iter->buffer = image->bits.bits + y * image->bits.rowstride + 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 +93,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;
}