Commit graph

186 commits

Author SHA1 Message Date
Olivier Goffart
3e7e575f41 Implement the length traits with generics 2022-03-17 07:34:23 +01:00
Olivier Goffart
8f67b1170c MCU renderer: fix artifact when drawing clipped border rectangle
(It would sometimes miss a couple pixel for small clips otherwise)
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
14a8a6faa2 MCU: improve touch driver
- use both z1 and z2 to compute the pressure because these number
   depends on the temperature so we need to use both
 - check the pressure at the end of the reading in case it was
   released when reading
 - have different pressure threshold when the button is already
   pressed so we avoid emitting a release too early
2022-03-16 13:04:42 +01:00
Olivier Goffart
8cae8b9602 MCU: Make the debug show more lines 2022-03-16 13:04:42 +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
2260681075 Janitor: bump rp-pico dependency 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
f6b484ca91 Implement glyph_for_char in mcu font to support elision 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
089dc47b66 Adapt the mcu font handling to the glyph trait based textshaper 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
a555ad780a Adapt to TextShaper trait changes 2022-03-10 10:51:32 +01:00
Simon Hausmann
b9a7977ad3 Fix glyph cluster offset in the MCU pixel font "shaping"
Always specify a byte offset, even for absent glyphs.
2022-03-10 10:51:32 +01:00
Simon Hausmann
35644d4026 Implement text_size for the mcu backend with line breaks 2022-03-10 10:51:32 +01:00
Simon Hausmann
bf08ed2847 Begin implementing text layout traits 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
ogoffart
7b50791db4 Bump version number to 0.2.2 2022-03-10 08:48:33 +00:00
Olivier Goffart
5eecdb1ae7 MCU simulator: don't return from the event loop 2022-03-09 20:49:46 +01:00
Olivier Goffart
9259413ec2 MCU cleanup
- Attempt to unify a bit the features so we have less #[cfg] in the demo
 - Add a README
2022-03-09 20:49:46 +01:00
Olivier Goffart
964670bc88 MCU renderer: refactor the drawing code in its own module 2022-03-09 08:34:28 +01:00
Simon Hausmann
e48e39bf61 Fix support for partial renderiung in the simulator
Keep a framebuffer around and re-create it if the size changes. Also
re-create the partial rendering cache then.
2022-03-07 21:14:50 +01:00
Simon Hausmann
7b721e15f7 Remove debug pixels from the simulator output 2022-03-07 21:14:50 +01:00
Olivier Goffart
fa22a90312 MCU: Improve a bit the touch driver for the XT2046
- Read the Z value and only mark the press when there is enough pressure
 - Callibrate with some value that works for me for the max and min coordinate
2022-03-07 14:23:08 +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
Olivier Goffart
0027cab273 cargo fmt 2022-03-03 14:00:13 +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
3a50755cab
Add MCU board config setup (#1006)
* Add MCU board config setup

Let the mcu backend provide the link flags via I_DEP_* and the
Slint-build crate now offers a function to allow printing Slint-specific
rustc flags.
2022-03-03 13:31:40 +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
n-raine
beda5aca07 Add dark style detection support for GL backend
With the help of dark-light crate this is now exposed as dark-style
boolean property in NativeStyleMetrics.

Co-authored-by: Olivier Goffart <olivier@slint-ui.com>
Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2022-03-01 16:41:20 +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
48a1b668b6 MCU: mark the scale_factor as a constant property 2022-02-21 20:11:59 +01:00