Fix: VSE strip thumbnails sometimes go 1px outside of boundary #123119

Merged
Aras Pranckevicius merged 1 commits from aras_p/blender:vse-thumb-crop-fix into blender-v4.2-release 2024-06-12 12:43:13 +02:00

1 Commits

Author SHA1 Message Date
fac39b3a01 Fix: VSE strip thumbnails sometimes go 1px outside of boundary
Some checks failed
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
The VSE timeline strip thumbnail code seems to have at least two issues:

Sometimes the thumbnail would go 1px outside of the right side
of the strip itself. This seems to be caused by floating point
inaccuracy where current thumbnail position is tracked in "fractional
timeline frames" instead of some integers like pixels. The last, often
clipped, thumbnail would thus spill over outside of the strip.
Fixed this by making sure the last pixel column of the strip is not
included into thumbnail drawing (pointless to draw there since
it is always covered by strip border).

Another problem was that the first thumbnail of the strip was often
incorrectly clipped and the last pixel from it was removed, and so
it was leaving a pixel gap between first and other thumbnails.
This was under "Set the clipping bound to show the left handle moving"
comment, where due to inclusive range check it was always causing
the "clipped" part to be set to true for the first thumb.

Also while trying to untangle all of this, moved variables closer
to their usage. Some of them were only used inside the thumb loop
but were declared in whole function (probably coming from when it was
C code).
2024-06-12 11:57:00 +03:00