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

Residuals from Bug 1296

Added forcing time64 to be positive.  Fixes problem where large negative value overflows into int.
More careful computation of TimeToPosition() so floor is only called with in range values.
Re-instated 'true' flags for hiddenMid calls, which I'd mistakenly dropped, so that (later) FishEye can distinguish.
parent 104e8b50
No related branches found
No related tags found
No related merge requests found
...@@ -1590,7 +1590,9 @@ struct ClipParameters ...@@ -1590,7 +1590,9 @@ struct ClipParameters
hiddenLeftOffset = 0; hiddenLeftOffset = 0;
if (tpre < 0) { if (tpre < 0) {
// Fix Bug #1296 caused by premature conversion to (int). // Fix Bug #1296 caused by premature conversion to (int).
wxInt64 time64 = zoomInfo.TimeToPosition(tOffset, 0 , false); wxInt64 time64 = zoomInfo.TimeToPosition(tOffset, 0 , true);
if( time64 < 0 )
time64 = 0;
hiddenLeftOffset = (time64 < rect.width) ? (int)time64 : rect.width; hiddenLeftOffset = (time64 < rect.width) ? (int)time64 : rect.width;
hiddenMid.x += hiddenLeftOffset; hiddenMid.x += hiddenLeftOffset;
...@@ -1602,12 +1604,13 @@ struct ClipParameters ...@@ -1602,12 +1604,13 @@ struct ClipParameters
// 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) {
wxInt64 time64 = zoomInfo.TimeToPosition(tOffset+t1, 0 , false); wxInt64 time64 = zoomInfo.TimeToPosition(tOffset+t1, 0 , true);
if( time64 < 0 )
time64 = 0;
const int hiddenRightOffset = (time64 < rect.width) ? (int)time64 : rect.width; const int hiddenRightOffset = (time64 < rect.width) ? (int)time64 : rect.width;
hiddenMid.width = std::max(0, hiddenRightOffset - hiddenLeftOffset); hiddenMid.width = std::max(0, hiddenRightOffset - hiddenLeftOffset);
} }
// The variable "mid" will be the rectangle containing the // The variable "mid" will be the rectangle containing the
// actual waveform, as distorted by the fisheye, // actual waveform, as distorted by the fisheye,
// as opposed to any blank area before or after the track. // as opposed to any blank area before or after the track.
...@@ -1619,6 +1622,8 @@ struct ClipParameters ...@@ -1619,6 +1622,8 @@ struct ClipParameters
leftOffset = 0; leftOffset = 0;
if (tpre < 0) { if (tpre < 0) {
wxInt64 time64 = zoomInfo.TimeToPosition(tOffset, 0 , false); wxInt64 time64 = zoomInfo.TimeToPosition(tOffset, 0 , false);
if( time64 < 0 )
time64 = 0;
leftOffset = (time64 < rect.width) ? (int)time64 : rect.width; leftOffset = (time64 < rect.width) ? (int)time64 : rect.width;
mid.x += leftOffset; mid.x += leftOffset;
...@@ -1631,6 +1636,8 @@ struct ClipParameters ...@@ -1631,6 +1636,8 @@ struct ClipParameters
// size of the blank area. // size of the blank area.
if (tpost > t1) { if (tpost > t1) {
wxInt64 time64 = zoomInfo.TimeToPosition(tOffset+t1, 0 , false); wxInt64 time64 = zoomInfo.TimeToPosition(tOffset+t1, 0 , false);
if( time64 < 0 )
time64 = 0;
const int distortedRightOffset = (time64 < rect.width) ? (int)time64 : rect.width; const int distortedRightOffset = (time64 < rect.width) ? (int)time64 : rect.width;
mid.width = std::max(0, distortedRightOffset - leftOffset); mid.width = std::max(0, distortedRightOffset - leftOffset);
......
...@@ -58,9 +58,13 @@ wxInt64 ZoomInfo::TimeToPosition(double projectTime, ...@@ -58,9 +58,13 @@ wxInt64 ZoomInfo::TimeToPosition(double projectTime,
, bool // ignoreFisheye , bool // ignoreFisheye
) const ) const
{ {
return floor(0.5 + double t = 0.5 + zoom * (projectTime - h) + origin ;
zoom * (projectTime - h) + origin if( t < wxINT64_MIN )
); return wxINT64_MIN;
if( t > wxINT64_MAX )
return wxINT64_MAX;
t = floor( t );
return t;
} }
bool ZoomInfo::ZoomInAvailable() const bool ZoomInfo::ZoomInAvailable() const
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment