Skip to content
Snippets Groups Projects
Commit 104e8b50 authored by James Crook's avatar James Crook
Browse files

Bug 1296 - Zooming to maximum in longer multi-clip tracks crashes in all clips except the last

Caused by a premature conversion of a wxInt64 to (int) so that a large positive number became negative.
We now do the conversion after minning it against an integer width.
parent c57eeb46
Branches
Tags
No related merge requests found
...@@ -1585,29 +1585,26 @@ struct ClipParameters ...@@ -1585,29 +1585,26 @@ struct ClipParameters
hiddenMid = rect; hiddenMid = rect;
// If the left edge of the track is to the right of the left // If the left edge of the track is to the right of the left
// edge of the display, then there's some blank area to the // edge of the display, then there's some unused area to the
// left of the track. Reduce the "hiddenMid" // left of the track. Reduce the "hiddenMid"
hiddenLeftOffset = 0; hiddenLeftOffset = 0;
if (tpre < 0) { if (tpre < 0) {
hiddenLeftOffset = std::min(rect.width, int( // Fix Bug #1296 caused by premature conversion to (int).
zoomInfo.TimeToPosition(tOffset, 0 wxInt64 time64 = zoomInfo.TimeToPosition(tOffset, 0 , false);
, true hiddenLeftOffset = (time64 < rect.width) ? (int)time64 : rect.width;
)
));
hiddenMid.x += hiddenLeftOffset; hiddenMid.x += hiddenLeftOffset;
hiddenMid.width -= hiddenLeftOffset; hiddenMid.width -= hiddenLeftOffset;
} }
// If the right edge of the track is to the left of the the right // If the right edge of the track is to the left of the the right
// edge of the display, then there's some blank area to the right // edge of the display, then there's some unused area to the right
// of the track. Reduce the "hiddenMid" rect by the // of the track. Reduce the "hiddenMid" rect by the
// size of the blank area. // size of the blank area.
if (tpost > t1) { if (tpost > t1) {
const int hiddenRightOffset = std::min(rect.width, int( wxInt64 time64 = zoomInfo.TimeToPosition(tOffset+t1, 0 , false);
zoomInfo.TimeToPosition(tOffset + t1, 0 const int hiddenRightOffset = (time64 < rect.width) ? (int)time64 : rect.width;
, true
)
));
hiddenMid.width = std::max(0, hiddenRightOffset - hiddenLeftOffset); hiddenMid.width = std::max(0, hiddenRightOffset - hiddenLeftOffset);
} }
...@@ -1617,29 +1614,25 @@ struct ClipParameters ...@@ -1617,29 +1614,25 @@ struct ClipParameters
mid = rect; mid = rect;
// If the left edge of the track is to the right of the left // If the left edge of the track is to the right of the left
// edge of the display, then there's some blank area to the // edge of the display, then there's some unused area to the
// left of the track. Reduce the "hiddenMid" // left of the track. Reduce the "mid"
leftOffset = 0; leftOffset = 0;
if (tpre < 0) { if (tpre < 0) {
leftOffset = std::min(rect.width, int( wxInt64 time64 = zoomInfo.TimeToPosition(tOffset, 0 , false);
zoomInfo.TimeToPosition(tOffset, 0 leftOffset = (time64 < rect.width) ? (int)time64 : rect.width;
, false
)
));
mid.x += leftOffset; mid.x += leftOffset;
mid.width -= leftOffset; mid.width -= leftOffset;
} }
// If the right edge of the track is to the left of the the right // If the right edge of the track is to the left of the the right
// edge of the display, then there's some blank area to the right // edge of the display, then there's some unused area to the right
// of the track. Reduce the "hiddenMid" rect by the // of the track. Reduce the "mid" rect by the
// size of the blank area. // size of the blank area.
if (tpost > t1) { if (tpost > t1) {
const int distortedRightOffset = std::min(rect.width, int( wxInt64 time64 = zoomInfo.TimeToPosition(tOffset+t1, 0 , false);
zoomInfo.TimeToPosition(tOffset + t1, 0 const int distortedRightOffset = (time64 < rect.width) ? (int)time64 : rect.width;
, false
)
));
mid.width = std::max(0, distortedRightOffset - leftOffset); mid.width = std::max(0, distortedRightOffset - leftOffset);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment