1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-23 16:08:07 +02:00

Bug1995: Fix drawing of stereo tracks, bug introduced at 0c0c2c0

This commit is contained in:
Paul Licameli 2018-10-03 16:10:19 -04:00
parent 8880e1b929
commit 50f2b0e860

View File

@ -351,7 +351,7 @@ void TrackArtist::DrawTracks(TrackPanelDrawingContext &context,
bool drawSliders) bool drawSliders)
{ {
// Copy the horizontal extent of rect; will later change only the vertical. // Copy the horizontal extent of rect; will later change only the vertical.
wxRect trackRect = rect; wxRect teamRect = rect;
bool hasSolo = false; bool hasSolo = false;
for (const Track *t : *tracks) { for (const Track *t : *tracks) {
@ -382,20 +382,18 @@ void TrackArtist::DrawTracks(TrackPanelDrawingContext &context,
auto group = TrackList::Channels( leader ); auto group = TrackList::Channels( leader );
leader = leader->SubstitutePendingChangedTrack().get(); leader = leader->SubstitutePendingChangedTrack().get();
trackRect.y = leader->GetY() - zoomInfo.vpos; teamRect.y = leader->GetY() - zoomInfo.vpos;
trackRect.height = group.sum( [&] (const Track *channel) { teamRect.height = group.sum( [&] (const Track *channel) {
channel = channel->SubstitutePendingChangedTrack().get(); channel = channel->SubstitutePendingChangedTrack().get();
return channel->GetHeight(); return channel->GetHeight();
}); });
if (trackRect.GetBottom() < clip.GetTop()) if (teamRect.GetBottom() < clip.GetTop())
continue; continue;
else if (trackRect.GetTop() > clip.GetBottom()) else if (teamRect.GetTop() > clip.GetBottom())
break; break;
for (auto t : group) { for (auto t : group) {
t = t->SubstitutePendingChangedTrack().get();
#if defined(DEBUG_CLIENT_AREA) #if defined(DEBUG_CLIENT_AREA)
// Filled rectangle to show the interior of the client area // Filled rectangle to show the interior of the client area
wxRect zr = trackRect; wxRect zr = trackRect;
@ -413,13 +411,15 @@ void TrackArtist::DrawTracks(TrackPanelDrawingContext &context,
// its linked partner, and see if any part of that rect is on-screen. // its linked partner, and see if any part of that rect is on-screen.
// If so, we draw both. Otherwise, we can safely draw neither. // If so, we draw both. Otherwise, we can safely draw neither.
if (trackRect.Intersects(clip) && reg.Contains(trackRect)) { if (teamRect.Intersects(clip) && reg.Contains(teamRect)) {
wxRect rr = trackRect; t = t->SubstitutePendingChangedTrack().get();
rr.x += mMarginLeft; wxRect trackRect {
rr.y += mMarginTop; rect.x + mMarginLeft,
rr.width -= (mMarginLeft + mMarginRight); t->GetY() - zoomInfo.vpos + mMarginTop,
rr.height -= (mMarginTop + mMarginBottom); rect.width - (mMarginLeft + mMarginRight),
DrawTrack(context, t, rr, t->GetHeight() - (mMarginTop + mMarginBottom)
};
DrawTrack(context, t, trackRect,
selectedRegion, zoomInfo, selectedRegion, zoomInfo,
drawEnvelope, bigPoints, drawSliders, hasSolo); drawEnvelope, bigPoints, drawSliders, hasSolo);
} }