diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-12-19 20:02:00 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-09-03 09:41:16 +0200 |
| commit | 7f35c43bafa0ce654b4cfb9c7ea5b6ea0c1ddd37 (patch) | |
| tree | bfb13f90192169e07c286dbd0535fc627dc02631 /src/lib/video_content.cc | |
| parent | 13d5b07d47401ac2ac3dfa58fe3baca7cf9fd64f (diff) | |
Add and use Time::proportion_of().
Diffstat (limited to 'src/lib/video_content.cc')
| -rw-r--r-- | src/lib/video_content.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index 9a558052a..4b6680169 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -429,14 +429,14 @@ VideoContent::fade(shared_ptr<const Film> film, ContentTime time) const /* time after the trimmed start of the content */ auto const time_after_start = time - trim_start; if (fade_in_time.get() && time_after_start < fade_in_time) { - return std::max(0.0, static_cast<double>(time_after_start.get()) / fade_in_time.get()); + return std::max(0.0, time_after_start.proportion_of(fade_in_time)); } auto const fade_out_time = ContentTime::from_frames(fade_out(), vfr); auto const end = ContentTime::from_frames(length(), vfr) - _parent->trim_end(); auto const time_after_end_fade_start = time - (end - fade_out_time); if (time_after_end_fade_start > ContentTime()) { - return std::max(0.0, 1 - static_cast<double>(time_after_end_fade_start.get()) / fade_out_time.get()); + return std::max(0.0, 1 - time_after_end_fade_start.proportion_of(fade_out_time)); } return {}; |
