Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
swr: Fix panic when drawing clipped text
In some case, when the clip is, eg on a 0.25 of a pixel, but the offset is 0.75, (such that the begining of the glyph starts at 0.5) difference in rounding in different computation can result in a width which is one pixel bigger than the source image. I couldn't reproduce this in a testcase, but this can be reproduced while resizing or scrolling through a TextEdit I think this fixes #2957 The panic fixed by this commit looks like this: ``` thread 'main' panicked at 'index out of bounds: the len is 131 but the index is 131', /home/olivier/slint/internal/core/software_renderer/draw_functions.rs:81:19 stack backtrace: 3: i_slint_core::software_renderer::draw_functions::draw_texture_line at ./internal/core/software_renderer/draw_functions.rs:81:19 4: <i_slint_core::software_renderer::RenderToBuffer<T> as i_slint_core::software_renderer::ProcessScene>::process_shared_image_buffer at ./internal/core/software_renderer.rs:1023:13 5: i_slint_core::software_renderer::SceneBuilder<T>::draw_text_paragraph::{{closure}} at ./internal/core/software_renderer.rs:1404:37 6: i_slint_core::textlayout::TextParagraphLayout<Font>::layout_lines::{{closure}} at ./internal/core/textlayout.rs:219:17 ```
- Loading branch information