diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-03-12 22:58:30 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-03-16 00:44:42 +0100 |
| commit | 5031583d45449f8b49900496a2a46683bac68ad6 (patch) | |
| tree | 54c981478d072d074bc9e23fe14aeec51be48ec3 | |
| parent | e5a610e713af1a27e0bb2e6a600872ddc4439243 (diff) | |
Cleanup: use fit_ratio_within().
| -rw-r--r-- | src/wx/film_viewer.cc | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index f39fe8d2b..7a4fcd364 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -306,19 +306,8 @@ FilmViewer::calculate_sizes () static_cast<int>(std::lround(_video_view->get()->GetSize().y * scale)) }; - auto const view_ratio = video_view_size.ratio(); auto const film_ratio = container ? container->ratio () : 1.78; - - dcp::Size out_size; - if (view_ratio < film_ratio) { - /* panel is less widscreen than the film; clamp width */ - out_size.width = video_view_size.width; - out_size.height = lrintf (out_size.width / film_ratio); - } else { - /* panel is more widescreen than the film; clamp height */ - out_size.height = video_view_size.height; - out_size.width = lrintf (out_size.height * film_ratio); - } + auto out_size = fit_ratio_within(film_ratio, video_view_size); /* Catch silly values */ out_size.width = max (64, out_size.width); |
