From 60bb3b66779aed97150247c42c66e02def018b91 Mon Sep 17 00:00:00 2001 From: Omar Emara Date: Mon, 30 Sep 2024 18:58:13 +0300 Subject: [PATCH] Fix #124737: Scale To Render size is not precise The Scale node in the Scale To Render size mode is not precise in case of the use of render size percentage. This is due to floating point imprecisions and we mitigate it by rounding instead of flooring after multiplying by the percentage. --- source/blender/compositor/nodes/COM_ScaleNode.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/compositor/nodes/COM_ScaleNode.cc b/source/blender/compositor/nodes/COM_ScaleNode.cc index 4ea997cd4d8..f162e6db896 100644 --- a/source/blender/compositor/nodes/COM_ScaleNode.cc +++ b/source/blender/compositor/nodes/COM_ScaleNode.cc @@ -66,8 +66,8 @@ void ScaleNode::convert_to_operations(NodeConverter &converter, ELEM(bnode->custom2, CMP_NODE_SCALE_RENDER_SIZE_FIT, CMP_NODE_SCALE_RENDER_SIZE_CROP)); operation->set_is_crop(bnode->custom2 == CMP_NODE_SCALE_RENDER_SIZE_CROP); operation->set_offset(bnode->custom3, bnode->custom4); - operation->set_new_width(rd->xsch * render_size_factor); - operation->set_new_height(rd->ysch * render_size_factor); + operation->set_new_width(int(math::round(rd->xsch * render_size_factor))); + operation->set_new_height(int(math::round(rd->ysch * render_size_factor))); converter.add_operation(operation); converter.map_input_socket(input_socket, operation->get_input_socket(0));