pixman: Branch 'master' - 2 commits
Søren Sandmann Pedersen
sandmann at kemper.freedesktop.org
Tue Jan 3 08:37:07 PST 2012
demos/gradient-test.c | 13 ++++++-------
pixman/pixman-gradient-walker.c | 7 +++++++
2 files changed, 13 insertions(+), 7 deletions(-)
New commits:
commit 89498a1178bc173857f3d1ee1f889afcc58b21b6
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date: Sun Dec 18 07:29:59 2011 -0500
gradient-walker: For NONE repeats, when x < 0 or x > 1, set both colors to 0
ec7c9c2b6865b48b8bd14e4 introduced a bug where NONE gradients would be
misrendered, causing the area outside the gradient to be treated as a
(very) long fade to transparent.The problem was that a check for
positions outside the gradients were dropped in favor of relying on
the sentinels.
Aside from misrendering, this also caused a signed integer overflow
when the code would compute a stepper size based on MIN_INT32.
This patches fixes the issue by reinstating a check for these cases
and setting both the right and left colors to transparent black.
diff --git a/pixman/pixman-gradient-walker.c b/pixman/pixman-gradient-walker.c
index 048039e..e7e724f 100644
--- a/pixman/pixman-gradient-walker.c
+++ b/pixman/pixman-gradient-walker.c
@@ -108,6 +108,13 @@ gradient_walker_reset (pixman_gradient_walker_t *walker,
left_x += (pos - x);
right_x += (pos - x);
}
+ else if (walker->repeat == PIXMAN_REPEAT_NONE)
+ {
+ if (n == 0)
+ right_c = left_c;
+ else if (n == count)
+ left_c = right_c;
+ }
walker->left_x = left_x;
walker->right_x = right_x;
commit d0091a33fcdb49b65a6f20f775cfde520380b1fa
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date: Wed Dec 21 05:19:00 2011 -0500
Modify gradient-test to show a bug in NONE processing
This patch modifies demos/gradient-test to display a bug in gradients
with a repeat mode of NONE. With the current gradient code, the left
side will be a solid red (actually an extremely long fade from solid
red to transparent) instead of a sharp transition from red to green.
diff --git a/demos/gradient-test.c b/demos/gradient-test.c
index 20f78a6..e68f69a 100644
--- a/demos/gradient-test.c
+++ b/demos/gradient-test.c
@@ -15,12 +15,11 @@ main (int argc, char **argv)
int i;
pixman_gradient_stop_t stops[2] =
{
- { pixman_int_to_fixed (0), { 0xffff, 0xeeee, 0xeeee, 0xeeee } },
- { pixman_int_to_fixed (1), { 0xffff, 0x1111, 0x1111, 0x1111 } }
+ { pixman_int_to_fixed (0), { 0x0000, 0x0000, 0xffff, 0xffff } },
+ { pixman_int_to_fixed (1), { 0xffff, 0x1111, 0x1111, 0xffff } }
};
- pixman_point_fixed_t p1 = { pixman_double_to_fixed (0), 0 };
- pixman_point_fixed_t p2 = { pixman_double_to_fixed (WIDTH / 8.),
- pixman_int_to_fixed (0) };
+ pixman_point_fixed_t p1 = { pixman_double_to_fixed (50), 0 };
+ pixman_point_fixed_t p2 = { pixman_double_to_fixed (200), 0 };
#if 0
pixman_transform_t trans = {
{ { pixman_double_to_fixed (2), pixman_double_to_fixed (0.5), pixman_double_to_fixed (-100), },
@@ -44,7 +43,7 @@ main (int argc, char **argv)
#endif
for (i = 0; i < WIDTH * HEIGHT; ++i)
- dest[i] = 0x4f00004f; /* pale blue */
+ dest[i] = 0xff00ff00;
dest_img = pixman_image_create_bits (PIXMAN_a8r8g8b8,
WIDTH, HEIGHT,
@@ -74,7 +73,7 @@ main (int argc, char **argv)
stops, 2);
pixman_image_set_transform (src_img, &trans);
- pixman_image_set_repeat (src_img, PIXMAN_REPEAT_PAD);
+ pixman_image_set_repeat (src_img, PIXMAN_REPEAT_NONE);
pixman_image_composite (PIXMAN_OP_OVER, src_img, NULL, dest_img,
0, 0, 0, 0, 0, 0, 10 * WIDTH, HEIGHT);
More information about the xorg-commit
mailing list