diff options
author | Søren Sandmann Pedersen <ssp@redhat.com> | 2011-12-18 07:29:59 -0500 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@redhat.com> | 2012-01-18 15:36:13 -0500 |
commit | dbb6148158bd1e915c4ac15c06e05a4eb9d29ade (patch) | |
tree | 090c683e0d1d796545551175c261602ce9b366dc | |
parent | b14fd2ad606baa4074b8cba8c58f6847d5840205 (diff) | |
download | pixman-dbb6148158bd1e915c4ac15c06e05a4eb9d29ade.tar.gz |
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.
-rw-r--r-- | pixman/pixman-gradient-walker.c | 7 |
1 files changed, 7 insertions, 0 deletions
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; |