Add a placeholder Rectangle into a layout whenever the last eleemnt is removed.
This makes sure we can drop into the Layout again.
Add infrastructure to find the parent element to ElementRcNode and move more
code into the ElementRcNode.
Can be preproduced on the esp-idf usecases p4 demo when going into the
combobox dans doing a long press in the popup.
Same fix as 4296ca2afe but for line by
line
Updated the version from 1.1 to 1.2
Renamed the header to "Slint Royalty-free Desktop, Mobile, and Web Applications License"
Added definition of "Mobile Application" and grant of right
Moved "Limitations" to 3rd section and "License Conditions - Attributions" to 2nd section
Added flexibility to choose between showing "MadeWithSlint" as a dialog/splash screen or on a public webpage
Moved the para on copyright notices to section under "Limitations"
We call fit_to with the source size (which is not scaled by the scale
factor) while the actual image is already scaled, so we need to adjust
for the difference between the texture size and the original size.
Also pass the scale_factor at compile time to the screenshot test
Only the hand-picked sensible things, not all of it ;-)
Also fix a few typos that cspell complained about when I
tried to commit and some formatting changes that cargo fmt
insisted on when commiting.
For tiling, we will need to know the actual source size in addition to
the scaling factor that can be different. So store the scaling factors
in the scene command, as well as an offset where to start.
This is more accurate in case of clipping and rotation.
For rotation that doesn't matter (appart from the fact that the testing
can now be more strict)
But for clipping this prevent glitches with partial rendering where it
would seem like the image are moving a bit by a pixel when it is redrawn
with a different clip
To reproduce, run the slide_puzzle with a SLINT_SCALE_FACTOR of 1.5 with
the software renderer.
The bug is that some text are rendered at some location, with an offset
of, say, 400.499999. And then the left and right side of the bounding
rectangle may be rounded differently and we may get to draw images that
are bigger than the glyph which cause panic. Fix that by ensuring we
never do that.
As discussed a few days ago, let's define rotation to be always
clockwise, as it is done in other graphics frameworks as well as our
own image rotation. This means changing the definition for the
software renderer. Also fixed docs for the enum in the linuxkms backend
that was wrong.
TODO:
- Polish the API
- Most screenshot test are failling because the rotation don't draw the
rounded rectangle exactly the same (that's because the border
rectangle algo is not perfect), and also scaled image are not pixel
perfect
The updated screenshot is because of a small change in the image
rendering algorithm that changes the rounding slightly.
and their related name.
Also move the component module in the item_Tree module
register_component -> register_item_tree
ComponentItemTree -> ItemTreeNodeArray
For #3323
Rationale from that issue:
Right now, we use the term `component` in the Slint language and in the compiler to be a a tree of elements that can be used as an element in a .slint file.
The term is also currently used in the runtime as a tree of runtime Items that are allocated together. (declared in ComponentVTable)
But there are no 1 to 1 mapping between a `component` in the slint language, and a runtime Component.
(for example, the items behind a `if` or `for` or `PopupMenu` are in a different runtime component. And `component` declared in Slint are often inlined)
So we should rename the internal runtime `Component` to `ItemTree`
The currently public `slint::ComponentHandle` wraps the "root" of the ItemTree, but that's ok because it is generated from a .slint `component`, so it doesn't change name
Implement the partial rendering with winit and our software renderer.
When the background is not opaque, we must still initialize all the
pixel with 0 otherwise we blend over the previous frame.
(That wasn't visible before because the buffer was always empty)
The cursor is loaded by the window adapter from the cache. When it's
loaded the first time, its format will be Svg, so we convert it to a
pixel buffer. That way the skia backend can convert it on first draw
into a skia_safe::Image and replace the cache entry with the backend
storage variant.
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
```