Fix black borders around the preview in some cases (#2331).
[dcpomatic.git] / src / lib / video_content.cc
index 86efeee7b3606ed7d0262da664aa6c4b33bdadec..1d1d010a95662193bc52ab84e5dacb2b8746fb10 100644 (file)
@@ -529,6 +529,12 @@ VideoContent::set_length (Frame len)
        maybe_set (_length, len, ContentProperty::LENGTH);
 }
 
+void
+VideoContent::set_crop (Crop c)
+{
+       maybe_set (_crop, c, VideoContentProperty::CROP);
+}
+
 void
 VideoContent::set_left_crop (int c)
 {
@@ -654,7 +660,7 @@ VideoContent::scaled_size (dcp::Size film_container)
        }
 
        auto size = size_after_crop ();
-       size.width *= _sample_aspect_ratio.get_value_or(1);
+       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);