From 16ab50d25bb5911a6a2ac21dab0e049d5e6c8d10 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 25 Oct 2013 17:38:43 +0000 Subject: [PATCH] Don't draw the segment lines in wxGtkPrinterDC::DrawArc() unless it's filled. The segments should only be drawn if we're filling the arc, i.e. drawing a pie, but not if we're just drawing its outline. Add a test of this to the printing sample. Closes #15609. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75065 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/printing/printing.cpp | 8 ++++++-- src/gtk/print.cpp | 11 +++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/samples/printing/printing.cpp b/samples/printing/printing.cpp index 89ef0ccd87..9a40b10078 100644 --- a/samples/printing/printing.cpp +++ b/samples/printing/printing.cpp @@ -182,6 +182,12 @@ void MyApp::Draw(wxDC&dc) dc.DrawPolygon( 5, points, 20, 250, wxODDEVEN_RULE ); dc.DrawPolygon( 5, points, 50, 250, wxWINDING_RULE ); + dc.DrawArc( 20, 330, 40, 300, 20, 300 ); + { + wxDCBrushChanger changeBrush(dc, *wxTRANSPARENT_BRUSH); + dc.DrawArc( 60, 330, 80, 300, 60, 300 ); + } + dc.DrawEllipticArc( 80, 250, 60, 30, 0.0, 270.0 ); points[0].x = 150; @@ -194,8 +200,6 @@ void MyApp::Draw(wxDC&dc) points[3].y = 220; dc.DrawSpline( 4, points ); - dc.DrawArc( 20,10, 10,10, 25,40 ); - wxString str; int i = 0; str.Printf( wxT("---- Text at angle %d ----"), i ); diff --git a/src/gtk/print.cpp b/src/gtk/print.cpp index 997c95a540..a7f75959e2 100644 --- a/src/gtk/print.cpp +++ b/src/gtk/print.cpp @@ -1386,11 +1386,14 @@ void wxGtkPrinterDCImpl::DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,w cairo_arc_negative(m_cairo, XLOG2DEV(xc), YLOG2DEV(yc), XLOG2DEVREL(wxRound(radius)), alpha1, alpha2); - cairo_line_to(m_cairo, XLOG2DEV(xc), YLOG2DEV(yc)); - cairo_close_path (m_cairo); + if ( m_brush.IsNonTransparent() ) + { + cairo_line_to(m_cairo, XLOG2DEV(xc), YLOG2DEV(yc)); + cairo_close_path (m_cairo); - SetBrush( m_brush ); - cairo_fill_preserve( m_cairo ); + SetBrush( m_brush ); + cairo_fill_preserve( m_cairo ); + } SetPen (m_pen); cairo_stroke( m_cairo );