Fix getting extents of wxGraphicsPath (Cairo)

Graphics path is actually a line with null width so its bounding box
should be obtained with cairo_path_extents() function which assumes
that line width is 0.
This commit is contained in:
Artur Wieczorek 2018-07-28 11:41:06 +02:00
parent e732da462f
commit e25ab3e421
2 changed files with 13 additions and 1 deletions

View File

@ -100,6 +100,8 @@
(cairo_t *cr, double alpha), (cr, alpha) ) \
m( cairo_path_destroy, \
(cairo_path_t *path), (path) ) \
m( cairo_path_extents, \
(cairo_t *cr, double *x1, double *y1, double *x2, double *y2), (cr, x1, y1, x2, y2) ) \
m( cairo_pattern_add_color_stop_rgba, \
(cairo_pattern_t *pattern, double offset, double red, double green, double blue, double alpha), (pattern, offset, red, green, blue, alpha) ) \
m( cairo_pattern_destroy, \

View File

@ -1195,7 +1195,17 @@ void wxCairoPathData::GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h)
{
double x1,y1,x2,y2;
cairo_stroke_extents( m_pathContext, &x1, &y1, &x2, &y2 );
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 6, 0)
if ( cairo_version() >= CAIRO_VERSION_ENCODE(1, 6, 0) )
{
cairo_path_extents(m_pathContext, &x1, &y1, &x2, &y2);
}
else
#endif
{
cairo_stroke_extents(m_pathContext, &x1, &y1, &x2, &y2);
}
if ( x2 < x1 )
{
*x = x2;