Commit graph

296 commits

Author SHA1 Message Date
Simon Hausmann
5c9eed62f1 Add a new backend that supports rendering fullscreen with Vulkan
This doesn't require a windowing system, just Linux and Vulkan drivers
that supports the display extensions.

It's called linuxkms as soon this will go beyond Vulkan and also support
EGL and perhaps dumb buffers for software rendering.
2023-07-28 13:40:37 +02:00
Simon Hausmann
de75892841 Vulkan: Add API to create the Skia rendering surface from vulkano surfaces 2023-07-28 13:40:37 +02:00
Simon Hausmann
9d73a05c35 Add a constructor that accepts a surface impl 2023-07-28 13:40:37 +02:00
Simon Hausmann
a71e73b549 Make the surfaces part of the Skia renderer API 2023-07-28 13:40:37 +02:00
Simon Hausmann
49fe2b1bb4 Skia: Make the surface type a dyn
This will allow falling back to different surfaces/renderers.
2023-07-28 13:40:37 +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
5a9f8a4c90 Clear caches in the renderers when "changing" the window adapter
This helps to keep the allocation peak low.
2023-07-25 17:28:08 +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
ogoffart
aebaa7d6c9 Bump version number to 1.2.0 2023-07-25 10:44:53 +00:00
Simon Hausmann
3565023a15 Improve error handling in C++ Skia Renderer API
- Don't try to create a GLX context when we only have an XCB window handle,
  XLib is required for that.
- Make it possible to create a NativeWindowHandle from Xlib data types.

Fixes #2978
2023-07-14 15:33:03 +02:00
Aurindam Jana
5a4a7fee63
Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
Simon Hausmann
1d5dcec2e4 Print a warning to stderr in the event of unclean Skia GL renderer
destruction

Amends 488f34dcd7 as advised by Olivier.
2023-06-30 09:54:43 +02:00
Simon Hausmann
cb6ba2f028 Improve robustness of SkiaRenderer::hide() with OpenGL
Only attempt to make the GL context current if we have a rendering notifier callback.

The activation may still fail, and the API will still report it though.
2023-06-30 08:21:46 +02:00
Simon Hausmann
488f34dcd7 Improve error handling when dropping Skia OpenGL renderer
In the unlikely-yet-seen-before scenarion that we've lost the OpenGL context and can't make it current anymore in the destructor,
gracefully conveny this crucial information to Skia and don't panic.
2023-06-30 08:21:46 +02:00
Simon Hausmann
053b990f2a Skia: align gradient rendering with software renderer and Qt
Interpolate colors as pre-multiplied.

cc #313
2023-06-27 17:19:50 +02:00
ogoffart
c8c9496722 Bump version number to 1.1.1 2023-06-26 12:50:02 +00:00
Olivier Goffart
9b59036816 Add licenses symlinks 2023-06-26 13:12:29 +02:00
Simon Hausmann
4820d29bcb Fix macOS lsp bundle
Avoid duplicating the core-graphics crate, as that leads to linking
errors about duplicate emissions of the cg_event_tap_callback_internal
helper function from the core-graphics crate.

This partially reverts commit d91622d64f

In order to re-apply d91622d64f, winit
needs to release a new version first.
2023-06-23 07:40:43 +02:00
Simon Hausmann
d91622d64f Bump cocoa and core-text dependencies 2023-06-22 08:11:16 +02:00
Simon Hausmann
7af8d16b8d Fix build with renderer-winit-skia-opengl 2023-06-19 10:16:09 +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
Tobias Hunger
04d1229685 Fix licnese information using xtask 2023-06-16 09:14:20 +02:00
ogoffart
641cab0e75 Bump version number to 1.1.0 2023-06-15 16:01:28 +00:00
Aurindam Jana
039e54a5de
Add royalty free license to files except examples and docs (#2888) 2023-06-15 11:20:50 +02:00
Olivier Goffart
f4dba7bcfd Seal the Renderer trait
Because we need to make the Render trait public so one can re-implement
the WindowAdapter trait
2023-06-13 17:44:04 +02:00
Simon Hausmann
6bdddd94f8 janitor: Update to skia-safe 0.63 2023-06-07 13:58:20 +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
eadfec64a3 Add support for importing OpenGL textures into Slint
This is the initial API for Slint to borrow OpenGL textures from the
application for rendering.
2023-06-01 15:56:55 +02:00
Simon Hausmann
3cf1b38a48 Add basic support for italic font face selection to Text and TextInput
This is implemented for FemtoVG, Skia, and Qt.
2023-05-31 18:47:39 +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
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
8a2b40ca7d Simplify core Renderer trait for easier implementation
Make text_input_byte_offset_for_position and text_input_cursor_rect_for_byte_offset
low-level in the API, where the implementation becomes easier. Two
helper functions in TextInput in turn collect the necessary parameters
and thus also reduce the amount of duplicated code.

This also decouples the renderer further from the window.
2023-05-17 09:01:02 +02:00
Simon Hausmann
7f45d180a9 Clean up internal RenderingMetricsCollector API
Don't require passing a dyn WindowAdapter. This was only used for
calling request_redraw(), which a proper window adapter should do anyway
if has_active_animations() is true.
2023-05-17 09:01:02 +02:00
Simon Hausmann
2c93ce73c0 janitor: bump winit version
This version still doesn't have the html canvas fix applied though.
2023-05-15 16:39:54 +02:00
Simon Hausmann
a09b2c9188 janitor: Fix clippy warning
Don't call drop a on reference.

Fixes #2725
2023-05-12 16:49:23 +02:00
Simon Hausmann
fcfa1da5bc D3D: Replace panics with propagated platform errors
This isn't quite perfect either, but arguably an improvement and
consistent with the error handling elsewhere.
2023-05-11 12:38:54 +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
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
013ce69a65
Remove stray newline 2023-05-11 06:46:02 +02:00
Simon Hausmann
71cbd5eadd
Fix formatting 2023-05-11 06:33:17 +02:00
Simon Hausmann
5d641a17f6 Skia: Fix panic in d3d renderer when UAC is shown
Presenting on the swapchain fails with a harmless error in that case.

Fixes #2707
2023-05-10 20:17:37 +02:00
Simon Hausmann
481288d489 Initial support for rendering with Skia and Vulkan
Closes #1546
2023-05-09 08:58:35 +02:00
Simon Hausmann
ed4a0d65b9 janitor: Bump winit 2023-05-08 09:11:31 +02:00
Olivier Goffart
37e70c302e Refactoring: Pass the size to to the render function
So that we don't need to query the geometry multiple time, and this pave
the way to not have the geometry in the items

Part of #1932

As a drive by, fix the clipping of the Path element which incorrectly
offseted the clip by (x,y).
Similar fixes happen in the Clip element in some renderer, but that
didn't have effect because x and y are always 0 for the Clip element
2023-05-05 19:53:57 +02:00
Simon Hausmann
f08865e16d Fix support for transparency when rendering with Metal
Make sure that the core animation layer is not marked as opaque.
2023-04-27 17:11:41 +02:00
Simon Hausmann
7144b75adf Fix support for transparent windows on macOS when using OpenGL
CGL supports it as-is but with glutin this is only propagated onto the context
when it's set to true in the config template builder.
2023-04-27 17:11:41 +02:00
Simon Hausmann
85da840603 Fold TextVisualRepresentation::apply_password_character_substitution into the TextInput's visual_representation() function
That way the call doesn't need to be duplicated on all call sites.
2023-04-26 17:48:46 +02:00
Simon Hausmann
baba08baeb Move the default password character into corelib
And only let Qt customize it
2023-04-26 17:48:46 +02:00