[cairo] [cairo-commit] src/cairo-rectangle.c

Behdad Esfahbod behdad at behdad.org
Tue Feb 5 17:15:36 PST 2008


On Tue, 2008-02-05 at 19:14 -0500, Vladimir Vukicevic wrote:
> src/cairo-rectangle.c |   10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> New commits:
> commit 1d93e148766ded8f3105277f944849f6297974fb
> Author: Vladimir Vukicevic <vladimir at pobox.com>
> Date:   Tue Feb 5 16:14:51 2008 -0800
> 
>     Followup patch to dashed stroke optimization
>     
>     Make sure that we don't test lines that start or end inside the box,
>     since our algorithm will find intersections on the wrong ends on the
>     line, and not count them.
> 
> diff --git a/src/cairo-rectangle.c b/src/cairo-rectangle.c
> index 58426f3..7ebdfb5 100644
> --- a/src/cairo-rectangle.c
> +++ b/src/cairo-rectangle.c
> @@ -111,8 +111,14 @@ _cairo_box_intersects_line (cairo_box_t *box, cairo_line_t *line)

Then this probably should be renamed to
_cairo_box_intersects_line_segment() or something, cause it's not about
a line anymore.

>      cairo_fixed_t t1, t2, t3, t4;
>      cairo_int64_t t1y, t2y, t3x, t4x;
>  
> -    cairo_fixed_t xlen = P2x - P1x;
> -    cairo_fixed_t ylen = P2y - P1y;
> +    cairo_fixed_t xlen, ylen;
> +
> +    if (_cairo_box_contains_point(box, &line->p1) ||
> +	_cairo_box_contains_point(box, &line->p2))
> +	return TRUE;
> +
> +    xlen = P2x - P1x;
> +    ylen = P2y - P1y;
>  
>      if (xlen) {
>  	if (xlen > 0) {
> _______________________________________________
> cairo-commit mailing list
> cairo-commit at lists.cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo-commit
-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759



More information about the cairo mailing list