From 1f8b73b0d8974e0e845e6f17718ed4611caf3112 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 1 Oct 2019 01:28:42 +0200 Subject: [PATCH] Clear background with white brush by default in wxGCDC This makes wxGCDC consistent with wxDC. This commit is best viewed ignoring whitespace. --- src/common/dcgraph.cpp | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/src/common/dcgraph.cpp b/src/common/dcgraph.cpp index dc6d018fb2..456dc3c1a9 100644 --- a/src/common/dcgraph.cpp +++ b/src/common/dcgraph.cpp @@ -1287,28 +1287,20 @@ void wxGCDCImpl::Clear(void) if ( m_backgroundBrush.IsTransparent() ) return; - if ( m_backgroundBrush.IsOk() ) - { - m_graphicContext->SetBrush( m_backgroundBrush ); - wxPen p = *wxTRANSPARENT_PEN; - m_graphicContext->SetPen( p ); - wxCompositionMode formerMode = m_graphicContext->GetCompositionMode(); - m_graphicContext->SetCompositionMode(wxCOMPOSITION_SOURCE); + m_graphicContext->SetBrush( m_backgroundBrush.IsOk() ? m_backgroundBrush + : *wxWHITE_BRUSH ); + wxPen p = *wxTRANSPARENT_PEN; + m_graphicContext->SetPen( p ); + wxCompositionMode formerMode = m_graphicContext->GetCompositionMode(); + m_graphicContext->SetCompositionMode(wxCOMPOSITION_SOURCE); - double x, y, w, h; - m_graphicContext->GetClipBox(&x, &y, &w, &h); - m_graphicContext->DrawRectangle(x, y, w, h); + double x, y, w, h; + m_graphicContext->GetClipBox(&x, &y, &w, &h); + m_graphicContext->DrawRectangle(x, y, w, h); - m_graphicContext->SetCompositionMode(formerMode); - m_graphicContext->SetPen( m_pen ); - m_graphicContext->SetBrush( m_brush ); - } - else - { - double x, y, w, h; - m_graphicContext->GetClipBox(&x, &y, &w, &h); - m_graphicContext->ClearRectangle(x, y, w, h); - } + m_graphicContext->SetCompositionMode(formerMode); + m_graphicContext->SetPen( m_pen ); + m_graphicContext->SetBrush( m_brush ); } void wxGCDCImpl::DoGetSize(int *width, int *height) const