Bug 29422

Summary: cairo_path_extents doesn't consider single moveto followed by closepath
Product: cairo Reporter: cujyaz
Component: generalAssignee: Carl Worth <cworth>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: 1.9.15   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description cujyaz 2010-08-06 09:32:55 UTC
In cairo-path-bounds.c, _cairo_path_bounder_close_path() is an empty
function, while it should consider the case when the prevoious command
is a moveto, and then include the point in the calculated extent:

static cairo_status_t
_cairo_path_bounder_close_path (void *closure)
{
    cairo_path_bounder_t *bounder = closure;

    if (bounder->has_initial_point) {
	_cairo_path_bounder_add_point (bounder, &bounder->current_point);
	bounder->has_initial_point = FALSE;
    }

    return CAIRO_STATUS_SUCCESS;
}

This comes from a Mozilla bug:

https://bugzilla.mozilla.org/show_bug.cgi?id=584623

I have tested the fix in Mozilla, which uses an old version of Cairo.
By looking at the current code, the bug is still present, although the code
has changed substantially. There may be other places in the code where
a similar bug exists (don't know).
Comment 1 Andrea Canciani 2011-01-05 02:34:31 UTC
I believe that this bug was fixed in

commit 89e1261dd0fdb6c6c0271f71dd84d72504969ab1
Author: Andrea Canciani <ranma42@gmail.com>
Date:   Fri Oct 22 12:35:40 2010 +0200

    path-bounder: Simplify code
    
    If the path extents are tight, all the extents computations and
    approximations become trivial except for the stroke extents.

Please reopen if it is still present in cairo master.

NB: _cairo_path_bounder_close_path() is now an empty function, but _cairo_path_bounder_move_to() sets the extents.

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.