Skip to content

Commit

Permalink
Fixes drawing
Browse files Browse the repository at this point in the history
  • Loading branch information
crsib committed Apr 21, 2022
1 parent 3bff6d5 commit d2eebd6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
14 changes: 9 additions & 5 deletions src/FreqWindow.cpp
Expand Up @@ -194,7 +194,6 @@ FrequencyPlotDialog::FrequencyPlotDialog(wxWindow * parent, wxWindowID id,
: wxDialogWrapper(parent, id, title, pos, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX),
mProject{ &project }
, mPainter(CreatePainter(this))
, mAnalyst(std::make_unique<SpectrumAnalyst>())
{
SetName();
Expand Down Expand Up @@ -316,6 +315,8 @@ void FrequencyPlotDialog::Populate()
S.EndVerticalLay();

mFreqPlot = safenew FreqPlot(S.GetParent(), wxID_ANY);
mPainter = CreatePainter(mFreqPlot);

S.Prop(1)
.Position(wxEXPAND)
.MinSize( { wxDefaultCoord, FREQ_WINDOW_HEIGHT } )
Expand Down Expand Up @@ -694,9 +695,9 @@ void FrequencyPlotDialog::DrawPlot()
(mPlotRect.GetHeight() - sz.height) / 2, msg);
}

mFreqPlot->Refresh();
mFreqPlot->Refresh(false);

Refresh();
Refresh(false);

return;
}
Expand Down Expand Up @@ -816,7 +817,7 @@ void FrequencyPlotDialog::DrawPlot()
vRuler->ruler.DrawGrid(*mPainter, r.width, true, true, 1, 1);
}

mFreqPlot->Refresh();
mFreqPlot->Refresh(false);
}


Expand Down Expand Up @@ -885,11 +886,14 @@ void FrequencyPlotDialog::OnAxisChoice(wxCommandEvent & WXUNUSED(event))
void FrequencyPlotDialog::PlotPaint(wxPaintEvent & event)
{
auto paintEvent = mPainter->Paint();

if (!mBitmap)
DrawPlot();

mPainter->Clear(ColorFromWXColor(GetBackgroundColour()));

mPainter->DrawImage( *mBitmap, 0, 0 );
return;
// Fix for Bug 1226 "Plot Spectrum freezes... if insufficient samples selected"
if (!mData || mDataLen < mWindowSize)
return;
Expand Down
6 changes: 2 additions & 4 deletions src/effects/Equalization.cpp
Expand Up @@ -3022,8 +3022,7 @@ void EqualizationPanel::OnPaint(wxPaintEvent & WXUNUSED(event))
mRecalcRequired = false;
}

int width, height;
GetSize(&width, &height);
GetSize(&mWidth, &mHeight);

auto paintEvent = mPainter->Paint();

Expand Down Expand Up @@ -3174,6 +3173,7 @@ void EqualizationPanel::OnPaint(wxPaintEvent & WXUNUSED(event))
}

stateMutator.SetPen(Colors::Black);

if( mEffect->mDrawMode )
{
ZoomInfo zoomInfo( 0.0, mEnvRect.width-1 );
Expand All @@ -3190,8 +3190,6 @@ void EqualizationPanel::OnPaint(wxPaintEvent & WXUNUSED(event))
context, mEnvRect, false, 0.0,
mEffect->mdBMin, mEffect->mdBMax, false);
}

mPainter->Flush();
}

void EqualizationPanel::OnMouseEvent(wxMouseEvent & event)
Expand Down
5 changes: 3 additions & 2 deletions src/widgets/Ruler.cpp
Expand Up @@ -1807,9 +1807,10 @@ void RulerPanel::OnPaint(wxPaintEvent & WXUNUSED(evt))

auto paintEvent = painter.Paint();

ruler.Draw(painter);
//auto stateMutator = painter.GetStateMutator();
painter.Clear(ColorFromWXColor(GetBackgroundColour()));

painter.Flush();
ruler.Draw(painter);
}

void RulerPanel::OnSize(wxSizeEvent & WXUNUSED(evt))
Expand Down

0 comments on commit d2eebd6

Please sign in to comment.