Don't scale chroma subsampled images to sizes that don't align with the subsampling...
[dcpomatic.git] / src / lib / util.cc
index d3af74376a3cd2349eeceafa9ab3ab35f5dc9423..78ed8da99f9e1a2e0ddfe3ea416c4d8296fd6702 100644 (file)
@@ -1111,7 +1111,7 @@ linear_to_db (double linear)
 
 
 dcp::Size
-scale_for_display (dcp::Size s, dcp::Size display_container, dcp::Size film_container)
+scale_for_display (dcp::Size s, dcp::Size display_container, dcp::Size film_container, PixelQuanta quanta)
 {
        /* Now scale it down if the display container is smaller than the film container */
        if (display_container != film_container) {
@@ -1122,6 +1122,7 @@ scale_for_display (dcp::Size s, dcp::Size display_container, dcp::Size film_cont
 
                s.width = lrintf (s.width * scale);
                s.height = lrintf (s.height * scale);
+               s = quanta.round (s);
        }
 
        return s;