summaryrefslogtreecommitdiff
path: root/src/lib/video_content.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-03-09 22:03:13 +0000
committerCarl Hetherington <cth@carlh.net>2014-03-09 22:03:13 +0000
commit3a9bea8c3727af6ebbce860b8223371cd7f87b3f (patch)
tree4c2afdd6badac88017ed42c3cd971821e2f3a201 /src/lib/video_content.cc
parent3190fb98298ebdd29c41b2cf6019a381e71a6248 (diff)
Fix display of no-scale mode in the player; the image still has to be scaled for the film viewer as its image must represent a (scaled down) version of the film's frame.
Diffstat (limited to 'src/lib/video_content.cc')
-rw-r--r--src/lib/video_content.cc21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc
index 7bf2a6b62..82f817654 100644
--- a/src/lib/video_content.cc
+++ b/src/lib/video_content.cc
@@ -443,19 +443,28 @@ VideoContentScale::name () const
return _("No scale");
}
+/** @param display_container Size of the container that we are displaying this content in.
+ * @param film_container The size of the film's image.
+ */
libdcp::Size
-VideoContentScale::size (shared_ptr<const VideoContent> c, libdcp::Size container) const
+VideoContentScale::size (shared_ptr<const VideoContent> c, libdcp::Size display_container, libdcp::Size film_container) const
{
if (_ratio) {
- return fit_ratio_within (_ratio->ratio (), container);
+ return fit_ratio_within (_ratio->ratio (), display_container);
}
- /* Force scale if the container is smaller than the content's image */
- if (_scale || container.width < c->video_size().width || container.height < c->video_size().height) {
- return fit_ratio_within (c->video_size().ratio (), container);
+ /* Force scale if the film_container is smaller than the content's image */
+ if (_scale || film_container.width < c->video_size().width || film_container.height < c->video_size().height) {
+ return fit_ratio_within (c->video_size().ratio (), display_container);
}
- return c->video_size ();
+ /* Scale the image so that it will be in the right place in film_container, even if display_container is a
+ different size.
+ */
+ return libdcp::Size (
+ c->video_size().width * float(display_container.width) / film_container.width,
+ c->video_size().height * float(display_container.height) / film_container.height
+ );
}
void