Commit graph

296 commits

Author SHA1 Message Date
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
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
11ce7a2d59 Don't compile glutin twice
Use the same glutin version everywhere
2023-10-25 08:43:42 +02:00
Simon Hausmann
670fed7dbd Reduce softbuffer features
Only pull in wayland or x11 and skip kms for now.
2023-10-23 14:54:21 +02:00
Olivier Goffart
087ed3a8c5 Update to released version of winit 0.29 and glutin 2023-10-23 14:22:48 +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
e0cc2e30a3 skia: Avoid unsafe in favor of bytemuck::cast_slice_mut 2023-10-23 13:55:23 +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
60901a27ff skia: Fall back to software rendering if GPU accelerate rendering fails to initialize
At the moment this is only supported for the winit backend and the C++
API. linuxkms uses a different SkiaRenderer constructor.
2023-10-23 13:55:23 +02:00
Simon Hausmann
0aa4c42989 skia: Add support for Skia's software renderer 2023-10-23 13:55:23 +02:00
Simon Hausmann
2329bf9eb1 Fix Skia not rendering with some Radeon drivers on Windows
Sometimes Radon drivers report on Windows erroneously that it supports
GL_NV_framebuffer_blit as extension but when looking up
glBlitFramebufferNV via getProcAddress it returns a null pointer.

The issue goes away when bumping the GLES version. GLES 2.0 was released
in 2003 and 3.0 in 2012. Practically everyone supports it nowadays (even
Safari), so that's the easiest solution for the Skia renderer.
2023-10-23 11:42:54 +02:00
Tobias Hunger
b12575a4c4 janitor: Go over our spell checking setup
* Extend the cspell word list
* Remove those extensions from individual source files
* white-list licenses and such as we should not meddle with those
* Fix spelling
2023-10-16 09:01:51 +02:00
Olivier Goffart
852b4d906d Rename ComponentVTable to ItemTreeVTable
and their related name.
Also move the component module in the item_Tree module
register_component -> register_item_tree
ComponentItemTree -> ItemTreeNodeArray

For #3323

Rationale from that issue:

Right now, we use the term `component` in the Slint language and in the compiler to be a a tree of elements that can be used as an element in a .slint file.

The term is also currently used in the runtime as a tree of runtime Items that are allocated together. (declared in ComponentVTable)

But there are no 1 to 1 mapping between a `component` in the slint language, and a runtime Component.
(for example, the items behind a `if` or `for` or `PopupMenu` are in a different runtime component. And `component` declared in Slint are often inlined)

So we should rename the internal runtime `Component` to  `ItemTree`

The currently public `slint::ComponentHandle` wraps the "root" of the ItemTree, but that's ok because it is generated from a .slint `component`,  so it doesn't change name
2023-10-09 11:01:56 +02:00
J-P Nurmi
10ae5cd60a Skia: fix line height calculation for eliding the last line of text 2023-10-05 08:54:02 +02:00
J-P Nurmi
6792f6abf1 Skia: fix empty text input cursor alignment 2023-10-04 10:17:30 +02:00
J-P Nurmi
bf0e474a1f Handle unicode line- and paragraph separators 2023-10-02 23:26:21 +02:00
J-P Nurmi
59ee8edcdc Skia: fix cursor rect at a trailing newline 2023-10-02 23:26:21 +02:00
Tobias Hunger
85e1c6020b janitor: Use workspace dependnecies for the slint crates
This moves most of the version information we need to update into one
place.

Note that the workplace dependency features are in *addition* to any
feature set when using the workspace dependency. So we have all
workspace dependencies defined with `no-default-features = true`.
2023-09-25 16:34:16 +02:00
Tobias Hunger
d6695c55cb Janitor: Use cargo workspace package data more 2023-09-25 16:34:16 +02:00
Olivier Goffart
6594729395 skia: correct default for the supports_graphics_api 2023-09-21 17:23:08 +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
J-P Nurmi
ddf1038ea7 Skia: fix eliding of multiline text 2023-09-19 08:50:01 +02:00
Simon Hausmann
84f120bcd1 Don't panic when the windowing system tries to assign a zero size to a GL surface
Apply https://github.com/slint-ui/slint/pull/3179 also to the Skia OpenGL surface.

A zero size is permitted with Metal for example, but
we panic'ed.

Fixes #3472
2023-09-14 17:38:28 +02:00
Guilhem Vallat
5cf1a45e41 Remove duplicated geometry properties from items 2023-09-13 16:08:37 +02:00
Simon Hausmann
5cdb279c1f Remove workaround for issue with trailing slash in VCINSTALLDIR when building Skia on Windows 2023-09-13 11:44:49 +02:00
Simon Hausmann
779e216b2a Update to skia-safe 0.66.1 (skia 116/117)
This new version compiles with LLVM 16 that's now in the GH action
runner windows images.

cc #3365
2023-09-13 10:11:39 +02:00
tronical
b8b9db4e42 Bump version number to 1.3.0 2023-09-05 15:46:36 +02:00
Simon Hausmann
e73ad733fc API fixes to the OpenGL texture borrowing API
- Make BorrowedOpenGLTextureOrigin non_exhaustive
- Mark BorrowedOpenGLTextureBuilder::new_gl_2d_rgba_texture as unsafe instead of build(). The former takes the arguments that may be garbage, not the latter.
2023-08-30 16:18:42 +02:00
Simon Hausmann
efb619b08a Revert "Make the SkiaRenderer public in the Rust API"
This reverts commit 9d27f0cc96.

This was not intended for the master branch. Ooops.
2023-08-29 08:55:26 +02:00
Simon Hausmann
9d27f0cc96 Make the SkiaRenderer public in the Rust API
It's also public in the C++ API and this is the equivalent change on the Rust API side.
2023-08-29 08:54:11 +02:00
Simon Hausmann
a2d72f75bb Minor build fix for Android
We always enable the x11 feature when selecting `backend-winit`
2023-08-23 09:18:53 +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
96d7bb132c reuse: remove glob for markdown files
Instead, place the copyright and license right into the source.

To satisfy reuse, this also removes the unnecessary MIT.txt
symlinks.
2023-08-17 08:55:28 +02:00
Simon Hausmann
91d0747d06 Make use of the ItemCache more robust when the window scale factor changes
Previously, all the closures passed to `get_or_update_cache_entry` would
have to make sure that the scale factor is an included dependency. This
is error prone, as the parent commits show.

Instead, this change adds a property tracker to each ItemCache and lets
the renderer clear the cache if the scale factor changes.

Strictly speaking this may delete too many entries from the cache (not
all depend on the scale factor), but on the other hand this doesn't
happen very often so we trade robustness over efficiency.
2023-08-16 16:37:07 +02:00
Simon Hausmann
bd08cb47b5 Skia: Fix paths not being re-rendered when the scale factor changes
Include the scale factor in the property dependency chain.
2023-08-16 16:37:07 +02:00
Simon Hausmann
562a5e42df Fix cached femtovg layers not being re-rendered when the scale factor changes
Include the scale factor in the property dependency chain.
2023-08-16 16:37:07 +02:00
Simon Hausmann
4881bd1a87 Fix box-shadow cache not being invalidate when the scale factor changes
Include the scale factor in the dependency tracker of the item cache used for box shadows.
2023-08-16 16:37:07 +02:00
Tobias Hunger
09d3eaf00a Update license symlinks
run `cargo xtask check_reuse_compliance --fix-symlinks`
2023-08-16 11:46:15 +02:00
Simon Hausmann
5f48dca2c0 Skia: Fix re-rendering quality of SVGs when the scale factor changes
Make sure that the scale factor to compute the target size for an SVG is
a property dependency.
2023-08-15 15:46:09 +02:00
Simon Hausmann
0c9199b17f
Add support for flipping borrowed OpenGL textures vertically (#3205)
Closes #2986

Co-authored-by: Olivier Goffart <olivier.goffart@slint-ui.com>
2023-08-02 13:11:13 +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
b503733d03 Update to a new release of the Rust Skia bindings 2023-07-31 16:18:42 +02:00
Simon Hausmann
6b044ae078 Rename extension trait to use Ext as suffix 2023-07-31 13:06:28 +02:00
Simon Hausmann
84ddfc6c2f Add support for rendering the mouse cursor with linuxkms
The cursor is loaded by the window adapter from the cache. When it's
loaded the first time, its format will be Svg, so we convert it to a
pixel buffer. That way the skia backend can convert it on first draw
into a skia_safe::Image and replace the cache entry with the backend
storage variant.
2023-07-31 13:06:28 +02:00