Commit graph

100 commits

Author SHA1 Message Date
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
Simon Hausmann
db54da2064 mcu: Don't panic when opening popups
Implement popups as inline components. The dirty region handling however
is still missing when closing a popup.
2022-04-08 16:46:12 +02:00
Simon Hausmann
70f3f50359 mcu: Add support for automatic font size detection
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.
2022-04-08 15:11:26 +02:00
Simon Hausmann
335502be3f Upgrade to femtovg 0.3.4
The GL optimizations are in this release now and this also fixes #843
2022-04-07 13:56:23 +02:00
Simon Hausmann
143167f82f
Bump up the SPI frequency for the display controller (#1115)
* Bump up the SPI frequency for the display controller
2022-03-30 15:40:59 +02:00
Lukas Jung
b6171530ab replace text_input_position_for_byte_offset with text_input_cursor_rect_for_byte_offset 2022-03-28 10:07:07 +02:00
Olivier Goffart
cf49568373 Compiler: make the image processing an enum in the config 2022-03-24 13:16:21 +01:00
Olivier Goffart
41b20fdd59 MCU build system: pass information about embedding images and glyph to the compiler
... using metadata from the build script send with the DEP_I_SLINT_BACKEND_MCU

Saves two environment variable that we don't have to pass
2022-03-24 13:16:21 +01:00
Olivier Goffart
5fb41f92d1
Update MCU readme a little 2022-03-23 11:15:44 +01:00
Olivier Goffart
eb9092ba15 MCU: run the timers 2022-03-18 18:51:29 +01:00
Olivier Goffart
ed60dcb6b5 MCU pico: increase heap size
So it doesn't do out of memory with the printerdemo_mcu in normal
usage
2022-03-18 09:33:23 +01:00
Olivier Goffart
8f4df47b1c MCU pico: adjust the touch driver thresholds
The Press and Release threshold where inverted.

Also increase the Flickable threshold because the precision of the
touch screen is too low, and if the threshold is too small, we
can't click on things inside a Flickable
2022-03-18 09:33:16 +01:00
Olivier Goffart
66fa1fcfee
MCU readme: remove the scale factor
The new demo don't need it
2022-03-17 16:04:38 +01:00
Olivier Goffart
42947b3fe2 MCU renderer: Fix border radius bigger than the item 2022-03-17 07:34:23 +01:00
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