mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-19 14:17:41 +02:00
Bug 406 (P2) - (partial?) Fix for labeltracks in large projects being slow/laggy/jerky.
Undoes Roger's fixes for bug 255/148, as this was one component of the bug. This fix restores TrackPanel::RefreshTrack to using a cliprect instead of doing an entire refresh. It does it by using a repair flag in TrackPanel::DoDrawIndicator that does not advance the indicator time (so the only place the time can advance is in OnTimer) I tested to make sure both bugs were okay after my fix. This fix may restore usability enough to resolve the bug, but I note that there are other potential optimizations we can make, discussed on the bug 406 bugzilla comments.
This commit is contained in:
parent
e56cb9736b
commit
9bd2da0284
@ -1039,11 +1039,15 @@ void TrackPanel::DrawIndicator()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Second level DrawIndicator()
|
/// Second level DrawIndicator()
|
||||||
void TrackPanel::DoDrawIndicator(wxDC & dc)
|
void TrackPanel::DoDrawIndicator(wxDC & dc, bool repairOld /* = false */)
|
||||||
{
|
{
|
||||||
bool onScreen;
|
bool onScreen;
|
||||||
int x;
|
int x;
|
||||||
|
double pos;
|
||||||
|
|
||||||
|
if (!repairOld)
|
||||||
|
{
|
||||||
|
// Erase the old indicator.
|
||||||
if( mLastIndicator != -1 )
|
if( mLastIndicator != -1 )
|
||||||
{
|
{
|
||||||
onScreen = between_inclusive( mViewInfo->h,
|
onScreen = between_inclusive( mViewInfo->h,
|
||||||
@ -1076,7 +1080,7 @@ void TrackPanel::DoDrawIndicator(wxDC & dc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The stream time can be < 0 if the audio is currently stopped
|
// The stream time can be < 0 if the audio is currently stopped
|
||||||
double pos = gAudioIO->GetStreamTime();
|
pos = gAudioIO->GetStreamTime();
|
||||||
|
|
||||||
AudacityProject *p = GetProject();
|
AudacityProject *p = GetProject();
|
||||||
bool audioActive = ( gAudioIO->IsStreamActive( p->GetAudioIOToken() ) != 0 );
|
bool audioActive = ( gAudioIO->IsStreamActive( p->GetAudioIOToken() ) != 0 );
|
||||||
@ -1109,6 +1113,9 @@ void TrackPanel::DoDrawIndicator(wxDC & dc)
|
|||||||
|
|
||||||
// Remember it
|
// Remember it
|
||||||
mLastIndicator = pos;
|
mLastIndicator = pos;
|
||||||
|
} else {
|
||||||
|
pos = mLastIndicator;
|
||||||
|
}
|
||||||
|
|
||||||
// Set play/record color
|
// Set play/record color
|
||||||
bool rec = (gAudioIO->GetNumCaptureChannels() > 0);
|
bool rec = (gAudioIO->GetNumCaptureChannels() > 0);
|
||||||
@ -1312,7 +1319,9 @@ void TrackPanel::OnPaint(wxPaintEvent & /* event */)
|
|||||||
if (!gAudioIO->IsPaused() &&
|
if (!gAudioIO->IsPaused() &&
|
||||||
( mIndicatorShowing || gAudioIO->IsStreamActive(p->GetAudioIOToken())))
|
( mIndicatorShowing || gAudioIO->IsStreamActive(p->GetAudioIOToken())))
|
||||||
{
|
{
|
||||||
DoDrawIndicator( cdc );
|
// We just want to repair, not update the old, so set the second param to true.
|
||||||
|
// This is important because this onPaint could be for just some of the tracks.
|
||||||
|
DoDrawIndicator( cdc, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the cursor
|
// Draw the cursor
|
||||||
@ -5377,39 +5386,33 @@ double TrackPanel::GetMostRecentXPos()
|
|||||||
|
|
||||||
void TrackPanel::RefreshTrack(Track *trk, bool refreshbacking)
|
void TrackPanel::RefreshTrack(Track *trk, bool refreshbacking)
|
||||||
{
|
{
|
||||||
//v Vaughan, 2011-02-04:
|
Track *link = trk->GetLink();
|
||||||
// Since Roger's fix is to not use r, no reason to declare or calculate it, or link.
|
|
||||||
//Track *link = trk->GetLink();
|
if (link && !trk->GetLinked()) {
|
||||||
//
|
trk = link;
|
||||||
//if (link && !trk->GetLinked()) {
|
link = trk->GetLink();
|
||||||
// trk = link;
|
}
|
||||||
// link = trk->GetLink();
|
|
||||||
//}
|
wxRect r(kLeftInset,
|
||||||
//
|
-mViewInfo->vpos + trk->GetY() + kTopInset,
|
||||||
//wxRect r(kLeftInset,
|
GetRect().GetWidth() - kLeftInset * 2 - 1,
|
||||||
// -mViewInfo->vpos + trk->GetY() + kTopInset,
|
trk->GetHeight() - kTopInset - 1);
|
||||||
// GetRect().GetWidth() - kLeftInset * 2 - 1,
|
|
||||||
// trk->GetHeight() - kTopInset - 1);
|
if (link) {
|
||||||
//
|
r.height += link->GetHeight();
|
||||||
//if (link) {
|
}
|
||||||
// r.height += link->GetHeight();
|
|
||||||
//}
|
|
||||||
|
|
||||||
if( refreshbacking )
|
if( refreshbacking )
|
||||||
{
|
{
|
||||||
mRefreshBacking = true;
|
mRefreshBacking = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//v Vaughan, 2011-02-04:
|
Refresh( false, &r );
|
||||||
// Roger's patch for Bug 255 is to Refresh the whole TrackPanel.
|
|
||||||
// We'll see if it's too much of a performance hit.
|
|
||||||
//Refresh( false, &r );
|
|
||||||
Refresh(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// This method overrides Refresh() of wxWindow so that the
|
/// This method overrides Refresh() of wxWindow so that the
|
||||||
/// boolean play indicator can be set to false, so that an old play indicator that is
|
/// boolean play indictaor can be set to false, so that an old play indicator that is
|
||||||
/// no longer there won't get XORed (to erase it), thus redrawing it on the
|
/// no longer there won't get XORed (to erase it), thus redrawing it on the
|
||||||
/// TrackPanel
|
/// TrackPanel
|
||||||
void TrackPanel::Refresh(bool eraseBackground /* = TRUE */,
|
void TrackPanel::Refresh(bool eraseBackground /* = TRUE */,
|
||||||
|
@ -257,7 +257,9 @@ class TrackPanel:public wxPanel {
|
|||||||
bool HandleTrackLocationMouseEvent(WaveTrack * track, wxRect &r, wxMouseEvent &event);
|
bool HandleTrackLocationMouseEvent(WaveTrack * track, wxRect &r, wxMouseEvent &event);
|
||||||
void HandleTrackSpecificMouseEvent(wxMouseEvent & event);
|
void HandleTrackSpecificMouseEvent(wxMouseEvent & event);
|
||||||
void DrawIndicator();
|
void DrawIndicator();
|
||||||
void DoDrawIndicator(wxDC & dc);
|
/// draws the green line on the tracks to show playback position
|
||||||
|
/// @param repairOld if true the playback position is not updated/erased, and simply redrawn
|
||||||
|
void DoDrawIndicator(wxDC & dc, bool repairOld = false);
|
||||||
void DrawCursor();
|
void DrawCursor();
|
||||||
void DoDrawCursor(wxDC & dc);
|
void DoDrawCursor(wxDC & dc);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user