[cairo] cairo_in_fill on boundaries broken?

Behdad Esfahbod behdad at behdad.org
Fri Apr 18 14:43:06 PDT 2008


On Fri, 2008-04-18 at 17:38 -0400, Benjamin Otte wrote:
> Hey,
> 
> while writing tests for Swfdec I found that the following code behaves
> unexpected:
> 
> #include <cairo.h>
> #include <stdio.h>
> 
> int
> main ()
> {
>   cairo_surface_t *surface = cairo_image_surface_create
> (CAIRO_FORMAT_ARGB32, 1, 1);
>   cairo_t *cr = cairo_create (surface);
> 
>   cairo_rectangle (cr, 0, 0, 10, 10);
>   printf ("%s\n", cairo_in_fill (cr, 0, 0) ? "yes" : "no");
>   printf ("%s\n", cairo_in_fill (cr, 10, 10) ? "yes" : "no");
> 
>   return 0;
> }
> 
> I would have expected it to print "yes" in the first case and "no" in
> the second case, but it turns out it's the opposite behavior. So I'm
> wondering: Is the behavior of cairo_in_fill on boundaries supposed to
> be this way, is this a bug or is the behavior undefined and might
> change in the future?

I'd say both should return the same value.  I can't make my mind between
"yes" or "no" though.

> Please be aware that in this case I'm wondering about there are no
> rounding problems, so that is not the problem.
> 
> Cheers,
> Benjamin
-- 
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