Commit graph

291 commits

Author SHA1 Message Date
Simon Hausmann
ac53049408 Skia: Don't use Vulkan by default
The Vulkan backend is sometimes have difficulties, sometimes with window
resizing (swapchain resizing failing). Meanwhile, don't pick it by
default unless explicitly requested - prefer OpenGL.

cc #5188
2024-05-07 11:57:06 +02:00
Simon Hausmann
43e3c57b3b Prospective fix for rustdoc warnings about unknown cfg's
Let cargo know about our internal cfgs.
2024-05-06 12:00:44 +02:00
Noah Sweilem
3ae3da3a04 Fix formatting issues 2024-04-26 13:16:19 +02:00
Noah Sweilem
15b8e6c9fa Text stroking: implement hairline stroking when width is zero 2024-04-26 13:16:19 +02:00
Noah Sweilem
f51d91f9f1 Text stroking: check if brush is transparent instead of stroke width to disable rendering 2024-04-26 13:16:19 +02:00
Noah Sweilem
38ed7bed00 Skia text stroke implementation 2024-04-26 13:16:19 +02:00
Aurindam Jana
0cfeec1a31
Update Slint Community License (#4994)
Updated the version from 1.1 to 1.2 
Renamed the header to "Slint Royalty-free Desktop, Mobile, and Web Applications License"
Added definition of "Mobile Application" and grant of right
Moved "Limitations" to 3rd section and "License Conditions - Attributions" to 2nd section
Added flexibility to choose between showing "MadeWithSlint" as a dialog/splash screen or on a public webpage
Moved the para on copyright notices to section under "Limitations"
2024-04-15 15:18:55 +02:00
Simon Hausmann
e616ac376a Update skia-safe
This brings in Skia Milestone 123 and fixes the use of directwrite on Windows. For more details, see https://github.com/rust-skia/rust-skia/releases/tag/0.72.0
2024-03-21 13:14:35 +01:00
Olivier Goffart
881da94737 Move the condition to render the text cursor in TextVisualRepresentation
And add a hack to make the screenshot test pass on Mac
2024-03-21 09:34:52 +01:00
Olivier Goffart
5e66fe9dc8 Fixup cursor color and appearence
On mobile and macOs, the cursor is the selection color.
Also don't show the cursor when there is a selection (all platforms)
2024-03-21 09:34:52 +01:00
Olivier Goffart
9f6b837f7d android: fix cursor and handle color
On android, the handle is the same as the cursor color and the cursor
color is usually the "accent" color.
We can't know the accent color from the native code, but we know the
selection color which is the accent color with a lesser opacity.
2024-03-20 15:06:34 +01:00
Simon Hausmann
38822ea5ca Work around crash on macOS when rendering certain emojis
Set a default font manager to avoid that the unconditional dereferencing inside Skia crashes on a null pointer.

Upstream PR: https://github.com/google/skia/pull/162

Fixes #4696
2024-02-29 23:12:56 +01:00
Simon Hausmann
02e40e7e61 Update to Skia 0.71
Release notes at https://github.com/rust-skia/rust-skia/releases/tag/0.71.0
2024-02-28 15:42:06 +01:00
Olivier Goffart
06174c16d3 Femtovg&Skia: fix drawing of tiled svg image
We will render them with the final size in the buffer, so account for
that difference when rendering
2024-02-27 19:08:16 +01:00
Olivier Goffart
8bc4c4e053 vtable: increase version number to account for breaking change in vtable::Dyn 2024-02-26 14:45:47 +01:00
Olivier Goffart
3910095e4d Tiling for the nine slice images 2024-02-26 12:16:41 +01:00
Olivier Goffart
5e7ddf3a19 Image Tiling
(Doesn't work yet with 9slice)
2024-02-26 12:16:41 +01:00
Olivier Goffart
bb4f2b1581 Implement 9slice with other renderer 2024-02-13 14:46:27 +01:00
Olivier Goffart
97067c3d65 Add 9slice information at runtime 2024-02-13 14:46:27 +01:00
Olivier Goffart
ce6c7f5527 Image: add horizontal and vertical alignment 2024-02-08 18:59:26 +01:00
Olivier Goffart
cb92ba1132 Add ImageFit.preserve and de-duplicate the fitting code 2024-02-08 10:10:56 +01:00
Olivier Goffart
b23c605ac1
Refactoring: Use a trait for Item being Images 2024-02-07 13:28:47 +01:00
J-P Nurmi
5e086971c9 Add RenderBorderRectangle trait 2024-02-06 18:01:35 +01:00
J-P Nurmi
031742246c Implement clipping 2024-02-06 18:01:35 +01:00
J-P Nurmi
20026b14f2 Skia: non-uniform border radius 2024-02-06 18:01:35 +01:00
Simon Hausmann
e4c087c5b0 Update Skia Rust Bindings
See https://github.com/rust-skia/rust-skia/releases/tag/0.70.0 for a list of changes.

The main change for us is that the D3D API was ported to the modern windows rust crate.

(cherry picked from commit f809b3ff41)

The previous attempt at merging this surfaced build issue for source
builds with Skia, due to the use of an old git version that doesn't
understand the new --path-format=relative option the git-sync-deps.py
script uses with git rev-parse, as well as the new permission checking
that breaks with docker volumes where ~/.cargo is mapped to /cargo and
the skia-bindings build performs additional git clones in there, where the
resulting user ids will differ.

Work around the former by upgrading git, and the latter by adding a
wildcard - sadly there's no recursive sub-directory option.

This new version also removes ureq from the dependency tree, which means
we can revert commit 212e28071c
2024-01-31 15:18:54 +01:00
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
a46b70833a Revert "Update Skia Rust Bindings"
This reverts commit f809b3ff41.

Unfortunately this broke the cross build :(
2024-01-20 09:11:11 +01:00
Simon Hausmann
f809b3ff41 Update Skia Rust Bindings
See https://github.com/rust-skia/rust-skia/releases/tag/0.70.0 for a list of changes.

The main change for us is that the D3D API was ported to the modern windows rust crate.
2024-01-19 16:59:22 +01:00
Olivier Goffart
f1f141896f
Fix linear gradiant rendering in non square rectangle
Fixes https://github.com/slint-ui/slint/issues/3730
2024-01-17 17:44:51 +01:00
Olivier Goffart
a7934438ad Janitor: update some dependencies 2024-01-11 14:01:19 +01:00
Simon Hausmann
982b4c806f LinuxKMS: Add initial support for software rendering with Skia
This is the initial implementation based on DRM dumb buffers,
which cleans up various things at the same time:

 - DRM output is separate from GBM and DRM dumb buffer displays.
   The latter two re-use the former.
 - The timer refresh for the Vulkan KHR Display rendering lives
   now with the KHR display code, in hope to be replaced with a
   better mechanism in the future.

What's missing still is support for partial updates as well as
rendering with our own software renderer.
2024-01-07 11:54:29 +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
3b51c8e30a
LinuxKMS: Add support for synthetic display rotations (#4166)
This patch adds support for the `SLINT_KMS_ROTATION` environment
variable, that instructs the Skia/FemtoVG renderers to rotate
the scene before rendering.
2023-12-18 17:49:05 +01:00
Simon Hausmann
c04298647e Skia: Fix OpenGL rendering on devices that don't support GLES 3.0
Fall back to a GLES 2.0 context. After commit 2329bf9eb1 we bumped the minimum to 3.0, but that breaks
rendering on the stm32mp157 with linuxkms.
2023-12-15 16:48:23 +01:00
Simon Hausmann
0c8a48e1d8 Update to skia-safe 0.69
This updates Skia to milestone 120. For more details see
https://github.com/rust-skia/rust-skia/releases/tag/0.69.0
2023-12-08 10:22:35 +01:00
Simon Hausmann
2c775156f7 janitor: bump metal and foreign-types dependencies 2023-11-14 23:03:30 +08:00
Simon Hausmann
e054684bb2 Bump femtovg and associated ttf-parser, glow, and rustybuzz dependencies
cc #3922
2023-11-14 19:40:40 +08:00
Simon Hausmann
d68b981a16 Upate cocoa dependency
cc #3922
2023-11-14 19:23:32 +08:00
Simon Hausmann
58f9cf5d36 Port to new vulkano
This might fix the issue with resizing causing swapchain re-creation
errors, because "Swapchain creation no longer returns an error when the
swapchain extent doesn't match the current surface extent."

cc #3850
2023-11-13 12:39:59 +01:00
Simon Hausmann
0118363bec Fix build with only backend-linuxkms
Activate the kms feature of softbuffer correctly, when building without
default features.
2023-11-13 11:14:03 +01:00
Olivier Goffart
1864257f29 Silence error when rendering SVG in an 0x0 size
Make the size argument to svg::render optional to mean that it is the
default size of the image.
Otherwise, passing None as the size to ImageInner::render_to_buffer
would not render the image which is possible in some backend (eg: the
button image icon with the qt backend)

And if the image is really rendered on an empty because of layouting or
so, we don't need to show a warning anyway.

Fix #3790
2023-11-02 11:09:20 +01:00
Olivier Goffart
d63ff9c4c6 WIP: introduce an android-activity backend 2023-10-31 16:22:11 +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
Simon Hausmann
7fa86ce55a Update skia-safe to 0.69
For details, see https://github.com/rust-skia/rust-skia/releases/tag/0.68.0

This simplifies cross-compilation and adds risc-v builds.
2023-10-28 11:08:30 +02: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
bdd275811e Bump skia-safe version
This updates to m118. See
https://github.com/rust-skia/rust-skia/releases/tag/0.67.0 for more
details.
2023-10-26 10:45:36 +02:00
Simon Hausmann
4aa1cfa99c Simplify Skia GL initialization code
Since our GL display API preferences slice has only a single entry, we can
remove the loop that iterates through the slice of one :)
2023-10-25 11:48:10 +02:00
Simon Hausmann
a6f9ee539b Decouple the Skia renderer from winit
Remove support for GLX. The primary use-case is indirect GPU accelerated
rendering over remote X (say via ssh and X forwarding). That comes at
the expense of an otherwise ugly API (see earlier revisions of this PR)
and issues like #3757, because the GLX error handling requires hooking
into the process-global X error handler. This was already supported only
when using Skia with winit (and thus Rust), not when using the C++ Skia
renderer.

Instead, if GLX is not available, we will fall back to software
rendering as per #3716.
2023-10-25 11:48:10 +02:00