Commit cc81f032 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

vout: vout_display_PlacePicture: Avoir potential loss of precision

parent 3abd958b
......@@ -228,9 +228,9 @@ void vout_display_PlacePicture(vout_display_place_t *place,
const unsigned width = source->i_visible_width;
const unsigned height = source->i_visible_height;
/* Compute the height if we use the width to fill up display_width */
const int64_t scaled_height = (int64_t)height * display_width * cfg->display.sar.num * source->i_sar_den / width / source->i_sar_num / cfg->display.sar.den;
const int64_t scaled_height = (int64_t)height * display_width * cfg->display.sar.num * source->i_sar_den / (width * source->i_sar_num * cfg->display.sar.den);
/* And the same but switching width/height */
const int64_t scaled_width = (int64_t)width * display_height * cfg->display.sar.den * source->i_sar_num / height / source->i_sar_den / cfg->display.sar.num;
const int64_t scaled_width = (int64_t)width * display_height * cfg->display.sar.den * source->i_sar_num / (height * source->i_sar_den * cfg->display.sar.num);
if (source->projection_mode == PROJECTION_MODE_RECTANGULAR) {
/* We keep the solution that avoid filling outside the display */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment