Fix: Wrong extra half-pixel width of VSE preview

While implementing preview snapping, I noticed an oddity with snapping
videos to view bounds, and found that the preview window's total v2d has
half a pixel of extra padded width.

The bug was introduced in fb5e2f5610, which added `roundf` calls to
numerous areas in the blender code to replace instances of adding `0.5`
and then casting to an integer.

One mistake in the patch was fixed shortly after in d122911d10, but the
other mistake has been unfixed until now. This fixes the glitchy
behavior with preview snapping and is also small enough to add to 4.2
LTS.

Pull Request: https://projects.blender.org/blender/blender/pulls/123279
This commit is contained in:
John Kiril Swenson
2024-06-16 07:34:24 +02:00
committed by Aras Pranckevicius
parent 7b6ae7abbb
commit fca4318e3c

View File

@@ -1117,7 +1117,7 @@ void sequencer_draw_preview(const bContext *C,
/* Setup view. */
sequencer_display_size(scene, viewrect);
UI_view2d_totRect_set(v2d, roundf(viewrect[0] + 0.5f), roundf(viewrect[1] + 0.5f));
UI_view2d_totRect_set(v2d, roundf(viewrect[0]), roundf(viewrect[1]));
UI_view2d_curRect_validate(v2d);
UI_view2d_view_ortho(v2d);