From 5031583d45449f8b49900496a2a46683bac68ad6 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 12 Mar 2023 22:58:30 +0100 Subject: Cleanup: use fit_ratio_within(). --- src/wx/film_viewer.cc | 13 +------------ 1 file changed, 1 insertion(+), 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(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); -- cgit v1.2.3