It can be activated using the `SIXTYFPS_DEBUG_PERFORMANCE` environment
variable, which takes a comma separated list of options.
This could be extended in the future with different locations for the
overlay (corner_top_left, corner_top_right, etc.) - but this is a simple
start.
cc #728
When called from inside some winit event handler, we'd go straight to
`with_window_target` to get hold of the event proxy and send it. However
when called through some external event handler (DOM), the scoped
CURRENT_WINDOW_TARGET would not be set and MAYBE_LOOP_INSTANCE would
also be empty because `run` takes it. So instead we'd end up creating an
new event loop instance and the event would sit in there forever.
Instead, this change brings WASM in line with the other platforms by
using the dedicated event loop proxy (global_proxy). Because of the lack
of threading the dance of storage for that is a little different though.
On Windows 10, the creation of symlinks by normal users requires
enabling the developer mode, which may or may not be acceptable in
corporate environments with restricted IT setups.
We introduced the symlinks for the shared special key codes mapping,
which instead this patch places into a shared sixtyfps-common crate.
This issue was caused by two bugs:
* The scale factor was not a property dependency of the Image cache entry's property tracker
* The texture cache key for SVGs should include the target size that's scaled to.
Fixes#734
Separate the image cache from the texture cache.
The latter needs additional data in the key. The two have less in common that it seemed.
This also fixes a small issue with `CachedImage::upload_to_gpu` that for
SVGs would return a decoded (rendered) SVG image, instead of a texture.
That was harmless because we always call `ensure_uploaded_to_gpu`
later, but now we assert that the texture cache only holds textures,
because clear() (former remove_textures()) just clears everything.
Share the code that defines the key with a macro over all the backends using
a symlink.
This is a symlink rather than exposing the macro directly since we add this
module in every backend, and each backend re-declares the macro to handle
the part that it needs. This needs to be a symlink because it will also be shared
with the compiler that does not depends on sixtyfps-corelib
The initial clipping was set in physical size rather than in logical size.
When scaling up, this does not have visible effect, but when scaling down
it clips too much.
The cached shadow image should just be the cache of the shadow. This
removes a visible "edge" from the shadow sometimes and brings the
rendering in line with the Qt backend.
For the MCU port, we need to proccess the image to save them in the binary
in a convenient format.
This patch start this work by trying to anaylyze what format should an image
be using, and saving it as a texture in the binary.
The current graphical backend and the C++ frontend are not yet supported
PR #642 fixed making the window not resizable when it has initially a
fixed size. This change applies a different logic with the same
resulting effect when the window item changes later, for example when
transiting in the live-preview from a fixed size to a resizable window -
by looking at the min/max constraints.
Treating the Tab key as text disallows handling Shift-Tab because
the shift modifier will not be passed down. This makes the
handling of Tab analogous to Escape, Return and other non-text
keycodes.
Avoid creating an intermediate array of items to free the graphics resources.
Instead call run-time function with the item tree as a parameter, which is traversed.
It's practically the same data structure that was previously created, except
that it is shared/global and has little holes for the dynamic tree items, but those are easy to skip.
The contents of a Text would wander to the left with center and
right alignment because some size calculations don't take the
maximum available width into account.
The database is not empty, as the changed expect() suggests, but instead
it just means that the family could not be found. This can happen for
example with something like this:
export App := Window {
Text {
text: "Ok";
font-family: "Non-existent";
}
}
or it can also happen when loading the printer demo in the online
editor, where a custom font is supposed to be available but that's not
implemented for wasm builds.
So instead of panicing, fall back to querying for a last-resort
sans-serif family.
For Linux, we register fontconfig's choice for sans-serif, otherwise
fontdb has defaults for macOS and Windows, and for wasm we register our
copy of DejaVu. So that cannot really fail....
When processing window specific events, or generally when accessing
the ALL_WINDOWS refcell, keep the time for borrow to an absolute
miniumum. That way any subsequent method calls may further acquire the
refcell.
This patch re-organizes the entire deeply nested window event handling
in a function with slightly less indentation.
Fixes a panic when calling hide on a Window from within a callback
handler.
Fixes#539