This removes the special code for the generated property getters and
ensures type safety in the run-time library for property value setting.
In the Rust generated code we continue to do arithmetic on the scalar
values, that means we immediately extract the scalar, do arithmetic and
rely on the compiler to only allow compatible units.
Danger zone alert: In the interpreter Value::Number can now be converted
to LogicalLength as-is.
During the rendering, if an area is clipped, it will not be rendered and
therefore will not be rendered as a dependency.
Consider this example:
```
HorizontalBox {
Rectangle {
TouchArea{
Rectangle { background: parent.pressed ? red : blue; }
}
}
Rectangle {
clip: true;
TouchArea{
Rectangle { background: parent.pressed ? red: blue; }
}
}
}
}
```
Clicking on the first rectangle will make that area dirty and it will be
redrawn, but since the second one is clipped away, the renderer will not
visit the child items. And clicking on the second rectangle will not
make it re-drawn.
This patch makes sure we rejuster ad dependency of the window tracker
the non-dirty areas
This fix the printerdemo_mcu stopping to render in some cases
And add a test in the CI that checks for warnings in the internal
crates
(Also changed --exlcude in the test to be matching the one from build,
since c++ test are tested separately)
Previously: Window is an Rc<WindowInner>, which has an Rc<dyn
PLatformWindow> - and weak references the other way around.
Now: Rc<dyn PlatformWindow> is the root of window ownership. The impl
PlatformWindow has a slint::api::Window, which just holds a WindowInner.
This change is incomplete on a few levels, mainly that neither of the
code generators nor the interpreter is ported.
When the renderer does not re-implement visit_clip, we call combine_clip.
Then we're missing out on an optimization the GL renderer does: When the resulting clip region
is empty, we do not need to recurse into children for rendering.
That itself reduces the property dependency chain and avoids unnecessary
updates when invisible (clipped) children change properties.
The as_any() method returning a `&mut dyn Any` meant that the type has to be
'static. The class solution of returning &()
doesn't work because it has to be a mutable ref. Therefore just return an Option.
Now that we store the layer textures as Rc<Texture>, before rendering a
layer we can take a clone of a possibly existing layer texture and if if
the layer's tracker is dirty, we can re-use the existing layer texture
if it's the same size.
This avoids unnecessary texture allocations.
I want a more generic name as I want to do to track component structure
changes in addition to resource freeing and I do not want to add another
call into the generated code.
The borrow logic in ItemCache<T>::get_or_update_cache_entry requires us
to take the per-item cache dirty tracker out of the cache entry, so that
we can drop the ref and allow the update_fn to access the cache for
other items during evaluation.
However in order for the cache to work by not re-evaluating the
update_fn next time if nothing rendering related change, we must put the
tracker back after the check/evaluation, otherwise take() will always
return none.
This is a regression from commit
6cbf2c0609 that changed the call from
get_or_update() - which puts the tracker back - to
get_or_update_cache_entry(), which doesn't. Since the former is now
unused, this commit also removes it.
When computing the dirty regions, the call to geometry() might end up
querying a value that's computed by the layout. For the layout
computation we might end up calling ensure_updated() on a repeater,
which then might destroy components. The destruction involves freeing
cached dirty rectangles (via free_graphics_resources), and that also
requires a write access to the cache. So after retrieving the property
tracker for the dirty geometry, drop access to the cache before calling
geometry().
When using repeaters - like in the slide puzzle - and during renderer a component
gets deleted, we call free_graphics_resources and try to free
the dirty rectangle list in the partial renderer cache. At that point the cache is
already mutably borrowed, which causes a panic.
As remedy, apply the mutable borrow more fine grained and not right when calling
render().
When closing a popup, notify the platform window, so that the mcu
backend can remember that region and start the dirty region with it.
Also, free all the rendering cache items of deleted items, to avoid accidental re-use
when re-opening a popup.
This reverts commit faf07ea237 as it
breaks dependency tracking with the partial renderer. The effect is that
the mcu printer demo (in release?) doesn't react to input events
anymore. They are delivered by the redraw tracker doesn't get notified.
This also separates the blend-to-screen part of render_layer into a
helper function, as that will be useful in the future with public layer
elements.
Relates to #725
Delegate the decision how to implement the Clip element entirely into the backend,
where the GL backend can now explicitly render
children into a layer, instead of the hack with a layer in the renderer's
state and the extra save/restore pair.
The render function now takes a self_rc and returns a enum that permits
the implementation to handle rendering of children on its own and
thus make the caller skip that traversal step.
Instead of using the generic visitor, call `visit_children_item` directly on the Component.
This way we avoid the RefCell for the renderer and this will make it
easier to introduce items that decide to render the children themselves, with
their own property tracker.
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_runtime/corelib/item_rendering.rs (Browse further)