This requires us to flash the cache before swapping the frame buffer pointer.
With slide puzzle span drawing with image tiles goes from ~100ms down to ~50ms,
and theme switching between simple and berlin from ~140ms to ~72ms.
This is with the line renderer.
When using repeaters - like in the slide puzzle - and during renderer a component
gets deleted, we call free_graphics_resources and try to free
the dirty rectangle list in the partial renderer cache. At that point the cache is
already mutably borrowed, which causes a panic.
As remedy, apply the mutable borrow more fine grained and not right when calling
render().
The mcu simulator builds i-slint-core with the std feature, but debug_log maybe
used in #[no_std] contexts, so we need to use a re-export rather than rely on std
being present
The slide puzzle makes use of the source-clip-* properties and that unveiled three issues:
* For the scale factor from image space to physical pixel space (sx/sy),
use the source clip size, as we're only drawing those
pixels. That means that the call sites of draw_image_impl need to pass the
correct original image size if there is no source clip.
* Similarly, the scaled_clip is in image coordinates, but needs to be relative to the source-clip-x/y
* The geometry for the target rectangle on screen
must originate at (0, 0) so that the apllication of
sx/sy only changes the size.
With the simulator this still requires a regular main() entry point.
For some reason a feature test for i-slint-backend-mcu/simulator doesn't work,
but it works with the local feature.
Separate the text shaping functionality from font metrics by having a
FontMetrics trait next to the TextShaper. AbstractFont is the combining
super trait. This allows eliminating the font height member from
TextParagraphLayout and improving the overall naming of fields and
types.
Finally, this prepares the API for composability of TextShaper for font
fallback handling.
Replace the abstract glyph trait with a glyph struct. That way the text
layout code can operate properly on a struct with fields, instead of on
functions on a trait (some of which returning a mutable reference). The
input is a glyph with offset, advance, etc. - everything needed for the
layout and the output is a position along with the platform specific
glyph data.
Sometimes, BorderRectangle clips can get negative if the intersection
of two rectangle leads to a rectangle that is smaller than the previous
rectangle, but because of floating point error while computing the max
position, the resulting clip may still be negative.
Add a small value to compensate that error
When closing a popup, notify the platform window, so that the mcu
backend can remember that region and start the dirty region with it.
Also, free all the rendering cache items of deleted items, to avoid accidental re-use
when re-opening a popup.
Continue to support specififying logical font sizes in the compile step
via SLINT_FONT_SIZES, but additionally look for Text/TextInput/Window elements
and extract any constant font sizes
found.
This makes it work out of the box with the printer demo.