Commit graph

30 commits

Author SHA1 Message Date
Olivier Goffart
ed179cd5b1
Refactoring: get rid in the callable in the Expression tree
Have a special node for them in FunctionCall
2025-01-24 20:26:35 +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
Olivier Goffart
f31cefdea9
Fix min/max/clamp in presence of percentages
We were not properly converting the first argument

Fixes #7118
2024-12-16 18:44:55 +01:00
FloVanGH
2200a64471
added min/max support for rem (#6842) 2024-11-20 10:19:28 +00: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
0f6c3a4fd7 Use SmolStr in more places of the compiler infrastructure
This removes a lot of allocations and speeds up the compiler step
a bit. Sadly, this patch is very invasive as it touches a lot of
files. That said, each individual hunk is pretty trivial.

For a non-trivial real-world example, the impact is significant,
we get rid of ~29% of all allocations and improve the runtime by
about 4.8% (measured until the viewer loop would start).

Before:
```
Benchmark 1: ./target/release/slint-viewer ../slint-perf/app.slint
  Time (mean ± σ):     664.2 ms ±   6.7 ms    [User: 589.2 ms, System: 74.0 ms]
  Range (min … max):   659.0 ms … 682.4 ms    10 runs

        allocations:            4886888
        temporary allocations:  857508
```

After:
```
Benchmark 1: ./target/release/slint-viewer ../slint-perf/app.slint
  Time (mean ± σ):     639.5 ms ±  17.8 ms    [User: 556.9 ms, System: 76.2 ms]
  Range (min … max):   621.4 ms … 666.5 ms    10 runs

        allocations:            3544318
        temporary allocations:  495685
```
2024-10-17 18:04:58 +02:00
Enyium
5a796e6dc0
Change debug() separator from , to . (#5997)
This is also how JavaScript's `console.log()` behaves.

Fixes #5991.
2024-08-29 12:02:13 +02:00
Olivier Goffart
51481b101c
Make conversion from float to int property truncate
- Make sure that in Rust and C++ we also truncate if the properties are
inlined
 - Change the interpreter to truncate

This is a redo of commit f5d003d but truncate instead of round

fixes #5689
2024-08-10 14:51:05 +02:00
Simon Hausmann
9a34789070 Revert "Fix conversion to from float to int"
This reverts commit f5d003d1e2.

We decided to postpone this change until a later release, in maybe a
different shape.
2024-07-25 15:25:00 +02:00
Olivier Goffart
f5d003d1e2 Fix conversion to from float to int
Round the value.

The previous behavior is that

 - For the interpreter, we were rounding (same as new behavior)
 - for Rust and C++ we were truncating, unless the properties were
   inlinined and then we were keeping it as float
2024-07-23 17:32:57 +02: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
Olivier Goffart
0929e3dfc1 Slint: make the abs work with unit types 2024-05-08 19:04:22 +02:00
Tobias Hunger
2e3b00e38e janitor: Fix some clippy warnings pre-release
Nothing that should be controversial, but the
`internal/compiler/builtin_macros.rs` could point to a thinko in the original
commit.
2024-05-06 16:47:14 +02:00
Olivier Goffart
0f05089d5e Polish the C++ and Rust HSV API 2024-04-15 18:18:00 +02:00
Luke D. Jones
d4a3f77877 feat: color: add HSV methods to slint 2024-04-15 18:18:00 +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
Olivier Goffart
42a4286048 Fix missing error when calling argb() with too many arguments
This is technically a breaking change if someone was calling it with too
many args by mistake, but i think it's fine to do this as a bugfix
2024-03-22 14:57:07 +01:00
Tobias Hunger
2ad8774a61 Add clamp function to slint language 2023-11-22 12:27:54 +01:00
Tobias Hunger
2840886d28 Add component-factory type to Slint language
Add a type "component-factory" to the Slint language.
2023-07-27 12:04:16 +02:00
Guiguiprim
ef8ddaaa1d
Add native support for min/max 2023-07-21 16:26:41 +02:00
Aurindam Jana
5a4a7fee63
Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
Olivier Goffart
11dea135f7 Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
Aurindam Jana
039e54a5de
Add royalty free license to files except examples and docs (#2888) 2023-06-15 11:20:50 +02:00
Cole Lawrence
95e00c5621 Support negative numbers in cubic-bezier(...) function 2023-05-02 09:48:32 +02:00
Simon Hausmann
d8a1f2cf01 Introduce a rem unit in the type system
This allows specifying font sizes relative to the Window's
default-font-size, similar to CSS rem.
2022-11-24 11:33:38 +01:00
Olivier Goffart
28ae8f7bc4 Refactoring: split ElementType away from the types used as property type
These are two different concept, and it is confusing to keep them in the
same enum

We want to support component without any base element, and Void is
already used for global component, so do this refactoring before
2022-10-26 14:50:44 +02:00
Olivier Goffart
92b4f52556 Make mod() a macro that can take generic types instead of just integer 2022-07-11 17:49:28 +02:00
Tobias Hunger
4230ac2572
Update copyright information to reflect name change
Also run resue over the codebase and fix complaints from that tool.
2022-02-09 10:27:47 +01:00
Tobias Hunger
e6b24bceec [reorg]: Set up and populate the internal directory
Move "internal" crates into the `internal` directory. This first batch
includes most of sixtyfps_runtime but leaves the rendering backends
alone for now.

pre-commit applied some cleanups to the moved files:
 - Consistent newline at end of file policy
 - trimming trailing whitespace
 - Formatting Cargo.toml files.
2022-01-31 16:00:50 +01:00
Renamed from sixtyfps_compiler/builtin_macros.rs (Browse further)