Commit graph

668 commits

Author SHA1 Message Date
Olivier Goffart
8850959a2c Rename the backend feature flags 2022-09-07 17:11:57 +02:00
Olivier Goffart
e708f5c903 femtovg backend: fix the cursor position when the text ends with '\n'
Fixes #1318
2022-09-07 15:25:13 +02:00
Simon Hausmann
9e1bb1044c Clean up from-event-loop callback handling
Join wrapping call site and implementation.
2022-09-07 12:03:37 +02:00
Simon Hausmann
8b728df021 Don't panic when calling hide() and request_window_properties_update() on the wasm interpreter generated instance
Similar to commit 0fe29cd196 we need
to wrap access to the event loop :(

hide() is directly exposed in public API,
request_window_properties_update() will be called from outside the event
loop when we expose create_with_existing_window() for the interpeter to
re-use the canvas (which calls set_component on the window).
2022-09-07 12:03:37 +02:00
Olivier Goffart
b2c1d89e2f Fix compile when only the renderer-software is enabled 2022-09-07 11:06:51 +02:00
Simon Hausmann
b78b6ab723 Fix non-SVG images with transparency being rendered incorrectly in WASM builds
Commit 05b16bed89 introduced an exception
for SVGs images to treat them as premultiplied, but commit
3ef35c5ef9 accidentally applied the flag
to all HTML images, which is wrong.
2022-09-07 10:15:27 +02:00
Olivier Goffart
b3605cb4ec Fix errors and warnings in the wasm build 2022-09-07 10:13:58 +02:00
Olivier Goffart
6ede77436b api: Return an error from invoke_from_event_loop and quit_event_loop 2022-09-07 10:13:58 +02:00
Tobias Hunger
d880ef8eb5 api: Remove software-renderer feature 2022-09-07 10:11:11 +02:00
Tobias Hunger
639dcaf702 api: Rename module swrenderer to software_renderer
Also rename the `swrenderer` feature to `software-renderer`.
2022-09-07 10:11:11 +02:00
Simon Hausmann
6b2968c067 janitor: fix warning in wasm build
Remove unnecessary parentheses as suggested by the compiler.
2022-09-07 09:01:59 +02:00
Olivier Goffart
4706d529e2 Rename BUFFER_COUNT to MAX_BUFFER_AGE
and remove the default value from the SoftwareRenderer
2022-09-06 18:30:45 +02:00
Olivier Goffart
88d231f3ec Move the testing module from away from public api
move it the testing backend
2022-09-06 17:27:15 +02:00
Simon Hausmann
7967bf1ab0 Replace the internal WindowHandleAccess trait with a helper function on WindowInner
The reversal of ownership removes the need for the glue trait in the
publicly visible API.
2022-09-06 16:17:06 +02:00
Olivier Goffart
594131a7ea winit: Enforce the min/max size in the WindowBuilder and set size again for wasm
In previous version, we were setting the constraint with wasm after
the window was shown, but this is no longer the case because we delay
the window creation by an iteration of the event loop.
Now should apply the constraint before showing the window.

But on wasm, we also must manually enforce these constraint because the
size given to the WindowBuilder is not applied
2022-09-06 14:23:58 +02:00
ogoffart
05a49da906 Bump version number to 0.3.0 2022-09-06 13:00:22 +02:00
Simon Hausmann
5fe212f459 Make sure that skia_backend_opengl is always set on Linux 2022-09-05 14:07:27 +02:00
Simon Hausmann
3a1817de3f Skia: Make it possible to explicitly select the OpenGL backend of Skia
When opting into the Skia renderer, we default to metal on macOS and D3D on Windows.
However if you want to develop a cross-platform application with Skia and
for example rely on OpenGL to be able to implement an OpenGL underlay or overlay,
then we need the ability to explicitly opt into skia's GL renderer.

cc #1445
2022-09-05 14:07:27 +02:00
Simon Hausmann
3ebdb1b86d Add debug info about the Skia back buffer color depths
Include the number of bits per pixel in the existing output
2022-09-05 13:53:04 +02:00
Simon Hausmann
7323e0b93d Bump Skia version to 0.54
This release upgrades to Skia milestone 105 and  includes binaries for
the new windows-textlayout-d3d-opengl configuration that is available as
opt-in.
2022-09-05 11:27:30 +02:00
Olivier Goffart
3f1324cc61 Allow to run the software backend without the femtovg backend 2022-09-02 16:38:35 +02:00
Simon Hausmann
7e5de3d5d3 Remove use of euclid types and tags for logical/physical position and size in the public API
Instead provide our own types.
2022-09-02 11:05:53 +02:00
Simon Hausmann
85461d380d Remove euclid from the public re-export of the Slint crate 2022-09-02 11:05:53 +02:00
Olivier Goffart
e0f1fdf298 Rgb565Pixel: remove color accessor, add conversion to Rgb8Pixel
Closes #1540

(Went or Rgb8Pixel instead of color, because color can have alpha)
2022-09-01 13:58:38 +02:00
Olivier Goffart
fcca38e0f6 Rename set_event_loop_quit_on_last_window_closed to remove EventLoopQuitBehavior
For the winit backend, also make the function work after a call to run()
2022-09-01 12:08:05 +02:00
Simon Hausmann
c1dbf47d15 Fix appearance of drop shadows with Skia
Similar to commit 957186acb7 we need to take the blur into account in the box shadow image:

We add blur margins around the entire image, but we also need to start drawing at (blur, blur) instead of (0, 0).
The same offset needs to be subtracted again when drawing the cached image.
2022-08-31 11:36:04 +02:00
Simon Hausmann
7fd0af8b63 Fix box shadow not rendering correctly when using scale factors != 1
Despite the blur being an abstract float, in reality in femtovg as well
as Skia it's a pixel radius. Commit
1a8a295e38 removed the scaling to physical
pixels, which was wrong.  This restores it and along with it the same
appearance as before.
2022-08-31 11:36:04 +02:00
Simon Hausmann
9338d31535 Remove the use of euclid types from the software renderer public API
Closes #1538
2022-08-31 09:23:38 +02:00
Olivier Goffart
b9c2dec922 API: seal the WindowAdaptor trait
And hide most of its functions in the sealed trait.
2022-08-30 22:21:24 +02:00
Simon Hausmann
0fe29cd196 Fix preview in online editor not updating when making changes
Creating a new window requires access to an event loop instance. The
winit upgrade prevents us from creating multiple EventLoop instances.
Therefore we have to re-use the existing event loop instance, which is
only accessible from within the event handler.
2022-08-30 16:56:27 +02:00
Tobias Hunger
3430a13bf8 API cleanup: Remove quit behavior parameter from run_event_loop 2022-08-30 08:34:45 +02:00
Tobias Hunger
38350db9a0 Fixes pointed out by Olivier and CI 2022-08-29 16:53:47 +02:00
Tobias Hunger
10c3c9d16d Api cleanup: Rename some remaining platform abstractions to platform 2022-08-29 16:53:47 +02:00
Tobias Hunger
107e3ed2e2 janitor: Fix some typos 2022-08-29 16:53:47 +02:00
Tobias Hunger
88cf874d03 API cleanup: Rename create_window to create_window_adapter 2022-08-29 16:53:47 +02:00
Tobias Hunger
1e6ffeaa0f API cleanup: Rename PlatformWindow to WindowAdapter 2022-08-29 16:53:47 +02:00
Olivier Goffart
344f5c437b swrenderer: Move the DirtyTracking enum into a const generic
Closes: 1541
2022-08-29 14:13:55 +02:00
Tobias Hunger
53053683a1 API cleanup: Rename PlatformAbstraction to Platform 2022-08-29 13:26:36 +02:00
Tobias Hunger
13701b4b3f API cleanup: Rename set_paltrom_abstraction to set_platform 2022-08-29 13:26:36 +02:00
Olivier Goffart
1eaa4e1517 winit with swrenderer: don't call window.draw_contents twice.
The render function of the swrendrer already call that.
2022-08-29 11:42:10 +02:00
Olivier Goffart
4f0e2608d2 Sofware renderer: keep a Weak of the Window
Closes #1545

Not that `SoftwareRenderer::new()`  takes the Weak by value instead of
by reference, because coercing a reference to a `Weak` to a `&Weak<dyn>`
is not possible, while converting a Weak to a `Weak<dyn>` just works.
2022-08-29 11:07:05 +02:00
Olivier Goffart
f271ebbf21 Add an env variable to test the line by line renderer
This also test the 16 bit mode on the desktop
2022-08-27 15:05:06 +02:00
Simon Hausmann
4014ff8517 Revert "winit: Simplify GL context creation"
This reverts commit 7f2868b5a0.

This is still causing issues on Windows, as reported by tay64 on
Mattermost. This is a box (no vmware) with an ATI driver.

    Vendor: ATI Technologies Inc.
    Version: 4.6.14761 Core Profile Forward-Compatible Context 21.30.23.04 30.0.13023.4001
2022-08-26 16:49:10 +02:00
Simon Hausmann
e24ceb490f winit: Fix panic when shutting down event loop
If we (or the user) ends up calling hide() on a window after returning from the event loop, our
attempt at posting an event would panic in winit as we
try to create a new event loop instances.

Since Winit 0.27 a panic is raised when creating an event loop instance a second time.
2022-08-25 16:49:59 +02:00
Simon Hausmann
7f2868b5a0 winit: Simplify GL context creation
The bug in glutin for creating the GLES context has been fixed, so we can remove the workaround.
2022-08-25 16:49:59 +02:00
Simon Hausmann
be7947a321 Update winit and glutin 2022-08-25 16:49:59 +02:00
Simon Hausmann
a116f58b0c Decouple our femtovg dependency from glutin
This will allow updating glutin without femtovg
2022-08-25 16:49:59 +02:00
Simon Hausmann
94d5444105 Remove swrenderer feature dependency on i_slint_core from mcu bsp crate
Let `renderer-software` enable the API in `slint::platform::swrenderer` and optionally toggle winit support.
2022-08-25 12:54:52 +02:00
Simon Hausmann
d90b503a1c Move the mcu backend to become a board support helper crate for examples 2022-08-25 12:54:52 +02:00
Olivier Goffart
ab4ce29749 Add a Rgb565Pixel
So we don't have to depend on embedded_graphics just for that
2022-08-25 12:37:05 +02:00