Stop using wxColourDisplay() inside wxWidgets code

This function always returns true in practice and it's completely
useless to call it during each wxDC object construction, especially
because wxDC::m_colour itself is not used anywhere.
This commit is contained in:
Vadim Zeitlin 2018-10-06 16:12:48 +02:00
parent 24b5e256df
commit 382404f0a7
4 changed files with 14 additions and 21 deletions

View File

@ -163,7 +163,7 @@ void MainWindow::ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y)
height = *max_y;
}
if (DrawIt && wxColourDisplay())
if (DrawIt)
{
dc->SetBrush(*wxLIGHT_GREY_BRUSH);
dc->SetPen(*wxGREY_PEN);
@ -347,20 +347,18 @@ void MainWindow::ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y)
if (DrawIt)
{
// Draw dark grey thick border
if (wxColourDisplay())
{
dc->SetBrush(*wxGREY_BRUSH);
dc->SetPen(*wxGREY_PEN);
dc->SetBrush(*wxGREY_BRUSH);
dc->SetPen(*wxGREY_PEN);
// Left side
dc->DrawRectangle(0, 0, THIN_LINE_BORDER, height);
// Top side
dc->DrawRectangle(THIN_LINE_BORDER, 0, width-THIN_LINE_BORDER, THIN_LINE_BORDER);
// Right side
dc->DrawRectangle(width-THIN_LINE_BORDER, THIN_LINE_BORDER, width, height-THIN_LINE_BORDER);
// Bottom side
dc->DrawRectangle(THIN_LINE_BORDER, height-THIN_LINE_BORDER, width-THIN_LINE_BORDER, height);
// Left side
dc->DrawRectangle(0, 0, THIN_LINE_BORDER, height);
// Top side
dc->DrawRectangle(THIN_LINE_BORDER, 0, width-THIN_LINE_BORDER, THIN_LINE_BORDER);
// Right side
dc->DrawRectangle(width-THIN_LINE_BORDER, THIN_LINE_BORDER, width, height-THIN_LINE_BORDER);
// Bottom side
dc->DrawRectangle(THIN_LINE_BORDER, height-THIN_LINE_BORDER, width-THIN_LINE_BORDER, height);
}
// Draw border
// Have grey background, plus 3-d border -
// One black rectangle.
@ -376,10 +374,7 @@ void MainWindow::ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y)
// Right and bottom white lines - 'grey' (black!) if
// we're running on a mono display.
if (wxColourDisplay())
dc->SetPen(*wxWHITE_PEN);
else
dc->SetPen(*wxBLACK_PEN);
dc->SetPen(*wxWHITE_PEN);
dc->DrawLine(width-THICK_LINE_BORDER, THICK_LINE_BORDER,
width-THICK_LINE_BORDER, height-THICK_LINE_BORDER);

View File

@ -318,7 +318,7 @@ wxIMPLEMENT_ABSTRACT_CLASS(wxDCImpl, wxObject);
wxDCImpl::wxDCImpl( wxDC *owner )
: m_window(NULL)
, m_colour(wxColourDisplay())
, m_colour(true)
, m_ok(true)
, m_clipping(false)
, m_isInteractive(0)

View File

@ -402,7 +402,6 @@ void wxSVGFileDCImpl::Init(const wxString &filename, int Width, int Height,
m_backgroundBrush = *wxTRANSPARENT_BRUSH;
m_textForegroundColour = *wxBLACK;
m_textBackgroundColour = *wxWHITE;
m_colour = wxColourDisplay();
m_pen = *wxBLACK_PEN;
m_font = *wxNORMAL_FONT;

View File

@ -139,7 +139,6 @@ void wxWindowDCImpl::Init()
m_currentPenDash = NULL;
m_currentStyle = -1;
m_currentFill = -1;
m_colour = wxColourDisplay();
m_display = NULL;
m_pixmap = (WXPixmap) 0;
m_autoSetting = 0;