The fill_extents and stroke_extents routines will return values like 32767.0, 32767.0, -32768.0, -32768.0 in cases where either the width or height of a path approaches zero. This is not a valid result because in these cases, there are extents in one direction but not the other. The example below illustrates the problem. It is written in python for brevity, but the problem is reproduceable in c. from cairo import * s = ImageSurface(FORMAT_RGB24, 100, 100) c = Context(s) c.set_line_width(0) c.new_path() c.move_to(0,0) c.line_to(100, 0) print c.stroke_extents() (32767.0, 32767.0, -32768.0, -32768.0) print c.fill_extents() (32767.0, 32767.0, -32768.0, -32768.0) This example draws a horizontal line 100 units long. The results indicate: delta_x = -32768.0 - 32767.0 = -65535.0 delta_y = -32768.0 - 32767.0 = -65535.0 I would expect: delta_x = 100.0 delta_y = 0.0 In my use-case I have no control over when a path width or height might approach zero, so the only thing I can do when I see the result above is iterate over the path myself to determine the real DX/DY values.
With a line width of 0, to get the values you would expect you need to use cairo_path_extents() instead of the cairo_(fill|stroke)_extents() which evaluate the bounds of the trapezoids that would be generated by cairo_(fill|stroke) respectively. cairo_path_extents() instead evaluates the bounds of the transformed path irrespective of the pen used. The reporting of the invalid extents was itself fixed in commit 481fd3b4c8d3972ce21399f81b2021a57ed58f00.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.