[cairo] cairo_path_extents() giving (0,0,0,0) when it shouldn't

Peter Frentrup peter_frentrup at gmx.de
Sat Dec 11 16:58:08 PST 2010


Hi,
i noticed, that cairo_path_extents() gives me (0,0,0,0) on a 
pixel-aligned line. I believe this is a bug.

My testcase is:
   printf("cairo version: %s\n", cairo_version_string());

   surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,30,30);
   cr = cairo_create(surface);

   cairo_set_line_width(cr, 1);
   cairo_set_line_cap(cr, CAIRO_LINE_CAP_SQUARE);

   cairo_move_to(cr, 2.5, 10.5);
   cairo_line_to(cr, 2.5, 20.5);

   cairo_path_extents(cr, &x1, &y1, &x2, &y2);
   printf("path:   %f, %f, %f, %f\n", x1, y1, x2, y2);

   cairo_stroke_extents(cr, &x1, &y1, &x2, &y2);
   printf("stroke: %f, %f, %f, %f\n", x1, y1, x2, y2);

   cairo_fill_extents(cr, &x1, &y1, &x2, &y2);
   printf("fill:   %f, %f, %f, %f\n", x1, y1, x2, y2);

This gives:
   cairo version: 1.10.0
   path:   0.000000, 0.000000, 0.000000, 0.000000
   stroke: 2.000000, 10.000000, 3.000000, 21.000000
   fill:   0.000000, 0.000000, 0.000000, 0.000000

It once was (what I expected):
   cairo version: 1.8.8
   path:   2.500000, 10.500000, 2.500000, 20.500000
   stroke: 2.000000, 10.000000, 3.000000, 21.000000
   fill:   0.000000, 0.000000, 0.000000, 0.000000



Peter


More information about the cairo mailing list