When using box shadows in repeaters, we end up creating multiple
distinct textures of the drop shadow. That's a waste of precious texture
memory if they have the same properties.
Instead, when creating box shadows in a frame, see if they can be
re-used across images. The texture still persistent in the image_cache,
via the explicitly shared skia_safe::Image and Rc<Texture>.
This works well when rendering repeated elements new top-down, but it's
not perfect. For example if a bunch of repeated elements are in a
flickable, only a portion of them are visible and the view is scroll up,
then the top-down rendering will not find a cache hit for the newly
visible element with drop shadows. Yet this is simple enough to help
with sharing in many cases.
and use Rc<dyn PlatformWindow> instead. The alias has to stay with the ffi
functions though and the item vtable definitions,
because we don't have an Rc<> template in C++.
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.
Remove release_graphics_resources() as it's always connected to dropping
the entire renderer's canvas. That one in turn is already prepared, i.e.
for femtovg it makes sure that the context is current.
Move the rendering notifier into the Renderer. This duplicates a little bit of code, but it
(1) Allows for avoiding the flush of femtovg/skia if no rendering notifier is
registered
(2) Paves the way of gracefully handling the situation where the renderer doesn't support this yet
Resize the glutin context when we receive a resize event from winit.
This is the approach recommended by glutin/winit's documentation.
This approach also avoids jitter when rendering with metal (not
implemented yet, but tested locally :)