summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2011-04-23 10:24:41 -0400
committerSøren Sandmann Pedersen <ssp@redhat.com>2011-05-19 13:46:56 +0000
commitba480882aa465d8414dc8a4472d89d94911af60a (patch)
tree0c03e3277e276fca71d20903a7dfb6fabc585dba
parenta4e984de19f7f2ca30b1d736cdd2dded91a75907 (diff)
Move NULL iterator into pixman-noop.c
Iterating a NULL image returns NULL for all scanlines. We may as well do this in the noop iterator.
-rw-r--r--pixman/pixman-implementation.c12
-rw-r--r--pixman/pixman-noop.c24
2 files changed, 17 insertions, 19 deletions
diff --git a/pixman/pixman-implementation.c b/pixman/pixman-implementation.c
index f1d3f99..2706ceb 100644
--- a/pixman/pixman-implementation.c
+++ b/pixman/pixman-implementation.c
@@ -241,12 +241,6 @@ _pixman_implementation_fill (pixman_implementation_t *imp,
return (*imp->fill) (imp, bits, stride, bpp, x, y, width, height, xor);
}
-static uint32_t *
-get_scanline_null (pixman_iter_t *iter, const uint32_t *mask)
-{
- return NULL;
-}
-
void
_pixman_implementation_src_iter_init (pixman_implementation_t *imp,
pixman_iter_t *iter,
@@ -266,11 +260,7 @@ _pixman_implementation_src_iter_init (pixman_implementation_t *imp,
iter->height = height;
iter->flags = flags;
- if (!image)
- {
- iter->get_scanline = get_scanline_null;
- }
- else if ((flags & (ITER_IGNORE_ALPHA | ITER_IGNORE_RGB)) ==
+ if ((flags & (ITER_IGNORE_ALPHA | ITER_IGNORE_RGB)) ==
(ITER_IGNORE_ALPHA | ITER_IGNORE_RGB))
{
iter->get_scanline = _pixman_iter_get_scanline_noop;
diff --git a/pixman/pixman-noop.c b/pixman/pixman-noop.c
index aaffbde..fc41d7a 100644
--- a/pixman/pixman-noop.c
+++ b/pixman/pixman-noop.c
@@ -64,22 +64,30 @@ noop_get_scanline (pixman_iter_t *iter, const uint32_t *mask)
return result;
}
+static uint32_t *
+get_scanline_null (pixman_iter_t *iter, const uint32_t *mask)
+{
+ return NULL;
+}
+
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)
+ if (!image)
+ {
+ iter->get_scanline = get_scanline_null;
+ }
+ else if ((iter->flags & ITER_NARROW) &&
+ (image->common.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;