Commit graph

1368 commits

Author SHA1 Message Date
Simon Hausmann
54b188b0d7 Fix texture src offset precisions for TargetPIxelBuffer::Draw_texture
Implement Mul<Fixed> for Fixed instead of truncation.
2025-03-31 14:46:21 +02:00
Sam Cristall
c4a4913ce5 Experimental Software Renderer: fix texture offset for partial draws when hwaccel 2025-03-31 14:46:21 +02:00
Simon Hausmann
7a25256050 Fix wrong rect being used for target pixel buffer calls 2025-03-31 14:46:21 +02:00
Simon Hausmann
a5bc428509 Fix TargetPixelBuffer functions being called with regions not clipped against the dirty region
This got lost in the rebase/squash session of https://github.com/slint-ui/slint/pull/7685
2025-03-31 14:46:21 +02:00
Olivier Goffart
6010cf724c Hover on MenuBar should activate menu if a menu is already open
Fixes #7822
2025-03-31 14:06:24 +02:00
Olivier Goffart
a80f14e7d8 Fix re-instentiating if elements when the condition is dirty
Fixes #3953
2025-03-27 15:37:07 +01:00
Olivier Goffart
1efe8c8d5f
swrenderer: Don't overflow for font bigger than 256px
Fixes #7936
2025-03-25 15:51:18 +01:00
Olivier Goffart
09e2b18ea3
Fix documentation of image formats
Shortly before 1.10, we dicided not to enable most format by default.
But the documentation was not updated to reflect that

Closes #6574
2025-03-25 12:27:39 +01:00
Olivier Goffart
8807e83bec Don't panic when forwarding mouse event to a window without item_tree
Not sure how we can get to this situation, but this is the most frequent
panic in 1.10 according to the crash reporter
2025-03-25 10:14:58 +01:00
Oleh Kulish
58447c99e7
Add error handling for the slide puzzle example (#7917)
* Add impl From<PlatformError> for JsValue
2025-03-25 10:07:16 +01:00
Simon Hausmann
4fc126e286 Clarify the importance of saving and restoring the OpenGL state in rendering notifier callbacks
Closes #7845
2025-03-24 20:12:06 +01:00
Simon Hausmann
6aff60b38f
doc: minor polish to the timer docs (#7905) 2025-03-21 12:34:40 +01:00
Simon Hausmann
ce2cd01383 Separate the stm32 independent part of the slint::platform::Platform impl from stm32 specific bits
... by moving them into an embassy backend to be shared in the future
with other board support packages.
2025-03-20 13:51:47 +01:00
crai0
14b04678b1 Remove unnecessary unsafe 2025-03-18 11:44:28 +01:00
crai0
1cde5bc5b0 Use f64::log10 2025-03-18 11:44:28 +01:00
crai0
7ac315c72b Allow unused num_traits::Float 2025-03-18 11:44:28 +01:00
crai0
424b12ee36 Use num_traits::Float 2025-03-18 11:44:28 +01:00
crai0
39e7ba554f Avoid using f64::fract and f64::trunc 2025-03-18 11:44:28 +01:00
crai0
4bb7412460 ChangeLog: Add float.to-fixed and float.to-precision
Add two new float to string conversion methods that mimic
JavaScript's Number.toFixed() and Number.toPrecision().

They are implemented as no_mangle functions similar to the already
existing float to shared string conversion.

Closes #5822
2025-03-18 11:44:28 +01:00
Arnold Loubriat
6aa7744868 Expose more kinds of text edit widgets to AccessKit 2025-03-17 14:27:08 +01:00
Olivier Goffart
754a6bfdef swrenderer: make sure small functions in fixed point are inlined
`cargo bench -p printerdemo_mcu`

Before
```
bench                fastest       │ slowest       │ median        │ mean          │ samples │ iters
├─ full                            │               │               │               │         │
│  ├─ Rgb565Pixel    2.919 ms      │ 8.155 ms      │ 4.279 ms      │ 4.326 ms      │ 100     │ 100
│  ╰─ Rgb<u8>        6.139 ms      │ 10.49 ms      │ 7.729 ms      │ 7.826 ms      │ 100     │ 100
╰─ render_only                     │               │               │               │         │
   ├─ Rgb565Pixel                  │               │               │               │         │
   │  ├─ FullBuffer  1.439 ms      │ 4.138 ms      │ 1.597 ms      │ 1.635 ms      │ 100     │ 100
   │  ╰─ LineByLine  1.576 ms      │ 1.765 ms      │ 1.636 ms      │ 1.642 ms      │ 100     │ 100
   ╰─ Rgb<u8>                      │               │               │               │         │
      ├─ FullBuffer  2.016 ms      │ 2.872 ms      │ 2.111 ms      │ 2.128 ms      │ 100     │ 100
      ╰─ LineByLine  2.122 ms      │ 2.995 ms      │ 2.21 ms       │ 2.245 ms      │ 100     │ 100
```

After
```
bench                fastest       │ slowest       │ median        │ mean          │ samples │ iters
├─ full                            │               │               │               │         │
│  ├─ Rgb565Pixel    2.187 ms      │ 4.913 ms      │ 3.48 ms       │ 3.505 ms      │ 100     │ 100
│  ╰─ Rgb<u8>        5.489 ms      │ 8.193 ms      │ 6.713 ms      │ 6.723 ms      │ 100     │ 100
╰─ render_only                     │               │               │               │         │
   ├─ Rgb565Pixel                  │               │               │               │         │
   │  ├─ FullBuffer  1.105 ms      │ 1.932 ms      │ 1.225 ms      │ 1.278 ms      │ 100     │ 100
   │  ╰─ LineByLine  1.188 ms      │ 2.052 ms      │ 1.289 ms      │ 1.352 ms      │ 100     │ 100
   ╰─ Rgb<u8>                      │               │               │               │         │
      ├─ FullBuffer  1.505 ms      │ 2.643 ms      │ 1.599 ms      │ 1.669 ms      │ 100     │ 100
      ╰─ LineByLine  1.539 ms      │ 2.058 ms      │ 1.641 ms      │ 1.652 ms      │ 100     │ 100
```
2025-03-06 12:24:54 +01:00
Olivier Goffart
36a89aeff8 Software renderer: fix drawing background of rotated screen
We need to draw the background over the rotated rectangle otherwise we
don't fill the whole background.

Regression from https://github.com/slint-ui/slint/pull/7685

(also cleanup a useless blend that was leftover from the same change)

Adapt the screenshot test to have at least one non-square "window" so
that we catch the problem in the future
2025-03-06 00:09:35 +01:00
Olivier Goffart
7cb903aa77
janitor: Fix comment in items.rs 2025-03-05 08:16:32 +01:00
Olivier Goffart
5ab791416b Implement Property::set_constant in C++ 2025-03-03 00:50:09 +01:00
Olivier Goffart
79b31153c5 C++: implement the ItemTreeVTable::window_adapter
This is required to fix closing popup with the Qt backend, as we use the
window_adapter as a hack to get the root window_adapter (as opposed to
the popup one)

(That function was only used for the ComponentContainer and was not
implemented for C++ before)

Note that this reinterpret a
`Option<slint::private_api::WindowAdapterRc>` to just a `WindowAdapterRc`
This is because `Option` is only forward declared in C++ as it is not
generaly `#[repr(C)]`,  but we assume (and assert) the usage of a niche.

As reported in https://chat.slint.dev/public/pl/ihnwtdgp7fb75k4aj5ou3p4idc
2025-02-28 00:34:14 +01:00
Olivier Goffart
7390df1b47
ContextMenuArea: Intercept long press on Android 2025-02-24 18:27:25 +01:00
Simon Hausmann
bd80829a44 Clean up and speed up rectangle fill fallback
Match on the composition mode only once per call and compute the fill color only once.
2025-02-24 17:02:10 +01:00
Simon Hausmann
16dce125ca Simplify y range iteration 2025-02-24 17:02:10 +01:00
Simon Hausmann
b6721e172a Simplify foreach_ranges by re-using foreach_region 2025-02-24 17:02:10 +01:00
Simon Hausmann
aced301f4d Simplify RenderToBuffer declaration 2025-02-24 17:02:10 +01:00
Simon Hausmann
f114ff28dd Rename TargetPixelBuffer::Pixel to ::TargetPixel 2025-02-24 17:02:10 +01:00
Simon Hausmann
910d45a01f Fix window background fill
Don't blend the background but fill it when going through ProcessScene.
2025-02-24 17:02:10 +01:00
Simon Hausmann
4c1b7762bd Separate the target pixel buffer trait and related types into a separate module 2025-02-24 17:02:10 +01:00
Simon Hausmann
247074b5e7 Simplify accelerated texture and rectangle fills
There's no need to split the areas to span lines.
2025-02-24 17:02:10 +01:00
Simon Hausmann
5518720391 Fix docs about fixed point format for source texture offsets 2025-02-24 17:02:10 +01:00
Simon Hausmann
9e515710ed Expose screen rotation in the TargetPixelBuffer's draw_texture as integral angle 2025-02-24 17:02:10 +01:00
Simon Hausmann
df6c99871d Change TargetPixelBuffer's draw_texture function to take a data structure instead of many arguments 2025-02-24 17:02:10 +01:00
Sam Cristall
491cb2f911 Add span_y to draw_texture to fix partial texture draws 2025-02-24 17:02:10 +01:00
Sam Cristall
3855cf6b9c Add draw_texture/process_texture and use accelerated fill_rectangle for background draw 2025-02-24 17:02:10 +01:00
Simon Hausmann
543ed39058 WIP: Add plumbing for acceleration pixel blending operations on target buffers in a synchronous way 2025-02-24 17:02:10 +01:00
Olivier Goffart
c3e32c1665
Don't enable image-default-formats by default, remove compat-1-10 feature
We decided that the compatibility with people having enabled the extra
format in image 0.24 [1] is not worth it compared to the extra compilation
time most people gets by default when they don't need this feature.
(Which is less than 10% slower when the feature is enabled)

Since then there is no need for compat-1-10, remove it

[1] by depending directly on image 0.24 in their Cargo.toml and enabling
the features, which will not work with Slint 1.10 that now use image 0.25
2025-02-22 11:15:18 +01:00
Arnold Loubriat
cc91de2d38 Add the accessible-read-only property 2025-02-19 09:16:41 +01:00
Olivier Goffart
22317d29b4
Qt: Fix event forwarding for native popups
So that popup menus can handle hover events.

This also remove some of the code in the qt backend that used the
private API
2025-02-11 17:11:43 +01:00
Olivier Goffart
c85b20d431 ContextMenu on the LineEdit and TextEdit
With usual copy/paste entries

We need to make sure that showing the popup window don't clear the
selection in the TextInput which happens if the TextInput gets a
FocusOut event.
2025-02-11 10:30:11 +01:00
Olivier Goffart
2e4353d3c9 Implement closing of popup menus 2025-02-10 20:27:43 +01:00
Simon Hausmann
8372cd6412
Convey clipping of children to accesskit (#7587)
and while at it, move is_clipping_item() that casts a function of the ItemVTable.

Fixes #2341
Fixes #7382
2025-02-10 13:42:10 +01:00
Yuri Astrakhan
2567880db8 Fix clippy::empty_line_after_doc_comments 2025-02-08 11:39:18 +01:00
Olivier Goffart
c0b72cad2f
ContextMenu: show submenu on hover after a timeout
This means that the parent menu still get the mouse events

Also add the ability to close the menu programmatically
2025-02-07 13:27:32 +01:00
Olivier Goffart
7104c6e88e
Rudimentary key navigation of the popup menu (#7556)
Closing the menus is still not implemented
2025-02-07 10:01:40 +01:00
Yuri Astrakhan
05f4fc0cde Auto-fixed clippy::needless_return
`__CARGO_FIX_YOLO=1` is a hack, but it does help a lot with the tedious fixes where the result is fairly clear.

See https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

```
__CARGO_FIX_YOLO=1 cargo clippy --fix --all-targets --workspace --exclude gstreamer-player --exclude i-slint-backend-linuxkms --exclude uefi-demo --exclude ffmpeg -- -A clippy::all -W clippy::needless_return

cargo fmt --all
```
2025-02-07 09:46:49 +01:00