[prev in list] [next in list] [prev in thread] [next in thread]
List: cairo
Subject: Re: [cairo] cairo_in_fill() problems
From: Bertram Felgenhauer <bertram.felgenhauer () googlemail ! com>
Date: 2009-03-26 4:23:38
Message-ID: 49cb034f.0aaa660a.3ef9.ffff80e5 () mx ! google ! com
[Download RAW message or body]
Soeren Sandmann wrote:
> The attached program produces this image:
>
> http://imgur.com/ABJ5K.png
>
> The light area is a circular path. The blue areas are where
> cairo_in_fill() returned FALSE, the red where it returned
> TRUE. The bug was introduced by this commit:
>
> commit f5965cb7d6559e051c2581fe446d0b9f40427eb2
> Author: Chris Wilson <chris@chris-wilson.co.uk>
> Date: Wed Nov 5 23:48:52 2008 +0000
>
> [in-fill] Avoid tessellation by counting number of edge crossing to -∞
cairo_in_fill doesn't track the current point correctly when it's
discarding a Bezier segment. It's easy to fix:
diff --git a/src/cairo-path-in-fill.c b/src/cairo-path-in-fill.c
index 21cd0bd..d43b1ca 100644
--- a/src/cairo-path-in-fill.c
+++ b/src/cairo-path-in-fill.c
@@ -184,15 +184,19 @@ _cairo_in_fill_curve_to (void *closure,
if (c->y > bot) bot = c->y;
if (d->y < top) top = d->y;
if (d->y > bot) bot = d->y;
- if (bot < in_fill->y || top > in_fill->y)
+ if (bot < in_fill->y || top > in_fill->y) {
+ in_fill->current_point = *d;
return CAIRO_STATUS_SUCCESS;
+ }
left = in_fill->current_point.x;
if (b->x < left) left = b->x;
if (c->x < left) left = c->x;
if (d->x < left) left = d->x;
- if (left > in_fill->x)
+ if (left > in_fill->x) {
+ in_fill->current_point = *d;
return CAIRO_STATUS_SUCCESS;
+ }
/* XXX Investigate direct inspection of the inflections? */
if (! _cairo_spline_init (&spline,
I've gone ahead and pushed it.
regards,
Bertram
_______________________________________________
cairo mailing list
cairo@cairographics.org
http://lists.cairographics.org/mailman/listinfo/cairo
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic