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.
This commit is contained in:
James Crook 2018-08-03 18:29:49 +01:00
parent 3ccdde8fdb
commit 4318cb6780
8 changed files with 11 additions and 11 deletions

View File

@ -647,7 +647,7 @@ void FreqWindow::DrawBackground(wxMemoryDC & dc)
mPlotRect = mFreqPlot->GetClientRect();
mBitmap = std::make_unique<wxBitmap>(mPlotRect.width, mPlotRect.height);
mBitmap = std::make_unique<wxBitmap>(mPlotRect.width, mPlotRect.height,24);
dc.SelectObject(*mBitmap);

View File

@ -1434,7 +1434,7 @@ void MixerBoard::LoadMusicalInstruments()
wxMemoryDC dc;
for (const auto &data : table) {
auto bmp = std::make_unique<wxBitmap>(data.bitmap);
auto bmp = std::make_unique<wxBitmap>(data.bitmap,24);
dc.SelectObject(*bmp);
AColor::Bevel(dc, false, bev);
mMusicalInstruments.push_back(std::make_unique<MusicalInstrument>(

View File

@ -657,7 +657,7 @@ void EffectAutoDuckPanel::OnPaint(wxPaintEvent & WXUNUSED(evt))
if (!mBackgroundBitmap || mBackgroundBitmap->GetWidth() != clientWidth ||
mBackgroundBitmap->GetHeight() != clientHeight)
{
mBackgroundBitmap = std::make_unique<wxBitmap>(clientWidth, clientHeight);
mBackgroundBitmap = std::make_unique<wxBitmap>(clientWidth, clientHeight,24);
}
wxMemoryDC dc;

View File

@ -2903,7 +2903,7 @@ void EqualizationPanel::OnPaint(wxPaintEvent & WXUNUSED(event))
{
mWidth = width;
mHeight = height;
mBitmap = std::make_unique<wxBitmap>(mWidth, mHeight);
mBitmap = std::make_unique<wxBitmap>(mWidth, mHeight,24);
}
wxBrush bkgndBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));

View File

@ -1069,7 +1069,7 @@ void EffectScienFilterPanel::OnPaint(wxPaintEvent & WXUNUSED(evt))
{
mWidth = width;
mHeight = height;
mBitmap = std::make_unique<wxBitmap>(mWidth, mHeight);
mBitmap = std::make_unique<wxBitmap>(mWidth, mHeight,24);
}
wxBrush bkgndBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));

View File

@ -1068,7 +1068,7 @@ void ExportMixerPanel::OnPaint(wxPaintEvent & WXUNUSED(event))
{
mWidth = width;
mHeight = height;
mBitmap = std::make_unique<wxBitmap>( mWidth, mHeight );
mBitmap = std::make_unique<wxBitmap>( 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<wxBoxSizer>(wxHORIZONTAL);

View File

@ -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<wxBitmap>(1, 1) }
, mBacking{ std::make_unique<wxBitmap>(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<wxBitmap>();
mBacking->Create(sz.x, sz.y); //, *dc);
mBacking->Create(sz.x, sz.y,24); //, *dc);
mBackingDC.SelectObject(*mBacking);
}

View File

@ -1353,7 +1353,7 @@ bool NumericTextCtrl::Layout()
wxMemoryDC memDC;
// Placeholder bitmap so the memDC has something to reference
mBackgroundBitmap = std::make_unique<wxBitmap>(1, 1);
mBackgroundBitmap = std::make_unique<wxBitmap>(1, 1, 24);
memDC.SelectObject(*mBackgroundBitmap);
mDigits.clear();
@ -1420,7 +1420,7 @@ bool NumericTextCtrl::Layout()
wxBrush Brush;
mBackgroundBitmap = std::make_unique<wxBitmap>(mWidth + mButtonWidth, mHeight);
mBackgroundBitmap = std::make_unique<wxBitmap>(mWidth + mButtonWidth, mHeight,24);
memDC.SelectObject(*mBackgroundBitmap);
theTheme.SetBrushColour( Brush, clrTimeHours );