In previous version, we were setting the constraint with wasm after
the window was shown, but this is no longer the case because we delay
the window creation by an iteration of the event loop.
Now should apply the constraint before showing the window.
But on wasm, we also must manually enforce these constraint because the
size given to the WindowBuilder is not applied
When opting into the Skia renderer, we default to metal on macOS and D3D on Windows.
However if you want to develop a cross-platform application with Skia and
for example rely on OpenGL to be able to implement an OpenGL underlay or overlay,
then we need the ability to explicitly opt into skia's GL renderer.
cc #1445
Similar to commit 957186acb7 we need to take the blur into account in the box shadow image:
We add blur margins around the entire image, but we also need to start drawing at (blur, blur) instead of (0, 0).
The same offset needs to be subtracted again when drawing the cached image.
Despite the blur being an abstract float, in reality in femtovg as well
as Skia it's a pixel radius. Commit
1a8a295e38 removed the scaling to physical
pixels, which was wrong. This restores it and along with it the same
appearance as before.
Creating a new window requires access to an event loop instance. The
winit upgrade prevents us from creating multiple EventLoop instances.
Therefore we have to re-use the existing event loop instance, which is
only accessible from within the event handler.
Closes#1545
Not that `SoftwareRenderer::new()` takes the Weak by value instead of
by reference, because coercing a reference to a `Weak` to a `&Weak<dyn>`
is not possible, while converting a Weak to a `Weak<dyn>` just works.
This reverts commit 7f2868b5a0.
This is still causing issues on Windows, as reported by tay64 on
Mattermost. This is a box (no vmware) with an ATI driver.
Vendor: ATI Technologies Inc.
Version: 4.6.14761 Core Profile Forward-Compatible Context 21.30.23.04 30.0.13023.4001
If we (or the user) ends up calling hide() on a window after returning from the event loop, our
attempt at posting an event would panic in winit as we
try to create a new event loop instances.
Since Winit 0.27 a panic is raised when creating an event loop instance a second time.
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.
Since the new version also depends on the ctirical-section 1.0 crate
we need to enable the relevant API in the cortex-m crate because the
rp2040-hal doesn't have it yet