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.
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.
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.
Use the new fontdb API:
* When registering embedded fonts, we don't need to make a copy of the
embedded font data anymore.
* We don't have to mmap the font files ourselves anymore, fontdb can
do this now for us.
We default to querying GlLatest from glutin, which might run into a code
path in glutin's `bind_and_get_api` in `egl/mod.rs` that will return
None as version and pass that to `choose_fbconfig`. That function will
panic with unimplemented() if the bound API is GLES, because we need to
know which version of GLES. The bound API in turn might be GLES if
desktop GL is not supported.
To accomodate for this situation, this patch changes the GL context
creation logic to first try explicitly GLES 2.0 and then fall back to
the GlLatest variants.
In addition this pulls in a newer version of femtovg to fix FBO
rendering with stencil with GLES 2.0.
Copypasta's wayland clipboard requires a different API that we don't cater to yet, so
for now to fix the build, disable the clipboard (use in-app nop).
The font resolution function querying fontdb is fast now, so we can
always call it when rendering text. That way we don't need all the
indirection in the text_size(), etc. functions, we don't need an entry
in the item graphics cache for the font and we can avoid a lot of
property dependencies.
Set QStyle::State_Active conditional to whether the window is active,
which maps to Qt's active window concept and winit's has-focus (until we
render popups differently).
The srgb workaround from commit a0e827e200
appears to work with the AMD GL driver, without which the GL context
creation works (as tested by the reporter).
So instead of panicing, fall back to the glutin default with possibly an
srgb framebuffer, when trying to create a GL context. If that also
fails, provide a better error message than "called unwrap on an err".
cc #481
As tests/cases/examples/image_rendering.60 itself demonstrates, the png file
should be loaded into the CPU side image cache once, but the two textures
should be cached independently.
cc #465
Like CSS image-rendering it has "smooth" and "pixelated" options.
Only OpenGL has been tested right now, have not tested WASM or Qt.
Right now the first instance of a @image-url() will set the scaling
for that specific image. The same image used from memory on the otherhand
can all have a different scaling property.
If the root item is a Window, then we use the default-font-* properties as the basis
for all unspecified font properties in text rendering.
This patch centralizes the code for retrieving that in the runtime window.
If this becomes a performance bottleneck, then we could cache it in a
box-pinned property in the run-time window.
- Have the cursor at the right place when clicking on end of line
- make sure not to render new lines if there are some when in single-line mode
- Enter should make a new line
The RenderCache (slab and generation) is always in a refcell, so we can
just pass that through. This also eliminates the ItemGraphicsCache
wrapper in the GL backend.
This will allow more fine grained borrowing in the future.
This adds an ImageBuffer and PixelBuffer type for SharedVector
backed images. The documentation explains how to use this
with low-level rendering functions and the popular image crate.
Fixes#387
If a Rectangle has a border-radius and clipping, we use an FBO to render
the children and then use femtovg's stencil clipping. If the Rectangle
has a zero width or height, we would end up trying to create a texture
with such dimensions, which produces run-time opengl errors.
We can detect this situation and avoid it early on. The same might happen for shadows.
Fixes#377
When the text selection end follows right after a grapheme that uses less
glyphs than characters, then there may not be a matching glyph with the byte
index, therefore we wouldn't set the selection_end_x and draw incorrectly.
Take the visual tail of the last glyph then.
Sixtyfps uses euclid already, so let's use euclid for float comparisons
as well.
I changed the code to decide whether a number is a positive integer to
make do without a comparison along the way.