[Pixman] [PATCH 1/2] Pass the full image flags to iterators
Søren Sandmann
sandmann at cs.au.dk
Wed May 30 01:43:28 PDT 2012
From: Søren Sandmann Pedersen <ssp at redhat.com>
When pixman_image_composite32() is called some flags are computed that
indicate various things about the composite operation that can't be
deduced from the image flags themselves. These additional flags are
not currently available to iterators. All they can do is read the
image flags in image->common.flags.
Fix that by passing the info->{src, mask, dest}_flags on to the
iterator initialization and store the flags in the iter struct as
"image_flags". At the same time rename the *iterator* flags variable
to "iter_flags" to avoid confusion.
---
pixman/pixman-bits-image.c | 6 +++---
pixman/pixman-conical-gradient.c | 2 +-
pixman/pixman-general.c | 12 ++++++------
pixman/pixman-image.c | 2 +-
pixman/pixman-implementation.c | 12 ++++++++----
pixman/pixman-linear-gradient.c | 4 ++--
pixman/pixman-mmx.c | 4 ++--
pixman/pixman-noop.c | 14 +++++++-------
pixman/pixman-private.h | 9 ++++++---
pixman/pixman-radial-gradient.c | 2 +-
pixman/pixman-solid-fill.c | 2 +-
pixman/pixman-sse2.c | 4 ++--
12 files changed, 40 insertions(+), 33 deletions(-)
diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
index 1f6897c..3ba6739 100644
--- a/pixman/pixman-bits-image.c
+++ b/pixman/pixman-bits-image.c
@@ -1248,7 +1248,7 @@ src_get_scanline_wide (pixman_iter_t *iter, const uint32_t *mask)
void
_pixman_bits_image_src_iter_init (pixman_image_t *image, pixman_iter_t *iter)
{
- if (iter->flags & ITER_NARROW)
+ if (iter->iter_flags & ITER_NARROW)
iter->get_scanline = src_get_scanline_narrow;
else
iter->get_scanline = src_get_scanline_wide;
@@ -1380,9 +1380,9 @@ dest_write_back_wide (pixman_iter_t *iter)
void
_pixman_bits_image_dest_iter_init (pixman_image_t *image, pixman_iter_t *iter)
{
- if (iter->flags & ITER_NARROW)
+ if (iter->iter_flags & ITER_NARROW)
{
- if ((iter->flags & (ITER_IGNORE_RGB | ITER_IGNORE_ALPHA)) ==
+ if ((iter->iter_flags & (ITER_IGNORE_RGB | ITER_IGNORE_ALPHA)) ==
(ITER_IGNORE_RGB | ITER_IGNORE_ALPHA))
{
iter->get_scanline = _pixman_iter_get_scanline_noop;
diff --git a/pixman/pixman-conical-gradient.c b/pixman/pixman-conical-gradient.c
index 791d4f3..8b52176 100644
--- a/pixman/pixman-conical-gradient.c
+++ b/pixman/pixman-conical-gradient.c
@@ -173,7 +173,7 @@ conical_get_scanline_wide (pixman_iter_t *iter, const uint32_t *mask)
void
_pixman_conical_gradient_iter_init (pixman_image_t *image, pixman_iter_t *iter)
{
- if (iter->flags & ITER_NARROW)
+ if (iter->iter_flags & ITER_NARROW)
iter->get_scanline = conical_get_scanline_narrow;
else
iter->get_scanline = conical_get_scanline_wide;
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index 27fa3ab..d4b2daa 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -110,7 +110,7 @@ general_composite_rect (pixman_implementation_t *imp,
pixman_iter_t src_iter, mask_iter, dest_iter;
pixman_combine_32_func_t compose;
pixman_bool_t component_alpha;
- iter_flags_t narrow, src_flags;
+ iter_flags_t narrow, src_iter_flags;
int Bpp;
int i;
@@ -140,14 +140,14 @@ general_composite_rect (pixman_implementation_t *imp,
dest_buffer = mask_buffer + width * Bpp;
/* src iter */
- src_flags = narrow | op_flags[op].src;
+ src_iter_flags = narrow | op_flags[op].src;
_pixman_implementation_src_iter_init (imp->toplevel, &src_iter, src_image,
src_x, src_y, width, height,
- src_buffer, src_flags);
+ src_buffer, src_iter_flags, info->src_flags);
/* mask iter */
- if ((src_flags & (ITER_IGNORE_ALPHA | ITER_IGNORE_RGB)) ==
+ if ((src_iter_flags & (ITER_IGNORE_ALPHA | ITER_IGNORE_RGB)) ==
(ITER_IGNORE_ALPHA | ITER_IGNORE_RGB))
{
/* If it doesn't matter what the source is, then it doesn't matter
@@ -164,12 +164,12 @@ general_composite_rect (pixman_implementation_t *imp,
_pixman_implementation_src_iter_init (
imp->toplevel, &mask_iter, mask_image, mask_x, mask_y, width, height,
- mask_buffer, narrow | (component_alpha? 0 : ITER_IGNORE_RGB));
+ mask_buffer, narrow | (component_alpha? 0 : ITER_IGNORE_RGB), info->mask_flags);
/* dest iter */
_pixman_implementation_dest_iter_init (
imp->toplevel, &dest_iter, dest_image, dest_x, dest_y, width, height,
- dest_buffer, narrow | op_flags[op].dst);
+ dest_buffer, narrow | op_flags[op].dst, info->dest_flags);
compose = _pixman_implementation_lookup_combiner (
imp->toplevel, op, component_alpha, narrow);
diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index 8599a1e..6a965e4 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -883,7 +883,7 @@ _pixman_image_get_solid (pixman_implementation_t *imp,
_pixman_implementation_src_iter_init (
imp, &iter, image, 0, 0, 1, 1,
- (uint8_t *)&result, ITER_NARROW);
+ (uint8_t *)&result, ITER_NARROW, image->common.flags);
result = *iter.get_scanline (&iter, NULL);
diff --git a/pixman/pixman-implementation.c b/pixman/pixman-implementation.c
index b0a2959..c769ab8 100644
--- a/pixman/pixman-implementation.c
+++ b/pixman/pixman-implementation.c
@@ -185,7 +185,8 @@ _pixman_implementation_src_iter_init (pixman_implementation_t *imp,
int width,
int height,
uint8_t *buffer,
- iter_flags_t flags)
+ iter_flags_t iter_flags,
+ uint32_t image_flags)
{
iter->image = image;
iter->buffer = (uint32_t *)buffer;
@@ -193,7 +194,8 @@ _pixman_implementation_src_iter_init (pixman_implementation_t *imp,
iter->y = y;
iter->width = width;
iter->height = height;
- iter->flags = flags;
+ iter->iter_flags = iter_flags;
+ iter->image_flags = image_flags;
(*imp->src_iter_init) (imp, iter);
}
@@ -207,7 +209,8 @@ _pixman_implementation_dest_iter_init (pixman_implementation_t *imp,
int width,
int height,
uint8_t *buffer,
- iter_flags_t flags)
+ iter_flags_t iter_flags,
+ uint32_t image_flags)
{
iter->image = image;
iter->buffer = (uint32_t *)buffer;
@@ -215,7 +218,8 @@ _pixman_implementation_dest_iter_init (pixman_implementation_t *imp,
iter->y = y;
iter->width = width;
iter->height = height;
- iter->flags = flags;
+ iter->iter_flags = iter_flags;
+ iter->image_flags = image_flags;
(*imp->dest_iter_init) (imp, iter);
}
diff --git a/pixman/pixman-linear-gradient.c b/pixman/pixman-linear-gradient.c
index 6e1ea24..32b8ba7 100644
--- a/pixman/pixman-linear-gradient.c
+++ b/pixman/pixman-linear-gradient.c
@@ -238,7 +238,7 @@ _pixman_linear_gradient_iter_init (pixman_image_t *image, pixman_iter_t *iter)
if (linear_gradient_is_horizontal (
iter->image, iter->x, iter->y, iter->width, iter->height))
{
- if (iter->flags & ITER_NARROW)
+ if (iter->iter_flags & ITER_NARROW)
linear_get_scanline_narrow (iter, NULL);
else
linear_get_scanline_wide (iter, NULL);
@@ -247,7 +247,7 @@ _pixman_linear_gradient_iter_init (pixman_image_t *image, pixman_iter_t *iter)
}
else
{
- if (iter->flags & ITER_NARROW)
+ if (iter->iter_flags & ITER_NARROW)
iter->get_scanline = linear_get_scanline_narrow;
else
iter->get_scanline = linear_get_scanline_wide;
diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index 6e292c6..cf3c4e4 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -3664,8 +3664,8 @@ mmx_src_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter)
#define FLAGS \
(FAST_PATH_STANDARD_FLAGS | FAST_PATH_ID_TRANSFORM | FAST_PATH_BITS_IMAGE)
- if ((iter->flags & ITER_NARROW) &&
- (image->common.flags & FLAGS) == FLAGS &&
+ if ((iter->iter_flags & ITER_NARROW) &&
+ (iter->image_flags & FLAGS) == FLAGS &&
x >= 0 && y >= 0 &&
x + width <= image->bits.width &&
y + height <= image->bits.height)
diff --git a/pixman/pixman-noop.c b/pixman/pixman-noop.c
index d835de6..7b017e8 100644
--- a/pixman/pixman-noop.c
+++ b/pixman/pixman-noop.c
@@ -71,18 +71,18 @@ noop_src_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter)
{
iter->get_scanline = get_scanline_null;
}
- else if ((iter->flags & (ITER_IGNORE_ALPHA | ITER_IGNORE_RGB)) ==
+ else if ((iter->iter_flags & (ITER_IGNORE_ALPHA | ITER_IGNORE_RGB)) ==
(ITER_IGNORE_ALPHA | ITER_IGNORE_RGB))
{
iter->get_scanline = _pixman_iter_get_scanline_noop;
}
else if (image->common.extended_format_code == PIXMAN_solid &&
- ((image->common.flags & (FAST_PATH_BITS_IMAGE | FAST_PATH_NO_ALPHA_MAP)) ==
+ ((iter->image_flags & (FAST_PATH_BITS_IMAGE | FAST_PATH_NO_ALPHA_MAP)) ==
(FAST_PATH_BITS_IMAGE | FAST_PATH_NO_ALPHA_MAP)))
{
bits_image_t *bits = &image->bits;
- if (iter->flags & ITER_NARROW)
+ if (iter->iter_flags & ITER_NARROW)
{
uint32_t color = bits->fetch_pixel_32 (bits, 0, 0);
uint32_t *buffer = iter->buffer;
@@ -104,8 +104,8 @@ noop_src_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter)
iter->get_scanline = _pixman_iter_get_scanline_noop;
}
else if (image->common.extended_format_code == PIXMAN_a8r8g8b8 &&
- (iter->flags & ITER_NARROW) &&
- (image->common.flags & FLAGS) == FLAGS &&
+ (iter->iter_flags & ITER_NARROW) &&
+ (iter->image_flags & FLAGS) == FLAGS &&
iter->x >= 0 && iter->y >= 0 &&
iter->x + iter->width <= image->bits.width &&
iter->y + iter->height <= image->bits.height)
@@ -125,8 +125,8 @@ 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;
+ uint32_t image_flags = iter->image_flags;
+ uint32_t iter_flags = iter->iter_flags;
if ((image_flags & FAST_PATH_STD_DEST_FLAGS) == FAST_PATH_STD_DEST_FLAGS &&
(iter_flags & ITER_NARROW) == ITER_NARROW &&
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index f456bbd..f4ca632 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -218,7 +218,8 @@ struct pixman_iter_t
int x, y;
int width;
int height;
- iter_flags_t flags;
+ iter_flags_t iter_flags;
+ uint32_t image_flags;
/* These function pointers are initialized by the implementation */
pixman_iter_get_scanline_t get_scanline;
@@ -516,7 +517,8 @@ _pixman_implementation_src_iter_init (pixman_implementation_t *imp,
int width,
int height,
uint8_t *buffer,
- iter_flags_t flags);
+ iter_flags_t flags,
+ uint32_t image_flags);
void
_pixman_implementation_dest_iter_init (pixman_implementation_t *imp,
@@ -527,7 +529,8 @@ _pixman_implementation_dest_iter_init (pixman_implementation_t *imp,
int width,
int height,
uint8_t *buffer,
- iter_flags_t flags);
+ iter_flags_t flags,
+ uint32_t image_flags);
/* Specific implementations */
pixman_implementation_t *
diff --git a/pixman/pixman-radial-gradient.c b/pixman/pixman-radial-gradient.c
index b6dd6b2..715711f 100644
--- a/pixman/pixman-radial-gradient.c
+++ b/pixman/pixman-radial-gradient.c
@@ -413,7 +413,7 @@ radial_get_scanline_wide (pixman_iter_t *iter, const uint32_t *mask)
void
_pixman_radial_gradient_iter_init (pixman_image_t *image, pixman_iter_t *iter)
{
- if (iter->flags & ITER_NARROW)
+ if (iter->iter_flags & ITER_NARROW)
iter->get_scanline = radial_get_scanline_narrow;
else
iter->get_scanline = radial_get_scanline_wide;
diff --git a/pixman/pixman-solid-fill.c b/pixman/pixman-solid-fill.c
index 852e135..8b25d5d 100644
--- a/pixman/pixman-solid-fill.c
+++ b/pixman/pixman-solid-fill.c
@@ -29,7 +29,7 @@
void
_pixman_solid_fill_iter_init (pixman_image_t *image, pixman_iter_t *iter)
{
- if (iter->flags & ITER_NARROW)
+ if (iter->iter_flags & ITER_NARROW)
{
uint32_t *b = (uint32_t *)iter->buffer;
uint32_t *e = b + iter->width;
diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c
index e217ca3..111317d 100644
--- a/pixman/pixman-sse2.c
+++ b/pixman/pixman-sse2.c
@@ -5984,8 +5984,8 @@ sse2_src_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter)
#define FLAGS \
(FAST_PATH_STANDARD_FLAGS | FAST_PATH_ID_TRANSFORM | FAST_PATH_BITS_IMAGE)
- if ((iter->flags & ITER_NARROW) &&
- (image->common.flags & FLAGS) == FLAGS &&
+ if ((iter->iter_flags & ITER_NARROW) &&
+ (iter->image_flags & FLAGS) == FLAGS &&
x >= 0 && y >= 0 &&
x + width <= image->bits.width &&
y + height <= image->bits.height)
--
1.7.4
More information about the Pixman
mailing list