Commit graph

381 commits

Author SHA1 Message Date
Simon Hausmann
de87bf2a43 Update to new objc2 versions 2025-01-24 18:57:09 +01:00
Simon Hausmann
b863e10e3f Disable partial rendering when the application uses a rendering notifier
If we want to enable partial rendering by default in the future, then we need to do this instead of disabling rendering notifiers. We don't know where the application renders to.
2025-01-24 18:41:46 +01:00
Simon Hausmann
52f6178a89 Fix panic when using gradient backgrounds on Window
This regressed with commit 3cb4bd174d, which introduced the draw_rect() hook in ItemRenderer, but unfortunately
it wasn't in the `impl ItemRenderer` section
in the FemtoVG and Skia renderers.

ChangeLog: Fix panic when using gradient backgrounds with `Window`.
2025-01-24 17:14:49 +01:00
Simon Hausmann
3cb4bd174d Add support for triple buffered partial rendering with Skia 2025-01-23 18:27:01 +01:00
Simon Hausmann
3d90434067 Add support for rotation to the partial renderer
The use of the rotation-* properties creates a hidden Rotate item,
which applyes a rotation to the renderer. This rotation (and translation
by rotation origin) is now also applied when the partial renderer
computes the dirty regions.
2025-01-23 09:17:54 +01:00
Mads Marquart
65fca83453 Prepare for objc2 frameworks v0.3
These will have a bunch of default features enabled, so let's
pre-emptively disable them.
2025-01-21 22:47:47 +01:00
Simon Hausmann
d9404d4063 Skia: Report the buffer age when rendering with metal
This makes it possible to debug partial rendering with macOS easily.
Also, disable triple buffering when partial rendering is enabled,
as the partial renderer only supports two buffers.
2025-01-21 15:24:31 +01:00
Simon Hausmann
0d723953f9 Add support for line caps in Path Strokes
ChangeLog: Added `Path::stroke-line-cap` property.

Fixes #4676
2025-01-20 22:28:45 +01:00
Simon Hausmann
4aa81b671a Make glow a Cargo workspace dependency 2025-01-14 14:24:41 +01:00
Simon Hausmann
37be696cd6 Bump glow and femtovg versions 2025-01-14 14:24:41 +01:00
Simon Hausmann
53f2d572b1 Remove some uses of once_cell 2025-01-14 14:18:24 +01:00
Tasuku Suzuki
346d1c2df3 Fix typos
Ran `typos .` and fixed all typos that do make sense.
https://crates.io/crates/typos
2025-01-13 08:35:20 +01:00
Simon Hausmann
c764da4aab
Add property to toggle anti-aliasing on Path elements (#7308)
This enables working around bugs in GPU drivers. Especially the GC7000UL
plus its driver on imx8mp has been observed to sometimes horribly degrade in
performance when Skia renders anti-aliased paths (when a function like
`gcoSURF_BlitCPU` shows up at the top of `perf` that's a bad sign).
2025-01-10 10:28:01 +01:00
Simon Hausmann
c271fe2e19 Clean up unicode-segmentation dependency
Use a workspace dependency.
2025-01-09 20:42:56 +01:00
Simon Hausmann
2ec0522151 Fix panic in FemtoVG and Skia renderers with certain drop shadows
If the effectively drop shadow size would be zero, the FemtoVG and Skia item renderers would panic. The following test-case reproduces this:

```slint
export component Test inherits Window {
    Rectangle {
        drop-shadow-color: black;
        drop-shadow-offset-x: 1px;
        drop-shadow-blur: -0.5px;
        width: 0.5px;
        height: 0.5px;
        background: blue;
    }
}
```

ChangeLog: [Renderers] Fix panic with FemtoVG and Skia renderers for certain drop shadows.
2025-01-06 12:40:44 +01:00
wu bobo
a60c3b39b9
Fixed text input on Android, fixed for older Android versions (#7204)
* Fixes for older Android versions (6.0 to 9.0)

* Fix build script for Android (#4920)

* Fix clipboard operations on Android

* Fix TextEdit crashing on Android (#7203)

* Remove unsafe calls added in 'Fixes for older Android versions'

* Update a comment in androidwindowadapter.rs

Fixes #7182
2025-01-03 11:18:33 +01:00
Simon Hausmann
102d83a306 Skia: Don't render with software by default on macOS/Windows
On macOS we should default to the Meta renderer, similar `renderer-skia` defaults to D3D on Windows. Unfortunately commit 0d36f88152 broke this by forgetting
that None with the requested graphics API means: Go for with what we have, nothing special requested.

This also fixes the terminal output "Failed to initialize Skia GPU renderer: Requested non-Metal rendering with Metal renderer . Falling back to software rendering" (and similar on Windows).
2024-12-20 10:48:55 +01:00
Simon Hausmann
0d36f88152 Revamp BackendSelector API
Based on API review, PlatformBuilder becomes BackendSelector with
a slightly smaller API surface but more options, such as selecting
Metal or Vulkan rendering.
2024-12-16 13:06:05 +01:00
Simon Hausmann
bfdf0e275f Clean up Apple cfg's
Use target_vendor = "apple" where to cover all Apple OS, and exclude ios for event pumping.
2024-12-13 11:03:44 +01:00
Simon Hausmann
37f66789c5 macOS: Replace use of old apple creates with modern objc2 replacements 2024-11-28 10:00:24 +01:00
Simon Hausmann
6bd043aede Skia: Remove unnecessary RefCell 2024-11-20 07:25:51 +01:00
Simon Hausmann
3f8084cdc0 When using Skia with softbuffer and partial rendering, report damages to softbuffer
Co-Authored-By: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-19 21:31:04 +01:00
Simon Hausmann
a7e04b7d59 Move the partial rendering state into core
... and use from skia as well as the software renderer.
2024-11-19 21:31:04 +01:00
Simon Hausmann
d706f81773 Add support for partial rendering with Skia behind an environment variable 2024-11-19 21:31:04 +01:00
Simon Hausmann
bdb0be64dd Skia: Reduce indentation and fix rustfmt application
Move the closure passed to `WindowInner::draw_contents()` into a
separate function, so that rustfmt works again.
2024-11-19 21:31:04 +01:00
Simon Hausmann
9fdb420d96 Skia: clean up background drawing
Do gradient and solid color fills in one place, instead of two.
2024-11-19 21:31:04 +01:00
Simon Hausmann
e8f319bd77 Implement translation() 2024-11-19 21:31:04 +01:00
Simon Hausmann
9b7de3f806 Pass the buffer age to the Skia software renderer 2024-11-19 21:31:04 +01:00
Simon Hausmann
a537556b77 Bump FemtoVG renderer
Fixes #2314
2024-11-17 15:03:33 +01:00
Simon Hausmann
0bf924cf0d Bump FemtoVG to 0.10.1 release that fixes scissor clip problem 2024-10-24 10:30:12 +02:00
Simon Hausmann
e8127ce6ad Temporarily downgrade FemtoVG version
0.10.0 introduced a regression with clipping, that's visible when
running the printer demo (or previewing anything in the vs code
extension).
2024-10-24 08:55:18 +02:00
Ian Hattendorf
3cc44dc670 Add version to OpenGLAPI 2024-10-23 11:13:49 +02:00
Ian Hattendorf
ac9b85049a Add PlatformBuilder API to allow selecting OpenGL API
Right now this just allows selecting between OpenGL and OpenGL ES.
2024-10-23 11:13:49 +02:00
Simon Hausmann
2a4024fdcb Bump various dependencies 2024-10-23 10:06:12 +02:00
Tobias Hunger
df4f9b38ee femtovg: Fix warning about deprecated web_sys::set_fill_style
Use set_fill_style_str insterad, it avoids constructing a JSValue
from a str.
2024-10-16 13:25:00 +02:00
Simon Hausmann
0b028bfb6f
Add support for a font-metrics property to Text/TextInput. (#6452)
The struct held provides access to the design metrics of the font scaled
to the font pixel size used by the element.

ChangeLog: Slint Language: Added font-metrics property to `Text` and `TextInput`.

Closes #6047
2024-10-05 17:00:46 +02:00
Simon Hausmann
34fc24e4e0 Skia: Fix opacity not being applied to box shadows correctly
When a box shadow is the only child of an opacity item, we don't create an intermediate opacity layer (good). Without the opacity layer, it's mandatory to apply the current opacity though, which commit b5c61fb2f5 did, except
it missed this one draw_image call for the box shadow itself.

Fixes #6359
2024-10-02 07:03:02 +02:00
Simon Hausmann
4c5b7c353a Prospective fix for division by zero in Skia renderer when rendering images
Closes #6280
2024-09-25 14:01:21 +02:00
Simon Hausmann
76388260f6 Simplify oddly complex expression 2024-09-25 12:27:03 +02:00
Simon Hausmann
29804f34de Fix WASM version of OpenGL underlay example
Commit 3cb636169506262d96ec2bc53a617714d5ab068d in femtovg switched to
using WeblGL to (needed for tiling). This means the GraphicsAPI::WebGL
context type needs to be updated, too. Also, the canvas_id was always
empty, but needs to be initialized from the id of the element we're
using.
2024-09-24 10:47:15 +02:00
Simon Hausmann
b42840ee85 femtovg: Avoid artifacts of texture sampling with accidental wrap-around on texture boundaries
Set REPEAT_X/Y flags only if tiling is requested. Otherwise we might see artifacts.

See #6268
2024-09-24 09:43:10 +02:00
Simon Hausmann
bc2e97fcef Skia: Improve rendering quality of layers and qt style with fractional translations
Layers and cached pixmaps should be "invisible" in terms of quality,
and they're "designed" to be pixel aligned.
2024-09-18 07:44:29 +02:00
Olivier Goffart
67b82230f7 Skia: fix mixing tiling and colorize
A colorized image is baked by a texture, which needs the context so that
the make_subset don't return None
2024-09-13 17:35:57 +02:00
Olivier Goffart
827975202c femtovg: Fix mixing tiling and coloring
We need to pass the REPEAT_* flags also when creating colorized tetures
2024-09-13 17:03:58 +02:00
Simon Hausmann
388b504683 Update Skia to 0.78
This updates Skia to Milestone 129. See
https://github.com/rust-skia/rust-skia/releases/tag/0.78.0 for
additional details.
2024-09-11 08:25:24 +02:00
Simon Hausmann
d74e49e71f Skia renderer: Remove unnecessary scale factor argument / function 2024-09-10 10:24:07 +02:00
Mads Marquart
945e65f6a4 Use raw-window-metal to do layer creation in skia 2024-09-10 10:19:25 +02:00
Simon Hausmann
3d1e57008e
Revert accidental dependency bump 2024-09-09 22:09:02 +02:00
Simon Hausmann
68cd635aec
Bump windows dependency 2024-09-09 22:06:50 +02:00
Simon Hausmann
b5da1f7b09 FemtoVG: Fix input method cursor position in empty TextInput elements with horizontal alignment
`draw_text_input` handled the empty case with alignment correctly, but text_input_cursor_rect_for_byte_offset, as called for the ime update, did not.
This patch moves the logic into layout_text_lines() for sharing.

This replaces #6006 (which also has a manual test case in the comments).
2024-09-02 17:55:50 +02:00