Commit graph

1507 commits

Author SHA1 Message Date
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
Tobias Hunger
a8756119eb Update internal/backends/gl/event_loop.rs
Co-authored-by: Olivier Goffart <olivier@woboq.com>
2022-02-16 12:09:03 +01:00
Tobias Hunger
d443481dee Send less key events from the GL backend
When "combining" information from winit's ReceiveCharacter and
KeyboardInput events, then do not create a second KeyPress event
when the KeyboardInput contained a control character.

This makes us not send duplicate events for `Tab`, but leaves the
handling for e.g. `Ctrl-C` unchanged.
2022-02-16 12:09:03 +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
c954ebf861 Test: enable the jpeg feature on the image crate
Since the cat picture is now in jpeg, we need to be able to decaode it
from the tests.
Luckily on the CI this works fine beacause we do a full cargo test that
build all the crates including the gl crate that has the jpeg format enaabled,
but if we try to compile the test with limited feature set, it wouldn't be available.
2022-02-15 15:12:13 +01:00
Olivier Goffart
efd6c63b8e Fix animation in the flickable
This is a regression since the introduciton of iteration_count which defaults
to 0 for animation started programatically

Also add a test.

Fix #951
2022-02-15 12:02:27 +01:00
Tobias Hunger
9fefc03bcc Reuse compliance cleanups (found by the new tooling) 2022-02-15 11:34:37 +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
Simon Hausmann
b65b66b871 Replace use of SFPS prefix in Qt wrapper functions 2022-02-14 16:17:55 +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
Simon Hausmann
260c09199a Fix rendering of png images with alpha in the online editor
It appears that HTMLImageElement is not guaranteed to provide a texture with pre-multiplied alpha. Let's limit this assumption to
SVGs.
2022-02-09 12:41:20 +01:00
Simon Hausmann
c51cc35544 janitor: silence compiler warning
If `fill_text` fails we have different problems :-)
2022-02-09 11:01:18 +01:00
Simon Hausmann
75bb4ac3df Improve error handling when we fail to create a WebGL context in the browser
Bump the femtovg dependency to ensure we get the fix for error detection on the renderer side
and handle it in the GL backend side by rendering text to the 2D canvas, followed by a panic.

This was moved up to before the resize handler can be installed, as that would end up
clearing the canvas when resizing.

A message on the 2D canvas was chose over an alert message box, as the latter
is rather intrusive and would be a nightmare if many of them popped up
when viewing our docs with a browser
configured that way.
2022-02-09 10:53:52 +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
Olivier Goffart
d04a8653a5 Fix native style selection after crate name change 2022-02-09 09:34:16 +01:00
Simon Hausmann
05b16bed89 Prospective fix for rendering of Slint logo as SVG in the wasm demos and online editor
resvg produces an image with pre-multipled alpha and anecdotal evidence suggests that HTMLImageElement on an SVG does, too.

This might need further restriction for the HTMLImageElement case just to svg, but
let's try this.
2022-02-08 17:39:10 +01:00
Simon Hausmann
be5b8c1c46 Rename the backend-gl feature to backend-gl-all 2022-02-08 14:47:25 +01:00
Simon Hausmann
48f3f47401 Rename the x11 and wayland features to backend-gl-x11/wayland 2022-02-08 14:47:25 +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
Simon Hausmann
6997876143 Add support for falling back to SIXTYFPS_BACKEND
If `SLINT_BACKEND` isn't set but `SIXTYFPS_BACKEND` is.
2022-02-07 16:43:09 +01:00
Tobias Hunger
de4e195280
Rename internal crates and add a README.md to them
The README.md contains the warning that used to be in lib.rs.

Add README.md files to all internal crates

... pointing to the official public crate to use instead.

Rename internal crates

fixup: README files

fixup rename
2022-02-07 13:12:48 +01:00
Simon Hausmann
125b90a64b Merge remote-tracking branch 'origin/master' into wip/rename
Conflicts:
	api/cpp/cbindgen.rs
	api/cpp/include/slint.h
	examples/CMakeLists.txt
	examples/imagefilter/Cargo.toml
	examples/plotter/main.rs
	internal/backends/mcu/lib.rs
2022-02-04 16:47:20 +01:00
Simon Hausmann
8959eac3d0 Add rendering callbacks to sixtyfps::Window
This API allows specifying a callback that will be invoked when setting
up graphics (great for compiling shaders), before rendering a frame (but
after the clearning of the surface background), after rendering a frame
(before swapbuffers) and when releasing graphics resources.
2022-02-04 15:41:53 +01:00
Simon Hausmann
378483037c Bump image and femtovg dependencies 2022-02-04 10:00:00 +01:00
Olivier Goffart
8f51e8feda Fix the code that selects the native style by default
The env variable was lower-cased while renaming
2022-02-03 14:56:56 +01:00
Tobias Hunger
03f78af987
Update some .60 to .slint 2022-02-02 17:29:40 +01:00
Tobias Hunger
1534f87e30
Change authors to Slint Developers 2022-02-02 16:21:34 +01:00
Tobias Hunger
2b55c488ca
Rename sixtyfps to slint in internal 2022-02-02 16:16:55 +01:00
Olivier Goffart
1586235478 Rename SixtyFPSWidget 2022-02-02 14:29:30 +01:00
Olivier Goffart
c00884d5a2 Rename SixtyFPSElement 2022-02-02 14:29:30 +01:00
Tobias Hunger
1a0a495bc5
Rename environment variables 2022-02-02 13:35:07 +01:00
Tobias Hunger
cc3994b58d
Rename rust API 2022-02-02 13:26:35 +01:00
Olivier Goffart
69908a32b6 Rename sixtyfps-viewer -> slint-viewer 2022-02-02 13:19:40 +01:00
Simon Hausmann
fcf59f3793 Rename the C++ header files 2022-02-02 13:07:26 +01:00
Simon Hausmann
7d297da2fc Rename the sixtyfps C++ namespaces 2022-02-02 12:11:27 +01:00
Simon Hausmann
c846633708 Rename C ffi functions 2022-02-02 11:12:34 +01:00
Simon Hausmann
b1a70f9e58 Rename the SixtyFPS CMake interface 2022-02-02 09:58:26 +01:00
Simon Hausmann
9494068201 Rename the sixtyfps-rendering-backend-selector crate 2022-02-01 18:06:49 +01:00
Simon Hausmann
f06c69bc2f Rename the sixtyfps-rendering-backend-mcu crate 2022-02-01 18:04:46 +01:00
Simon Hausmann
2e04b3c8b3 Rename the sixtyfps-rendering-backend-gl crate 2022-02-01 18:04:38 +01:00