From a31075bb01929d2c151fbdd9569442e6935e203f Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 16 Mar 2023 00:26:32 +0100 Subject: Cleanup: improve comment and parameter name. --- src/lib/video_content.cc | 19 +++++++++++-------- src/lib/video_content.h | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index 862580004..3a6383d6b 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -641,32 +641,35 @@ VideoContent::modify_trim_start (ContentTime& trim) const } -/** @param film_container The size of the container for the DCP that we are working on */ +/** Calculate the size that this content's image should be scaled to if it's being placed + * into a given frame size. This frame size could be the container of a DCP, for example, + * or the available space in a preview. + */ dcp::Size -VideoContent::scaled_size (dcp::Size film_container) +VideoContent::scaled_size(dcp::Size frame) { if (_custom_ratio) { - return fit_ratio_within(*_custom_ratio, film_container); + return fit_ratio_within(*_custom_ratio, frame); } if (_custom_size) { - if (_custom_size->width <= film_container.width && _custom_size->height <= film_container.height) { + if (_custom_size->width <= frame.width && _custom_size->height <= frame.height) { return *_custom_size; } - return fit_ratio_within(_custom_size->ratio(), film_container); + return fit_ratio_within(_custom_size->ratio(), frame); } auto size = size_after_crop (); size.width = std::lrint(size.width * _sample_aspect_ratio.get_value_or(1)); /* This is what we will return unless there is any legacy stuff to take into account */ - auto auto_size = fit_ratio_within (size.ratio(), film_container); + auto auto_size = fit_ratio_within (size.ratio(), frame); if (_legacy_ratio) { - if (fit_ratio_within(*_legacy_ratio, film_container) != auto_size) { + if (fit_ratio_within(*_legacy_ratio, frame) != auto_size) { _custom_ratio = *_legacy_ratio; _legacy_ratio = optional(); - return fit_ratio_within(*_custom_ratio, film_container); + return fit_ratio_within(*_custom_ratio, frame); } _legacy_ratio = boost::optional(); } diff --git a/src/lib/video_content.h b/src/lib/video_content.h index 9f6cc105e..285aa0002 100644 --- a/src/lib/video_content.h +++ b/src/lib/video_content.h @@ -206,7 +206,7 @@ public: /* XXX: names for these? */ dcp::Size size_after_3d_split () const; dcp::Size size_after_crop () const; - dcp::Size scaled_size (dcp::Size container_size); + dcp::Size scaled_size(dcp::Size frame); boost::optional fade (std::shared_ptr film, Frame) const; -- cgit v1.2.3