Hi Alan,

The line width has been already set to the most recent value before line 1427, so it appears that there is no need to set it again.

In the function filled_polygon:
1413:    poly_line( pls, xa, ya, npts );

In function poly_line:
1389:    set_current_context( pls );

In function set_current_context:
1370:    cairo_set_line_width( aStream->cairoContext, (double) pls->width );

Hǎiliàng

Hǎiliàng


On Tue, Apr 30, 2013 at 10:48 AM, Alan W. Irwin <irwin@beluga.phys.uvic.ca> wrote:
On 2013-04-29 22:30+0800 Hailiang Wang wrote:

Hi,

I have found an issue about filling polygon in cairo driver.
Line 1427 of cairo.c:
       cairo_set_line_width( aStream->cairoContext, 1.0 );
It is a hard coded line width value. When the polygon size
is large enough, the problem is not obvious, but when the polygon size is
small (comparable to 1), the edge of the polygon will be too thick and the
polygon will not look like the shape you want. e.g. a rectangle looks like
a round dot.

I believe that this line of code should be deleted. After the deletion
the result is correct again. I've tested it against revision 12304.

Hi Hǎiliàng:

I agree the above hard-coded width is inappropriate.  But instead of
not setting the width at all (which might not give a good result if
the user had previously set a very large or very small line width),
what happens with your tests if you set the width explicitly to the
most recent value specified by the user, i.e., use

cairo_set_line_width( aStream->cairoContext, (double) pls->width );

rather than deleting line 1427?

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________