mirror of
https://codeberg.org/tenacityteam/tenacity
synced 2025-09-25 16:00:35 +02:00
ZoomInfo: remove ignoreFisheye param
Signed-off-by: Hailey Somerville <hailey@hails.org>
This commit is contained in:
@@ -31,20 +31,14 @@ ZoomInfo::~ZoomInfo()
|
||||
/// Converts a position (mouse X coordinate) to
|
||||
/// project time, in seconds. Needs the left edge of
|
||||
/// the track as an additional parameter.
|
||||
double ZoomInfo::PositionToTime(int64 position,
|
||||
int64 origin
|
||||
, bool // ignoreFisheye
|
||||
) const
|
||||
double ZoomInfo::PositionToTime(int64 position, int64 origin) const
|
||||
{
|
||||
return hpos + (position - origin) / zoom;
|
||||
}
|
||||
|
||||
|
||||
/// STM: Converts a project time to screen x position.
|
||||
auto ZoomInfo::TimeToPosition(double projectTime,
|
||||
int64 origin
|
||||
, bool // ignoreFisheye
|
||||
) const -> int64
|
||||
auto ZoomInfo::TimeToPosition(double projectTime, int64 origin) const -> int64
|
||||
{
|
||||
double t = 0.5 + zoom * (projectTime - hpos) + origin ;
|
||||
if( t < INT64_MIN )
|
||||
|
@@ -62,19 +62,13 @@ public:
|
||||
// Instead, call twice to convert start and end times,
|
||||
// and take the difference.
|
||||
// origin specifies the pixel corresponding to time h
|
||||
double PositionToTime(int64 position,
|
||||
int64 origin = 0
|
||||
, bool ignoreFisheye = false
|
||||
) const;
|
||||
double PositionToTime(int64 position, int64 origin = 0) const;
|
||||
|
||||
// do NOT use this once to convert a duration to a pixel width!
|
||||
// Instead, call twice to convert start and end positions,
|
||||
// and take the difference.
|
||||
// origin specifies the pixel corresponding to time h
|
||||
int64 TimeToPosition(double time,
|
||||
int64 origin = 0
|
||||
, bool ignoreFisheye = false
|
||||
) const;
|
||||
int64 TimeToPosition(double time, int64 origin = 0) const;
|
||||
|
||||
// This always ignores the fisheye. Use with caution!
|
||||
// You should prefer to call TimeToPosition twice, for endpoints, and take the difference!
|
||||
@@ -107,7 +101,7 @@ public:
|
||||
double GetScreenEndTime() const
|
||||
{
|
||||
auto width = GetTracksUsableWidth();
|
||||
return PositionToTime(width, 0, true);
|
||||
return PositionToTime(width, 0);
|
||||
}
|
||||
|
||||
bool ZoomInAvailable() const;
|
||||
|
@@ -1698,16 +1698,12 @@ bool AdornedRulerPanel::UpdateRects()
|
||||
|
||||
double AdornedRulerPanel::Pos2Time(int p, bool ignoreFisheye) const
|
||||
{
|
||||
return mViewInfo->PositionToTime(p, mLeftOffset
|
||||
, ignoreFisheye
|
||||
);
|
||||
return mViewInfo->PositionToTime(p, mLeftOffset);
|
||||
}
|
||||
|
||||
int AdornedRulerPanel::Time2Pos(double t, bool ignoreFisheye) const
|
||||
{
|
||||
return mViewInfo->TimeToPosition(t, mLeftOffset
|
||||
, ignoreFisheye
|
||||
);
|
||||
return mViewInfo->TimeToPosition(t, mLeftOffset);
|
||||
}
|
||||
|
||||
bool AdornedRulerPanel::IsWithinMarker(int mousePosX, double markerTime)
|
||||
|
@@ -29,8 +29,8 @@ double CalculateAdjustmentForZoomLevel(double avgPixPerSecond, bool showSamples)
|
||||
|
||||
double GetPixelsPerSecond(const wxRect& viewRect, const ZoomInfo& zoomInfo)
|
||||
{
|
||||
const auto h = zoomInfo.PositionToTime(0, 0, true);
|
||||
const auto trackRectT1 = zoomInfo.PositionToTime(viewRect.width, 0, true);
|
||||
const auto h = zoomInfo.PositionToTime(0, 0);
|
||||
const auto trackRectT1 = zoomInfo.PositionToTime(viewRect.width, 0);
|
||||
return viewRect.width / (trackRectT1 - h);
|
||||
}
|
||||
|
||||
@@ -50,12 +50,12 @@ double GetBlankSpaceBeforePlayEndTime(const ClipTimes& clip)
|
||||
|
||||
ClipParameters::ClipParameters(
|
||||
const ClipTimes& clip, const wxRect& rect, const ZoomInfo& zoomInfo)
|
||||
: trackRectT0 { zoomInfo.PositionToTime(0, 0, true) }
|
||||
: trackRectT0 { zoomInfo.PositionToTime(0, 0) }
|
||||
, averagePixelsPerSecond { GetPixelsPerSecond(rect, zoomInfo) }
|
||||
, showIndividualSamples { ShowIndividualSamples(
|
||||
clip.GetRate(), clip.GetStretchRatio(), averagePixelsPerSecond) }
|
||||
{
|
||||
const auto trackRectT1 = zoomInfo.PositionToTime(rect.width, 0, true);
|
||||
const auto trackRectT1 = zoomInfo.PositionToTime(rect.width, 0);
|
||||
const auto stretchRatio = clip.GetStretchRatio();
|
||||
const auto playStartTime = clip.GetPlayStartTime();
|
||||
|
||||
@@ -98,7 +98,7 @@ ClipParameters::ClipParameters(
|
||||
if (tpre < 0)
|
||||
{
|
||||
// Fix Bug #1296 caused by premature conversion to (int).
|
||||
wxInt64 time64 = zoomInfo.TimeToPosition(playStartTime, 0, true);
|
||||
wxInt64 time64 = zoomInfo.TimeToPosition(playStartTime, 0);
|
||||
if (time64 < 0)
|
||||
time64 = 0;
|
||||
hiddenLeftOffset = (time64 < rect.width) ? (int)time64 : rect.width;
|
||||
@@ -113,7 +113,7 @@ ClipParameters::ClipParameters(
|
||||
// size of the blank area.
|
||||
if (tpost > t1)
|
||||
{
|
||||
wxInt64 time64 = zoomInfo.TimeToPosition(playStartTime + t1, 0, true);
|
||||
wxInt64 time64 = zoomInfo.TimeToPosition(playStartTime + t1, 0);
|
||||
if (time64 < 0)
|
||||
time64 = 0;
|
||||
const int hiddenRightOffset =
|
||||
@@ -132,7 +132,7 @@ ClipParameters::ClipParameters(
|
||||
leftOffset = 0;
|
||||
if (tpre < 0)
|
||||
{
|
||||
wxInt64 time64 = zoomInfo.TimeToPosition(playStartTime, 0, false);
|
||||
wxInt64 time64 = zoomInfo.TimeToPosition(playStartTime, 0);
|
||||
if (time64 < 0)
|
||||
time64 = 0;
|
||||
leftOffset = (time64 < rect.width) ? (int)time64 : rect.width;
|
||||
@@ -147,7 +147,7 @@ ClipParameters::ClipParameters(
|
||||
// size of the blank area.
|
||||
if (tpost > t1)
|
||||
{
|
||||
wxInt64 time64 = zoomInfo.TimeToPosition(playStartTime + t1, 0, false);
|
||||
wxInt64 time64 = zoomInfo.TimeToPosition(playStartTime + t1, 0);
|
||||
if (time64 < 0)
|
||||
time64 = 0;
|
||||
const int distortedRightOffset =
|
||||
@@ -173,13 +173,13 @@ wxRect ClipParameters::GetClipRect(
|
||||
constexpr auto edgeRight =
|
||||
static_cast<ZoomInfo::int64>(std::numeric_limits<int>::max());
|
||||
const auto left = std::clamp(
|
||||
zoomInfo.TimeToPosition(clip.GetPlayStartTime(), viewRect.x, true),
|
||||
zoomInfo.TimeToPosition(clip.GetPlayStartTime(), viewRect.x),
|
||||
edgeLeft, edgeRight);
|
||||
const auto right = std::clamp(
|
||||
zoomInfo.TimeToPosition(
|
||||
clip.GetPlayEndTime() - GetBlankSpaceBeforePlayEndTime(clip) +
|
||||
clipEndingAdjustment,
|
||||
viewRect.x, true),
|
||||
viewRect.x),
|
||||
edgeLeft, edgeRight);
|
||||
if (right >= left)
|
||||
{
|
||||
|
Reference in New Issue
Block a user