diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-03-16 00:26:32 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-03-16 00:44:42 +0100 |
| commit | a31075bb01929d2c151fbdd9569442e6935e203f (patch) | |
| tree | 265f1a2c0f9bd68f1af226c001b222e7c347c901 | |
| parent | aea88fe901c5fe48c558c5824cee696bb19ae421 (diff) | |
Cleanup: improve comment and parameter name.
| -rw-r--r-- | src/lib/video_content.cc | 19 | ||||
| -rw-r--r-- | 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<float>(); - return fit_ratio_within(*_custom_ratio, film_container); + return fit_ratio_within(*_custom_ratio, frame); } _legacy_ratio = boost::optional<float>(); } 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<double> fade (std::shared_ptr<const Film> film, Frame) const; |
