diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-03-12 22:56:43 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-03-16 00:37:02 +0100 |
| commit | e5a610e713af1a27e0bb2e6a600872ddc4439243 (patch) | |
| tree | 4fb05aeb3efe3cb37dfb81addbc2c7cbd1412916 | |
| parent | 02085b7d2e6322bc23fc5b9475dff7e5b6748699 (diff) | |
Cleanup: use dcp::Size.
| -rw-r--r-- | src/wx/film_viewer.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index e7dcf5642..f39fe8d2b 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -301,20 +301,22 @@ FilmViewer::calculate_sizes () auto const container = _film->container (); auto const scale = dpi_scale_factor (_video_view->get()); - int const video_view_width = std::round(_video_view->get()->GetSize().x * scale); - int const video_view_height = std::round(_video_view->get()->GetSize().y * scale); + auto video_view_size = dcp::Size{ + static_cast<int>(std::lround(_video_view->get()->GetSize().x * scale)), + static_cast<int>(std::lround(_video_view->get()->GetSize().y * scale)) + }; - auto const view_ratio = float(video_view_width) / video_view_height; + 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_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_height; + out_size.height = video_view_size.height; out_size.width = lrintf (out_size.height * film_ratio); } |
