The binding setup functions (set_binding, set_animated_binding, etc.)
are taking the binding basically as an `impl Fn() -> T`, which means
each call site creates a new copy. The bodies of these can be quite big.
Since most of our uses follow the pattern of just capturing the
samereduce the number of copies needed parameter, we can reduce the
number of copies needed by providing wrappers.
With rustc 1.54.0 on my mbp and debug, the build time of
touch ../ui/printerdemo.60
cargo rustc
goes from 1m:15s down to 42s, and total llvm lines goes from
2079842 down to 1134237.
... by ignoring all style and complexity related lints, since humans don't typically consume the generated code.
Co-authored-by: Olivier Goffart <ogoffart@sixtyfps.io>
A crate that disapeared was probably providing the
used trait.
Switch the transparency comparison code to use:
https://docs.rs/float-cmp/0.9.0/float_cmp/.
Given I a not a graphic programmer the patch uses
value that seems meaningfull according to the doc
of the float_cmp crate.
Excerpt from the documentation:
"""For most cases, I recommend you use a smallish
integer for the ulps parameter (1 to 5 or so),
and a similar small multiple of the floating point’s
EPSILON constant (1.0 to 5.0 or so), but there are
plenty of cases where this is insufficient."""
Signed-off-by: Benoît Canet <benoit@nodalink.com>
This requires some gymnastics to get right as the information
need to be passed to the compiler despite having no direct dependency
between the compiler and the runtime or backends.
So use a file in the build directory to tell the default style
cc: #83
Add the icon type explicitly to make it easier to do "eye" based type matching with the cpp! macro.
Co-authored-by: Olivier Goffart <ogoffart@sixtyfps.io>
When there is an animaiton but no expression, the binding is
left with an invalid expression.
State was keeping that invalid expression as part of sub expression
this is a regression since commit ba32777cab
Sixtyfps uses euclid already, so let's use euclid for float comparisons
as well.
I changed the code to decide whether a number is a positive integer to
make do without a comparison along the way.