From 4318cb67808461acccd01b6956c57eff08506da7 Mon Sep 17 00:00:00 2001 From: James Crook Date: Fri, 3 Aug 2018 18:29:49 +0100 Subject: [PATCH] Bug 1886 - Sluggish behaviour caused by the large time taken to draw the Track Control Panel All backing bitmaps (not just the one in track panel) now are set to 24 bits. Big thanks to David Bailes for tracking down the root cause of slow BitBlts, and the comments at https://trac.wxwidgets.org/ticket/14403 which led to the fix. In testing the bitmaps, I also fixed the sizer errors reported for Export.cpp that wxWidgets now reports as ASSERTS when running in debug builds. --- src/FreqWindow.cpp | 2 +- src/MixerBoard.cpp | 2 +- src/effects/AutoDuck.cpp | 2 +- src/effects/Equalization.cpp | 2 +- src/effects/ScienFilter.cpp | 2 +- src/export/Export.cpp | 4 ++-- src/widgets/BackedPanel.cpp | 4 ++-- src/widgets/NumericTextCtrl.cpp | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/FreqWindow.cpp b/src/FreqWindow.cpp index 504f41c94..a993f273e 100644 --- a/src/FreqWindow.cpp +++ b/src/FreqWindow.cpp @@ -647,7 +647,7 @@ void FreqWindow::DrawBackground(wxMemoryDC & dc) mPlotRect = mFreqPlot->GetClientRect(); - mBitmap = std::make_unique(mPlotRect.width, mPlotRect.height); + mBitmap = std::make_unique(mPlotRect.width, mPlotRect.height,24); dc.SelectObject(*mBitmap); diff --git a/src/MixerBoard.cpp b/src/MixerBoard.cpp index 8b4552236..aeffc6442 100644 --- a/src/MixerBoard.cpp +++ b/src/MixerBoard.cpp @@ -1434,7 +1434,7 @@ void MixerBoard::LoadMusicalInstruments() wxMemoryDC dc; for (const auto &data : table) { - auto bmp = std::make_unique(data.bitmap); + auto bmp = std::make_unique(data.bitmap,24); dc.SelectObject(*bmp); AColor::Bevel(dc, false, bev); mMusicalInstruments.push_back(std::make_unique( diff --git a/src/effects/AutoDuck.cpp b/src/effects/AutoDuck.cpp index 3be7552a9..cf2b42ae6 100644 --- a/src/effects/AutoDuck.cpp +++ b/src/effects/AutoDuck.cpp @@ -657,7 +657,7 @@ void EffectAutoDuckPanel::OnPaint(wxPaintEvent & WXUNUSED(evt)) if (!mBackgroundBitmap || mBackgroundBitmap->GetWidth() != clientWidth || mBackgroundBitmap->GetHeight() != clientHeight) { - mBackgroundBitmap = std::make_unique(clientWidth, clientHeight); + mBackgroundBitmap = std::make_unique(clientWidth, clientHeight,24); } wxMemoryDC dc; diff --git a/src/effects/Equalization.cpp b/src/effects/Equalization.cpp index 12565844c..d9159f957 100644 --- a/src/effects/Equalization.cpp +++ b/src/effects/Equalization.cpp @@ -2903,7 +2903,7 @@ void EqualizationPanel::OnPaint(wxPaintEvent & WXUNUSED(event)) { mWidth = width; mHeight = height; - mBitmap = std::make_unique(mWidth, mHeight); + mBitmap = std::make_unique(mWidth, mHeight,24); } wxBrush bkgndBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); diff --git a/src/effects/ScienFilter.cpp b/src/effects/ScienFilter.cpp index 109fff037..e274d40d1 100644 --- a/src/effects/ScienFilter.cpp +++ b/src/effects/ScienFilter.cpp @@ -1069,7 +1069,7 @@ void EffectScienFilterPanel::OnPaint(wxPaintEvent & WXUNUSED(evt)) { mWidth = width; mHeight = height; - mBitmap = std::make_unique(mWidth, mHeight); + mBitmap = std::make_unique(mWidth, mHeight,24); } wxBrush bkgndBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); diff --git a/src/export/Export.cpp b/src/export/Export.cpp index 338e1d479..6fedd03df 100644 --- a/src/export/Export.cpp +++ b/src/export/Export.cpp @@ -1068,7 +1068,7 @@ void ExportMixerPanel::OnPaint(wxPaintEvent & WXUNUSED(event)) { mWidth = width; mHeight = height; - mBitmap = std::make_unique( mWidth, mHeight ); + mBitmap = std::make_unique( mWidth, mHeight,24 ); } wxColour bkgnd = GetBackgroundColour(); @@ -1311,7 +1311,7 @@ ExportMixerDialog::ExportMixerDialog( const TrackList *tracks, bool selectedOnly mMixerSpec.get(), mTrackNames, wxDefaultPosition, wxSize(400, -1)); mixerPanel->SetName(_("Mixer Panel")); - vertSizer->Add(mixerPanel, 1, wxEXPAND | wxALIGN_CENTRE | wxALL, 5); + vertSizer->Add(mixerPanel, 1, wxEXPAND | wxALL, 5); { auto horSizer = std::make_unique(wxHORIZONTAL); diff --git a/src/widgets/BackedPanel.cpp b/src/widgets/BackedPanel.cpp index 0f8357ee9..8241a342f 100644 --- a/src/widgets/BackedPanel.cpp +++ b/src/widgets/BackedPanel.cpp @@ -14,7 +14,7 @@ BackedPanel::BackedPanel(wxWindow * parent, wxWindowID id, const wxSize & size, long style) : wxPanelWrapper(parent, id, pos, size, style) -, mBacking{ std::make_unique(1, 1) } +, mBacking{ std::make_unique(1, 1, 24) } { // Preinit the backing DC and bitmap so routines that require it will // not cause a crash if they run before the panel is fully initialized. @@ -53,7 +53,7 @@ void BackedPanel::ResizeBacking() wxSize sz = GetClientSize(); mBacking = std::make_unique(); - mBacking->Create(sz.x, sz.y); //, *dc); + mBacking->Create(sz.x, sz.y,24); //, *dc); mBackingDC.SelectObject(*mBacking); } diff --git a/src/widgets/NumericTextCtrl.cpp b/src/widgets/NumericTextCtrl.cpp index a5e8a095a..64116df77 100644 --- a/src/widgets/NumericTextCtrl.cpp +++ b/src/widgets/NumericTextCtrl.cpp @@ -1353,7 +1353,7 @@ bool NumericTextCtrl::Layout() wxMemoryDC memDC; // Placeholder bitmap so the memDC has something to reference - mBackgroundBitmap = std::make_unique(1, 1); + mBackgroundBitmap = std::make_unique(1, 1, 24); memDC.SelectObject(*mBackgroundBitmap); mDigits.clear(); @@ -1420,7 +1420,7 @@ bool NumericTextCtrl::Layout() wxBrush Brush; - mBackgroundBitmap = std::make_unique(mWidth + mButtonWidth, mHeight); + mBackgroundBitmap = std::make_unique(mWidth + mButtonWidth, mHeight,24); memDC.SelectObject(*mBackgroundBitmap); theTheme.SetBrushColour( Brush, clrTimeHours );