diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-10-15 15:26:04 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-10-15 15:26:04 +0100 |
| commit | 45f9912aa850546e319e32a4052517d67f4e3d8f (patch) | |
| tree | f92b43f73e82cd09bf6a3bea29147aafa9c59d79 /src/lib/util.cc | |
| parent | 708dacb8247c73c02b6192464325738203ca001a (diff) | |
Allow no-stretch scaling of video content.
Diffstat (limited to 'src/lib/util.cc')
| -rw-r--r-- | src/lib/util.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib/util.cc b/src/lib/util.cc index b13d905bf..1c4347233 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -882,3 +882,12 @@ make_signer () return shared_ptr<const libdcp::Signer> (new libdcp::Signer (chain, signer_key)); } +libdcp::Size +fit_ratio_within (float ratio, libdcp::Size full_frame) +{ + if (ratio < full_frame.ratio ()) { + return libdcp::Size (full_frame.height * ratio, full_frame.height); + } + + return libdcp::Size (full_frame.width, full_frame.width / ratio); +} |
