Commit graph

162 commits

Author SHA1 Message Date
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
Tobias Hunger
f3feab1267
Implement ptr_eq for VWeak and PartialEq for Items (#976)
* Implement ptr_eq for VWeaks

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2022-02-21 17:45:18 +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
Simon Hausmann
b482105402 Bump femtovg, fontdb, usvg and resvg dependencies
This re-aligns the ttf-parser and rustybuzz dependencies in the GL
backend. There's still one other version of ttf-parser pulled into the
compiler due to fontdue, but that's minor.
2022-02-21 09:10:11 +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
Simon Hausmann
f912ec7e6b Fix scaling of glyphs and improve type safety in the MCU backend
The code was mixing logical and physical sizes, causing glyphs being
doubly scaled down. Instead, this patch introduces:

 * Physical* and Logical* euclid length/size/rect aliases
 * some extraction traits for getting the scalars in rects/sizes as lengths (until euclid has them
built-in)
 * wrapper traits/types for safely extracting the physical font metrics the
 compiler generates (i16)
 * Fix a bug in the text height calculation where we failed to take the
   descent into account
2022-02-17 15:07:57 +01:00
Simon Hausmann
3af7b6f323 Fix simulator build 2022-02-17 15:04:18 +01:00
Simon Hausmann
07da5c1c36 janitor: Fix license headers 2022-02-15 15:55:41 +01:00
Simon Hausmann
bd2a62b0c2 Reduce memory consumption of scene items further
Move the specific data out of SceneItem into separate vectors. This makes the process of
sorting/moving scene items faster (less memory to move) and makes rectangle rich scenes
consume less memory.

This also paves the way for a "SimpleSceneTexture" vs. a more complex texture.
2022-02-15 15:52:24 +01:00
Simon Hausmann
e98375cfb9 Reduce memory consumption when sorting scene items
Instead of sort_by - which allocates a len / 2 buffer - use sort_unstable_by for
in-place sorting.
2022-02-15 15:52:24 +01:00
Simon Hausmann
ba9705010e Fix mismatch between logical and physical pixel sizes
The embedded glyphs use physical pixel sizes while the incoming font requests uses logical pixels.
2022-02-15 15:52:24 +01:00
Simon Hausmann
4424b0ecb5 Start stubbing out primitive glyph rendering in the mcu backend
This is still relatively heavy in terms of memory consumption, we
generate a scene item per glyph.
2022-02-15 15:52:24 +01:00
Olivier Goffart
267a73b41d MCU: Enable the i-slint-core/libm feature when compiling for the pico 2022-02-14 16:21:31 +01:00
Olivier Goffart
bc2ab0ce39 MCU: Make the panic handler not allocate memory
Also change the colors
2022-02-14 15:18:18 +01:00
ogoffart
ecd0fb7ecd Bump version number to 0.2.1 2022-02-10 16:25:28 +01:00
Tobias Hunger
58e7caafb0
Fix LICENSES symlinks 2022-02-09 17:05:47 +01:00
Tobias Hunger
4230ac2572
Update copyright information to reflect name change
Also run resue over the codebase and fix complaints from that tool.
2022-02-09 10:27:47 +01:00
Simon Hausmann
7e30bb5f93 Fix two build warnings in the mcu backend 2022-02-08 10:18:01 +01:00
Olivier Goffart
1425ef63de Change the Url from sixtyfps.io to slint-ui.com
Also, change the URL of the logo in the docs
2022-02-08 08:52:46 +01:00
Olivier Goffart
00ff5e21a7 Update git repository URL 2022-02-08 08:26:21 +01:00