Commit graph

296 commits

Author SHA1 Message Date
Simon Hausmann
ef8299a394 Bump Skia Rust bindings to 0.75
This updates Skia to milestone 126 and (among other things) fixes
SKIA_DEBUG=1 builds.

See https://github.com/rust-skia/rust-skia/releases/tag/0.75.0 for more
details.
2024-06-03 08:35:26 -07:00
Aurindam Jana
3523e86359
Simplify commercial license (#3063)
Base the commercial license on the Royalty-free license adding clauses pertaining to the fees.
2024-05-31 14:06:17 +02:00
Aurindam Jana
9a3aa265d5
Update Royalty-free license (#5257)
Add clarification that Application may not expose Slint APIs.
2024-05-31 10:53:19 +02:00
Simon Hausmann
b4fc512d5e Skia: Fix quality of control rendering when using cache-rendering-hint: true;
By default, render layers with smooth scaling, just like we do also in `Image` by default.

The easiest way to reproduce the issue is to use `cache-rendering-hint: true;` on an `Image` and then scale it: It'll appear as if `image-rendering: pixelated;` is used, which it shouldn't.

`cache-rendering-hint: true;` on an `Image` doesn't make much sense by itself, but it should be a no-op.
2024-05-15 14:20:11 +02:00
Simon Hausmann
afa295a511 Revert "Skia: Don't use Vulkan by default"
This reverts commit ac53049408.

After b00752514c we should retain the
ability to opt into vulkan renderer by enabling the vulkan renderer
feature.

cc #5188
2024-05-07 13:35:20 +02:00
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