Commit graph

12353 commits

Author SHA1 Message Date
Milian Wolff
fd0eb01c55 Share common definitions for builtin function types
This way we can reuse a single reference counted type where possible.
2024-10-28 09:39:54 +01:00
Milian Wolff
0fc9f3574a Only allocate the BuiltinFunction::ty() return types once
These are known statically, so let's store them once in thread local
statics and return them from there.

Before:
```
  Time (mean ± σ):      1.034 s ±  0.026 s    [User: 0.733 s, System: 0.201 s]
  Range (min … max):    1.000 s …  1.078 s    10 runs

        allocations:            2917476
```

After:
```
  Time (mean ± σ):     996.9 ms ±  17.7 ms    [User: 708.9 ms, System: 202.9 ms]
  Range (min … max):   977.8 ms … 1033.1 ms    10 runs

        allocations:            2686677
```
2024-10-28 09:39:54 +01:00
Milian Wolff
69c68b22b2 Also wrap langtype::Type::Struct in an Rc
This makes copying such types much cheaper and will allow us to
intern common struct types in the future too. This further
drops the sample cost for langtype.rs from ~6.6% down to 4.0%.

We are now also able to share/intern common struct types.

Before:
```
  Time (mean ± σ):      1.073 s ±  0.021 s    [User: 0.759 s, System: 0.215 s]
  Range (min … max):    1.034 s …  1.105 s    10 runs

        allocations:            3074261
```

After:
```
  Time (mean ± σ):      1.034 s ±  0.026 s    [User: 0.733 s, System: 0.201 s]
  Range (min … max):    1.000 s …  1.078 s    10 runs

        allocations:            2917476
```
2024-10-28 09:39:54 +01:00
Milian Wolff
efdecf0a13 Wrap langtype::Type::{Callback,Function} data in an Rc
This allows us to cheaply copy the langtype::Type values which
contain such a type. The runtime impact is small and barely noticable
but a sampling profiler shows a clear reduction in samples pointing
at langtype.rs, roughly reducing that from ~8.6% inclusive cost
down to 6.6% inclusive cost.

Furthermore, this allows us to share/intern common types.

Before:
```
Benchmark 1: ./target/release/slint-viewer ../slint-perf/app.slint
  Time (mean ± σ):      1.089 s ±  0.026 s    [User: 0.771 s, System: 0.216 s]
  Range (min … max):    1.046 s …  1.130 s    10 runs

        allocations:            3152149
```

After:
```
  Time (mean ± σ):      1.073 s ±  0.021 s    [User: 0.759 s, System: 0.215 s]
  Range (min … max):    1.034 s …  1.105 s    10 runs

        allocations:            3074261
```
2024-10-28 09:39:54 +01:00
Simon Hausmann
e01a121165 Move weather demo to demos/ sub-folder 2024-10-26 09:39:52 +02:00
Ryan Naddy
58efd5312b
Added rejected to TextInput (#6649) 2024-10-25 17:24:47 +02:00
Simon Hausmann
1eb30a484a Fix home-automation wasm loading 2024-10-25 17:15:46 +02:00
Simon Hausmann
d81cc50699 Fix uefi-demo build after printerdemo move to demos 2024-10-25 15:13:19 +00:00
Nigel Breslaw
8ba87950ae
Add fonts back to Home Auto demo 2024-10-25 18:07:36 +03:00
Olivier Goffart
7ab6aeeb97 Prospective fix esp32s2 build on CI
These cfg doesn't seem necessary anymore and newer toolchain throw error
at it
2024-10-25 16:09:59 +02:00
Simon Hausmann
82a58aad3b Add home-automation wasm demo 2024-10-25 15:57:29 +02:00
Nigel Breslaw
e0557536a6
Add new home-automation demo (#6654) 2024-10-25 15:55:03 +02:00
Simon Hausmann
04edafe121 Fix memory example wasm demo publishing 2024-10-25 14:56:24 +02:00
Simon Hausmann
cd1c5bd35a Fix wasm demo artifact publishing after demos/ move
wasm_demos.yaml uses upload-artifact to archive the demos & examples and strips any common directory prefix. So it used to be top-level gallery, etc. and now it's examples/gallery and demos/printerdemo.
2024-10-25 13:18:56 +02:00
Simon Hausmann
b4835bf499 Extend testcase to also cover the import of the implicit export 2024-10-25 12:10:40 +02:00
Simon Hausmann
58be568c0c Fix order of exports when adding implicit export
Fixes #6651
2024-10-25 12:10:40 +02:00
Simon Hausmann
a98d4709be Move printer demo and energy-monitor into new top-level demos/ folder
These are showing off use-cases for Slint, but they're not examples showing individual Slint features.

Also removed the old printerdemo while at it.
2024-10-25 12:09:32 +02:00
Simon Hausmann
acafc9c3e6 Add default value to the docs of accessible-enabled. 2024-10-25 10:20:09 +02:00
DataTriny
2de3b9d455 Add the accessible-enabled property 2024-10-25 10:20:09 +02:00
Update Translations Bot
129936a7d7 Update Translations: extract strings 2024-10-25 03:10:22 +00:00
FloVanGH
181739d624
node: add tests for color set (#6646) 2024-10-24 17:45:27 +00:00
FloVanGH
de67a6d201
checkbox: fixed min-height on all styles (#6647) 2024-10-24 16:59:18 +00:00
FloVanGH
b874adbc1c
material: fixed button touch area (#6645) 2024-10-24 16:25:59 +00:00
Simon Hausmann
cbe77cc14b Fix lsp macos binary build for nightly snapshot
Amends 18db3210d6
2024-10-24 18:20:50 +02:00
Simon Hausmann
512fcedf9c Fix python setup also on macOS-13 machines
Looks like python was upgraded there, too.

Amends 18db3210d6
2024-10-24 17:52:27 +02:00
FloVanGH
69bb6462c3
checkbox: remove margins for fluent and cupertino (#6639) 2024-10-24 11:17:37 +00:00
Olivier Goffart
716b31e6c8 Use PopupClosePolicy enum from the type register instead of re-creating it 2024-10-24 13:11:11 +02:00
FloVanGH
3984ab6a7a
gallery: fixed layout of list view page (#6638) 2024-10-24 09:28:09 +00:00
FloVanGH
14c7910d49
PopupWindow: added close-policy property (#6614)
* Update api/cpp/include/slint_window.h

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update docs/reference/src/language/builtins/elements.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>

* Update internal/core/window.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/interpreter/eval.rs

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>

* Update internal/backends/qt/qt_window.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/interpreter/dynamic_item_tree.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/compiler/passes/materialize_fake_properties.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2024-10-24 09:27:39 +00: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
Olivier Goffart
9e2576bc5c swrenderer: Small fixup in distance field
- include the ' ' char that doesn't have a bounding box but need to be
   included for the advance_x
 - Fix an off by one in rendering where the last pixel was missing
2024-10-24 08:12:13 +02:00
Simon Hausmann
094a8ea718 Add missing par_iter() call
Amends 08c3f7a79a
2024-10-23 19:42:35 +02:00
Simon Hausmann
08c3f7a79a Fix order of glyphs in BitmapFont's glyphs when using SDFs
Initially the character map is ordered by glyph index. Maintain that order for glyph embedding, so that we can safely collect() the bitmaps. Just before creating the final BitmapFont data structure, sort by code point for fast lookups at run-time.
2024-10-23 19:36:51 +02:00
Simon Hausmann
7e3747041f Fix simulator build
Amends ac9b85049a
2024-10-23 19:18:57 +02:00
Milian Wolff
998de63e17
Only clone the public properties for the exported component (#6633)
Copying potentially thousands of properties for no reason is something
that can be easily optimized away to save a bit of time:

Before:
```
Benchmark 1: ./target/release/slint-viewer ../slint-perf/app.slint
  Time (mean ± σ):      1.108 s ±  0.015 s    [User: 0.792 s, System: 0.231 s]
  Range (min … max):    1.085 s …  1.133 s    10 runs
```

After:
```
Benchmark 1: ./target/release/slint-viewer ../slint-perf/app.slint
  Time (mean ± σ):      1.082 s ±  0.019 s    [User: 0.773 s, System: 0.214 s]
  Range (min … max):    1.054 s …  1.117 s    10 runs
```
2024-10-23 17:05:19 +02:00
Olivier Goffart
cbc28b1f1b Android: handle properly the Destroy event
Destroy means we need to exit the event loop.
And android_main will be called again from another thread, so we need to
support reseting the proxy

There is also a bug in the timer when exiting the app that this worked
around

Fix #6626
2024-10-23 14:30:55 +02:00
Simon Hausmann
a2eacd77f4 Minor cleanup: femtovg -> FemtoVG 2024-10-23 13:25:05 +02:00
Simon Hausmann
df55e5563b Simplify OpenGL examples to use platform builder API to enforce a GL supported renderer 2024-10-23 11:22:17 +02:00
Ian Hattendorf
687e4ce95b PlatformBuilder::build() impl requires winit feature 2024-10-23 11:13:49 +02:00
Ian Hattendorf
e2c9b4a743 Fix wording in SlintRenderer comment
Co-authored-by: Simon Hausmann <hausmann@gmail.com>
2024-10-23 11:13:49 +02:00
Ian Hattendorf
3cc44dc670 Add version to OpenGLAPI 2024-10-23 11:13:49 +02:00
Ian Hattendorf
97927ccee9 Don't allow fallback in PlatformBuilder
If we're explicitly requesting a platform with specific properties, we
should fail to allow the caller to react accordingly.
2024-10-23 11:13:49 +02:00
Ian Hattendorf
dedd396093 Allow choosing renderer via PlatformBuilder 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
18db3210d6 Pin Python version for Skia builds on macOS
The Python version installed on the GH runners via homebrew removes the pipes module, which the Skia build needs until https://github.com/slint-ui/slint/issues/6615 is fixed.
2024-10-23 10:26:59 +02:00
Simon Hausmann
2a4024fdcb Bump various dependencies 2024-10-23 10:06:12 +02:00
Simon Hausmann
0ebcbbecbe Speed up SDF generation
Using Rayon shaves off ~10% off of gallery.slint on my M3.
2024-10-23 09:12:30 +02:00
Olivier Goffart
d8ab4e4600 Signed DistanceField font rendering in swrenderer
Note that this is still disabled in the compiler with no way to enable
it with public API
2024-10-23 09:12:30 +02:00
Simon Hausmann
0e404c835c Fix warnings about unused fields in glyph embedding
Make them always used by centralizing the design metrics reading code.
2024-10-23 09:12:30 +02:00