summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2012-12-07 19:51:19 -0500
committerSøren Sandmann Pedersen <ssp@redhat.com>2012-12-11 09:05:38 -0500
commitb0a6504122ba4f585fb60626ec71bf613fc64fae (patch)
tree1ef1162f34c0ebec988ee8ab4166017ab2f7b785
parent54aca22058e8f4daf999b37e5c5e6ddd8e67f811 (diff)
radial: When comparing t to mindr, use >= rather than >
Radial gradients are conceptually rendered as a sequence of circles generated by linearly extrapolating from the two circles given by the gradient specification. Any circles in that sequence that would end up with a negative radius are not drawn, a condition that is enforced by checking that t * dr is bigger than mindr: if (t * dr > mindr) However, it is legitimate for a circle to have radius exactly 0, so the test should use >= rather than >. This gets rid of the dots in demos/radial-test except for when the c2 circle has radius 0 and a repeat mode of either NONE or NORMAL. Both those dots correspond to a t value of 1.0, which is outside the defined interval of [0.0, 1.0) and therefore subject to the repeat algorithm. As a result, in the NONE case, a value of 1.0 turns into transparent black. In the NORMAL case, 1.0 wraps around and becomes 0.0 which is red, unlike 0.99 which is blue. Cc: ranma42@gmail.com
-rw-r--r--pixman/pixman-radial-gradient.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/pixman/pixman-radial-gradient.c b/pixman/pixman-radial-gradient.c
index 8d56246..6a21796 100644
--- a/pixman/pixman-radial-gradient.c
+++ b/pixman/pixman-radial-gradient.c
@@ -109,7 +109,7 @@ radial_compute_color (double a,
}
else
{
- if (t * dr > mindr)
+ if (t * dr >= mindr)
return _pixman_gradient_walker_pixel (walker, t);
}
@@ -145,9 +145,9 @@ radial_compute_color (double a,
}
else
{
- if (t0 * dr > mindr)
+ if (t0 * dr >= mindr)
return _pixman_gradient_walker_pixel (walker, t0);
- else if (t1 * dr > mindr)
+ else if (t1 * dr >= mindr)
return _pixman_gradient_walker_pixel (walker, t1);
}
}