From c4bf905cd5b39c50793d95607e38974380c39bff Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sun, 18 Oct 2015 10:53:49 -0700 Subject: [PATCH] Remove special-case rectangle drawing for width 2 pen Avoid missing corner pixel with width 2 pen when using rounded join on X11 by simply not using rounded join with small pens --- src/gtk/dcclient.cpp | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index 1d8d3c9109..1a3d60cc8e 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -842,32 +842,7 @@ void wxWindowDCImpl::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoo if ( m_pen.IsNonTransparent() ) { - if ((m_pen.GetWidth() == 2) && (m_pen.GetCap() == wxCAP_ROUND) && - (m_pen.GetJoin() == wxJOIN_ROUND) && (m_pen.GetStyle() == wxPENSTYLE_SOLID)) - { - // Use 2 1-line rects instead - gdk_gc_set_line_attributes( m_penGC, 1, GDK_LINE_SOLID, GDK_CAP_ROUND, GDK_JOIN_ROUND ); - - if (m_signX == -1) - { - // Different for RTL - gdk_draw_rectangle( m_gdkwindow, m_penGC, FALSE, xx+1, yy, ww-2, hh-2 ); - gdk_draw_rectangle( m_gdkwindow, m_penGC, FALSE, xx, yy-1, ww, hh ); - } - else - { - gdk_draw_rectangle( m_gdkwindow, m_penGC, FALSE, xx, yy, ww-2, hh-2 ); - gdk_draw_rectangle( m_gdkwindow, m_penGC, FALSE, xx-1, yy-1, ww, hh ); - } - - // reset - gdk_gc_set_line_attributes( m_penGC, 2, GDK_LINE_SOLID, GDK_CAP_ROUND, GDK_JOIN_ROUND ); - } - else - { - // Just use X11 for other cases - gdk_draw_rectangle( m_gdkwindow, m_penGC, FALSE, xx, yy, ww-1, hh-1 ); - } + gdk_draw_rectangle(m_gdkwindow, m_penGC, false, xx, yy, ww - 1, hh - 1); } } @@ -1687,7 +1662,13 @@ void wxWindowDCImpl::SetPen( const wxPen &pen ) case wxJOIN_BEVEL: { joinStyle = GDK_JOIN_BEVEL; break; } case wxJOIN_MITER: { joinStyle = GDK_JOIN_MITER; break; } case wxJOIN_ROUND: - default: { joinStyle = GDK_JOIN_ROUND; break; } + default: + break; + } + if (width < 3) + { + // width 2 rounded join looks bad on X11 (missing one corner pixel) + joinStyle = GDK_JOIN_MITER; } gdk_gc_set_line_attributes( m_penGC, width, lineStyle, capStyle, joinStyle );