Simplify the destructor of generated C++ components

Similar to the parent commit, avoid creating an array of item refs and pass the item tree instead
to a run-time helper function.
This commit is contained in:
Simon Hausmann 2021-11-01 10:19:17 +01:00
parent 67579ec560
commit 096fbab93d
3 changed files with 21 additions and 23 deletions

View file

@ -113,9 +113,11 @@ public:
float scale_factor() const { return sixtyfps_windowrc_get_scale_factor(&inner); }
void set_scale_factor(float value) const { sixtyfps_windowrc_set_scale_factor(&inner, value); }
void free_graphics_resources(const sixtyfps::Slice<ItemRef> &items) const
template<typename Component, typename ItemTree>
void free_graphics_resources(Component *c, ItemTree items) const
{
cbindgen_private::sixtyfps_windowrc_free_graphics_resources(&inner, &items);
cbindgen_private::sixtyfps_component_free_item_graphics_resources(
vtable::VRef<ComponentVTable> { &Component::static_vtable, c }, items, &inner);
}
void set_focus_item(const ComponentRc &component_rc, uintptr_t item_index)