mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
compiler: pre-inline layout info for known builtin types
This makes the layout code a bit bigger in size as the inlined version is constructing struct from constant, but let the slint compiler "see" though more code and allow to optimize away many layout related properties Before this change cargo run -p slint-compiler -- examples/printerdemo_mcu/ui/printerdemo.slint -f rust | rustfmt | wc 38873 83654 1925830 cargo run -p slint-compiler -- examples/gallery/gallery.slint -f rust | rustfmt | wc 103817 224874 5316553 After the this change cargo run -p slint-compiler -- examples/printerdemo_mcu/ui/printerdemo.slint -f rust | rustfmt | wc 38643 84506 1925846 cargo run -p slint-compiler -- examples/gallery/gallery.slint -f rust | rustfmt | wc 103210 224427 5291034
This commit is contained in:
parent
762c21890c
commit
e023335f83
1 changed files with 11 additions and 1 deletions
|
@ -519,7 +519,17 @@ pub fn implicit_layout_info_call(elem: &ElementRc, orientation: Orientation) ->
|
|||
}
|
||||
}
|
||||
ElementType::Builtin(base_type)
|
||||
if matches!(base_type.name.as_str(), "Rectangle" | "Empty") =>
|
||||
if matches!(
|
||||
base_type.name.as_str(),
|
||||
"Rectangle"
|
||||
| "Empty"
|
||||
| "TouchArea"
|
||||
| "FocusScope"
|
||||
| "Opacity"
|
||||
| "Layer"
|
||||
| "BoxShadow"
|
||||
| "Clip"
|
||||
) =>
|
||||
{
|
||||
// hard-code the value for rectangle because many rectangle end up optimized away and we
|
||||
// don't want to depend on the element.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue