Olivier Goffart
d2186593c0
Pass the ItemRc to each draw_function
...
So that it can be used as a key to the cache
2022-05-31 10:48:24 +02:00
Olivier Goffart
80830bbece
MCU: Refactor the renderer in a LineRenderer
...
The LineRenderer is going to be a public type which can be used
by the MCU board support to draw.
Right now, it is used by the old code
2022-05-23 16:40:34 +02:00
Simon Hausmann
38abeaec41
text handling: clean up font traits
...
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.
2022-05-16 08:21:14 +02:00
Simon Hausmann
93b5eda82e
text handling: simplify glyph data structure 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.
2022-05-15 12:03:29 +02:00
Simon Hausmann
b6e7db0221
Minor cleanup in the MCU text handling
...
Replace the use of Option for the associated glyph type with a
struct that can later implement a trait.
2022-05-15 11:50:00 +02:00
Olivier Goffart
1104ab73a0
Fix compilation with integer coordinate
2022-04-28 18:58:11 +02:00
Olivier Goffart
5a9c70307a
MCU: properly round the image source rect
...
to avoid artifacts with different (frational) clipping
2022-04-28 17:45:47 +02:00
Olivier Goffart
ad1936d2d2
Remove new_scene_rectangle indirection
2022-04-27 09:23:10 +02:00
Olivier Goffart
e41c15aef9
stm32h735g: Add support for double frame buffer and timing
2022-04-27 09:00:52 +02:00
Olivier Goffart
cc1aad8ce9
MCU: fix panic in the renderer
...
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
2022-04-12 16:12:41 +02:00
Olivier Goffart
8327ab3e52
MCU renderer: query the geometry of items we do not support
...
So that we can register dependencies and refresh when it moves, even
if we don't draw anything for them
2022-04-12 13:02:58 +02:00
Olivier Goffart
1b91158b46
corelib: allow to use i32 for coordinate instead of f32
2022-04-11 17:46:50 +02:00
Simon Hausmann
afb59cba29
mcu: fix popups not visibly closing
...
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.
2022-04-08 19:32:33 +02:00
Olivier Goffart
42947b3fe2
MCU renderer: Fix border radius bigger than the item
2022-03-17 07:34:23 +01:00
Olivier Goffart
8afee6b3ff
MCU renderer: implement image-fit
2022-03-17 07:34:23 +01:00
Olivier Goffart
ed3419ac0e
MCU renderer: Fix another rounding error
...
We need to use round_in() instead of cast() as cast() discard
too much data if both the x position and the width position are 0.5
then we loose one pixel of width
2022-03-16 10:36:17 +01:00
Olivier Goffart
b510c2f7a2
MCU: fix drawing clipped images
...
The computation of the coordinate was not correct. The coordinate was
turncated in the case of Image. And for Text, the image was drawn smaller
instead of being clipped
2022-03-15 15:15:45 +01:00
Olivier Goffart
b54b9bae61
MCU partial renderer: Actually do not draw items that are not in the dirty region
...
We computed the clip, but still generated span and even rendered the full
line for items that were meant to be clipped
2022-03-15 09:42:17 +01:00
Olivier Goffart
608211b0d6
MCU: Allow to use RGB565 for the draw buffer
2022-03-14 15:52:09 +01:00
Olivier Goffart
d7c998b649
Remove unused commented code
2022-03-14 11:50:05 +01:00
Olivier Goffart
bcb06e94c9
MCU renderer: fix clipping of rounded rectangle
...
We need to do the conversion from float to int after doing the
substraction or we might clip too much if the position is not
a round number
2022-03-11 20:39:54 +01:00
Olivier Goffart
b75e9a8cf3
Revert "MCU renderer: Do not call geometry() to avoid creating bindings on x and y"
...
This reverts commit dea0990fb1
.
Otherwise the dirty tracker don't register dependency on x and y
2022-03-11 15:27:47 +01:00
Olivier Goffart
dca597b9f1
MCU renderer: skip empty text early
2022-03-11 14:53:19 +01:00
Olivier Goffart
8038f6e6ea
MCU: don't draw clipped text
2022-03-11 14:53:19 +01:00
Olivier Goffart
dea0990fb1
MCU renderer: Do not call geometry() to avoid creating bindings on x and y
2022-03-11 14:53:19 +01:00
Olivier Goffart
ee3d375c12
MCU renderer: add performence counter for the dirty items
2022-03-11 14:53:19 +01:00
Olivier Goffart
cbed63f60d
MCU renderer: optimize the line processing step
...
Do all the things in-place so we do not need to allocate
2022-03-11 12:39:09 +01:00
Simon Hausmann
2e7f6f55a2
Adapt to simplier line layout callback signature
2022-03-10 10:51:32 +01:00
Simon Hausmann
7faabdbbbc
Adapt to changed text line layout API
2022-03-10 10:51:32 +01:00
Simon Hausmann
525d24fc49
Prospective build fix
...
Remove unused trait
2022-03-10 10:51:32 +01:00
Simon Hausmann
f57e9ef50c
Adapt to the TextShaper API changes in the mcu font backend
2022-03-10 10:51:32 +01:00
Simon Hausmann
9b9d6efdc8
Adapt the mcu text code to use glyph based layout callback
2022-03-10 10:51:32 +01:00
Simon Hausmann
66d12e3009
Implement draw_text in the MCU backend by means of i_slint_core::textlayout::layout_text_lines
2022-03-10 10:51:32 +01:00
Simon Hausmann
b27dc9109a
Clean up MCU font handling code a little
...
Dedicated a PixelFont struct to the combo of generic font and pixel-size matched glyphs.
2022-03-10 10:51:32 +01:00
Olivier Goffart
964670bc88
MCU renderer: refactor the drawing code in its own module
2022-03-09 08:34:28 +01:00
Olivier Goffart
f227bdaa35
MCU: rounded rectangles
2022-03-07 10:28:48 +01:00
Olivier Goffart
010be31f0c
MCU renderer: Don't put the rectangle colors in a separate vector
...
The index size is the same as the size of the Color
2022-03-07 10:28:48 +01:00
Olivier Goffart
5447722014
MCU renderer: Fix dirty region and popup window
...
We must first compute the dirty region on every component before
creating the scene that will depends on the dirty regions
2022-03-03 17:51:02 +01:00
Olivier Goffart
b2caa757e7
Partial renderer: Initial work
2022-03-03 14:58:48 +01:00
Simon Hausmann
f1dae75d53
Fix interpreter ffi build
...
Commit 738ac0dc01
increased the size of the ImageInner::StaticTextures variant,
which breaks the size assertions in the interpreter ffi build.
This changes fixes that by reducing the size of the ImageInner variant again by
moving all the fields into a separate struct.
2022-03-03 14:04:45 +01:00
Simon Hausmann
0316af5343
Add support for profiling in the mcu renderer ( #968 )
...
Profile different stages behind a slint_debug_performance cfg and feed the result into debug_log!
Co-authored-by: Olivier Goffart <olivier.goffart@slint-ui.com>
2022-03-03 13:34:47 +01:00
Simon Hausmann
738ac0dc01
mcu: scale images at compile time ( #966 )
...
Apply a scale factor to reduce the size of embedded images at compile
time.
2022-03-03 13:28:47 +01:00
Olivier Goffart
e3a33bd26a
MCU renderer: Fix pixel access
...
We need to multiply by the bpp after the integer division
2022-02-24 10:52:43 +01:00
Olivier Goffart
ef33669c10
MCU: Don't add empty scene items
...
This fixes a division by zero.
2022-02-21 16:55:39 +01:00
Olivier Goffart
0998782402
MCU: Don't use f32 to compute the texture coordinate
2022-02-21 15:56:54 +01:00
Olivier Goffart
27f1e099ae
MCU: compile with just the std feature to test the Dummy backend on desktop
2022-02-18 11:52:54 +01:00
Simon Hausmann
a5ed38b43f
Make the position of the SceneItem a PhysicalPoint
...
... instead of two x/y physical lengths.
2022-02-18 10:39:24 +01:00
Simon Hausmann
df49ef1c78
Make the size of SceneItem a PhysicalSize
...
... instead of two separate physical lengths
2022-02-18 10:39:16 +01:00
Simon Hausmann
dae68ae9d3
Use a PhysicalSize for the SceneTexture's source dimensions
...
... instead of two separate lengths.
2022-02-18 10:39:07 +01:00
Simon Hausmann
02dcf1173b
Simplify conversion from physical to logical pixels in the mcu backend
...
It turns out that after casting to the f32 variant we can divide the by scale factor instead of multiplying
with the inverse.
2022-02-17 15:07:57 +01:00