[Pixman] [PATCH 2/2] radial: When comparing the compute t to mindr, use >= rather than >
Søren Sandmann
sandmann at cs.au.dk
Fri Dec 7 17:02:43 PST 2012
From: Søren Sandmann Pedersen <ssp at redhat.com>
It is legitimate for t * dr value to be exactly equal to the minimum
dr. This happens when the sampled point is precisely on the edge of
the c1 circle, or exactly on the center of c1 when its radius is 0.
This fixes the dots in demos/radial-test.c except for two: When the c2
circle has radius 0 and a repeat mode of NONE, the dot remains. When
the repeat mode is NORMAL, the dot is now red where it used to be
white. Before these cases correspond to a t value of 1.0, which we
generally treat as a value that is outside the gradient's defined
interval [0.0,1) and is therefore subject to the repeat
algorithm. Given this, in the repeat==NONE case, a value of 1.0 is
expected to generate a value of { 0, 0, 0, 0 }. In the repeat==NORMAL,
it wraps around and becomes the value at 0.0, which is red in
radial-test.
Cc: ranma42 at gmail.com
---
pixman/pixman-radial-gradient.c | 6 +++---
1 file 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);
}
}
--
1.7.11.7
More information about the Pixman
mailing list