Simon Hausmann
93142bf417
winit: Always make skia-opengl
available
...
The Skia OpenGL renderer is portable and sometimes esp. on Windows produces better results, so make it always available as an open if `renderer-skia` is enabled. `renderer-skia-opengl` continues to select the GL renderer as default.
2024-01-24 18:20:04 +01:00
Simon Hausmann
f5bf6e5dc0
Skia: Clean up pre present notify callback API
...
Move this back out of render() again and make it stateful in the renderer. Reduces the amount of book-keeping required and it's always the same callback anyway.
2024-01-04 10:35:09 +01:00
Simon Hausmann
3069e8e503
Add support for frame throttling on Wayland
...
Use winit's pre_present_notify() API to allow for the compositor to throttle rendering.
Fixes #4200
cc #1695
2024-01-04 09:21:53 +01:00
Simon Hausmann
f941357337
Upgrade to glutin 0.31.1 to fix window transparency on macOS
...
Fixes #3760
2023-10-30 08:58:25 +01:00
Olivier Goffart
3deb620953
Skia: disable skia software renderer for android
...
softbuff doen't compile on android
2023-10-26 14:52:07 +02:00
Simon Hausmann
9884b14ee0
Make GL rendering work again on macOS
...
Disable transparency support to work around https://github.com/rust-windowing/glutin/issues/1640
2023-10-25 08:43:42 +02:00
Simon Hausmann
30c810be00
winit: Propagate errors when winit fails to initialize the event loop
...
For the backend selector, this means that when a backend is selected explicitly,
and initialization fails, don't try `create_default_backend()` but
propagate the error.
For the Rust code generator, propagate the first ensure_backend()
errors. Any subsequent onces (unlikely, since the first thing any
public new() calls is ensure_backend) will unwrap.
2023-10-24 15:47:08 +02:00
Olivier Goffart
58e5d62a02
Winit port: Fix wasm build
...
Port everything from instant to web-time
2023-10-23 14:22:48 +02:00
Olivier Goffart
12cd8e71f1
WIP: some polish over the winit update to 0.29
2023-10-23 14:22:48 +02:00
Simon Hausmann
3855de0794
winit: Add support for selecting Skia's software renderer directly
...
That might be useful for debugging
2023-10-23 13:55:23 +02:00
Simon Hausmann
f7d666b948
winit backend: clean up renderer creation
...
Pass around a factory function to create the renderer,
instead of a factory function that creates the window adapter. The adapter is
always the same anyway, and this way the WinitWindowAdapter's new
also doesn't have to be generic.
This also prepares for adding a second skia renderer
constructor later to select a specific variant.
2023-10-23 13:55:23 +02:00
Olivier Goffart
4446a17b24
Skia renderer: reset the surface when the app is resumed on android
...
Part of #3430
2023-09-21 17:23:08 +02:00
Simon Hausmann
fd123b27bd
Default to vsync for OpenGL rendering
...
Fixes #3516
2023-09-20 12:00:04 +02:00
Olivier Goffart
46ec7875ed
Software renderer: partial rendering with winit and fix non-opaque background
...
Implement the partial rendering with winit and our software renderer.
When the background is not opaque, we must still initialize all the
pixel with 0 otherwise we blend over the previous frame.
(That wasn't visible before because the buffer was always empty)
2023-09-13 16:08:57 +02:00
Olivier Goffart
6e1132726a
winit-sw: Loop over the buffer instead of using indices
...
It is possible that softbuf allocate a larger buffer than in needs?
Prospective fix for #3406
2023-09-06 16:04:03 +02:00
Olivier Goffart
95b6eda10b
Make sure PLatformError is Send+Sync as it is needed for anyhow
2023-08-31 20:52:10 +02:00
Simon Hausmann
65f9e6f1eb
Move the OpenGLInterface back to the FemtoVG renderer
...
At the moment it's only needed there, so let's
have it there and move it to core later if the need arises.
2023-08-28 13:33:15 +02:00
Simon Hausmann
6dd60113f1
Add some information about the display handle when glutin::display::Display::new() fails
...
The error from glutin is just a string.
cc #3312
2023-08-21 17:16:55 +02:00
Simon Hausmann
868173cc20
Disambiguate the type name SkiaRenderer
...
- Use WinitSkiaRenderer for the adapter in the winit backend (similar to WinitSoftwareRenderer)
- Use SkiaItemRenderer for the impl of the ItemRenderer trait
2023-07-31 17:11:43 +02:00
Simon Hausmann
f60b2ebde9
Add slint::platform::OpenGLInterface
...
This allows for the use of the FemtoVG renderer but delegate the GL implementation to the user.
2023-07-27 16:48:57 +02:00
Simon Hausmann
3b29bfe2f6
Change OpenGLContextWrapper to return a generic Error
...
This is in preparation for making the trait public.
2023-07-27 16:48:57 +02:00
Simon Hausmann
4e7ebdceba
Improve zero-size OpenGL surface handling
...
- Use NonZeroU32 in the OpenGLContextWrapper interface (correct API for the future)
- Don't render zero sized windows with the software renderer and FemtoVG
2023-07-27 16:48:57 +02:00
Olivier Goffart
49485dbf7d
SoftwareRenderer: add API to construct and change the buffer type
2023-07-27 14:44:28 +02:00
Simon Hausmann
f15bc6147e
Simplify FemtoVG and Skia renderer APIs: remove resize()
...
We can convey the new physical window size from the run-time
through the private renderer API
when a window resize event is dispatched.
2023-07-25 19:33:26 +02:00
Simon Hausmann
7649153b3e
janitor: silence rust warning
2023-07-25 17:58:46 +02:00
Simon Hausmann
7d136b6568
Remove the window parameter from the render() function of all the renderers
...
This makes for a slimmer API and instead we can create the renderer <-> window association
behind the scenes ourselves,
in set_component.
2023-07-25 17:28:08 +02:00
Simon Hausmann
507428b03e
Simplify FemtoVG and Skia renderer API ( #3153 )
...
Fold show() into the first time render() is invoked,
and hide() into the Drop implementation.
2023-07-25 17:17:40 +02:00
Aurindam Jana
5a4a7fee63
Update royalty free license to 1.1 ( #2994 )
2023-07-10 10:12:11 +02:00
Tobias Hunger
8345c6cd79
Do automatic clippy fixes
2023-06-28 14:22:30 +02:00
Simon Hausmann
a181fe0196
Port to softbuffer 0.3.0
2023-06-22 08:11:16 +02:00
Simon Hausmann
7c36121082
Sanity check that the OpenGL context we have provides what we need
...
On Windows without OpenGL, wgl might succeed all the way, but get_proc_address will fail.
2023-06-16 12:52:15 +02:00
Olivier Goffart
11dea135f7
Domain: slint-ui.com -> slint.dev
2023-06-16 10:55:08 +02:00
Aurindam Jana
039e54a5de
Add royalty free license to files except examples and docs ( #2888 )
2023-06-15 11:20:50 +02:00
Simon Hausmann
fb1d37286f
Clean up the Skia renderer API
...
Accept display and window handles with life time, instead of &dyn
HasRaw*Handle.
2023-06-07 12:20:57 +02:00
Simon Hausmann
af6b49a47d
Simplify FemtoVG renderer API
...
For wasm builds, just require the canvas element.
2023-06-07 11:30:43 +02:00
Simon Hausmann
2b891b6097
winit: Remove the html canvas element from the GL context
...
It's not needed anymore. We can pass the canvas
element to the renderer once
and then we don't need it anymore.
2023-06-07 11:30:43 +02:00
Simon Hausmann
ff2a4ecb4e
Cleanup: Use winit's HTML Canvas accessor instead of our own
2023-06-07 11:30:43 +02:00
Simon Hausmann
599d86e4e1
Simplify Skia renderer API
...
Remove the size argument from render().
2023-05-26 10:46:59 +02:00
Simon Hausmann
f9b8592eba
Simplify FemtoVG Renderer API
...
Remove the size argument from render().
2023-05-26 10:46:59 +02:00
Simon Hausmann
879e09922f
Begin renderer API cleanup: Remove size argument from WinitCompatibleRenderer::render()
...
We would pass `physical_size_to_slint(&self.winit_window().inner_size())`, which is
identical to `slint::Window::size()`, which
calls `size()` on the WindowAdapter, which
returns the above.
2023-05-26 10:46:59 +02:00
Simon Hausmann
fe4a434ce4
Remove the WindowAdapter from the renderer constructor
...
This allows disentangling the native window creation from the renderer
creation, which is rather ugly and complicated on the C++ side.
2023-05-21 14:40:43 +02:00
Simon Hausmann
20d206dc6b
Mark the OpenGLContextWrapper trait as unsafe
...
There's on guarantee that the pointers returned by get_proc_address are
always valid. Our implementation might, but since the trait isn't
sealed, somebody else could implement it badly.
2023-05-17 09:01:02 +02:00
Simon Hausmann
9c1e5efb43
Clean up FemtoVG renderer interface
...
Accept the OpenGL context as trait impl. This means we can also move the rendering notifier
into the femtovg renderer create and get rid of
the proxy Renderer trait impl.
2023-05-17 09:01:02 +02:00
Simon Hausmann
12e6e322d9
Make the WinitWindowAdapter non-generic
...
This isn't necessary anymore
2023-05-11 10:42:09 +02:00
Simon Hausmann
c3cee1c3d9
winit: Simplify internal renderer trait
...
Don't require the creation of an Rc<winit window>, leave
that to the caller.
2023-05-11 10:42:09 +02:00
Simon Hausmann
0475b91daf
skia: Simplify renderer API
...
Remove the generic window handle owner part of the API. Instead assume
that the caller provides safety for the given window handles, like we do
for FemtoVG and like softbuffer does it in its public API.
2023-05-11 10:42:09 +02:00
Simon Hausmann
a3a13c727a
winit: Cleanup, move the winit window out of the individual renderers
2023-05-11 10:42:09 +02:00
Simon Hausmann
d0cdc462c7
Simplify Skia Renderer
...
Allocate the renderer's surface type in the constructor.
This also changes the C++ API to match this, which complicates some code
a little bit.
2023-05-11 10:42:09 +02:00
Simon Hausmann
0466ea139c
Simplify state handling in the FemtoVG renderer
...
Create the OpenGL context and FemtoVG canvas in the renderer constructor. This allows
elimiating various levels of interior mutability.
2023-05-11 10:42:09 +02:00
Simon Hausmann
721e74238f
winit: Simplify softbuffer handling
...
Allocate the softbuffer in the constructor
2023-05-11 10:42:09 +02:00