Suppose we render an SVG at 100px x 100px with a screen scale factor of 2.
Consequently we should be rendering the SVG at 200phx x 200phx, not 100x100.
Do this by applying the scale factor, just like it is done in the femtovg renderer.
At end of text, take the right edge of the glyph cluster; otherwise the left edge
of what's to the right of the cursor.
For empty text inputs, just return the height of the text to be.
cc #1480
This puts the basics in place for text input. There are a few missing pieces (and probably more not yet discovered):
* Selections are not rendered yet.
* The cursor is not show at end of text.
* Cursor up and down doesn't work correctly in preserving the x position.
cc #1480
Commit 05b16bed89 introduced an exception
for SVGs images to treat them as premultiplied, but commit
3ef35c5ef9 accidentally applied the flag
to all HTML images, which is wrong.
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.
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.
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.
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.
Because re-generating the Skia image is slow and there is no point
storing both the image buffer and the SkiaImage in the cache as it
is basically the same information.
Remove the renderer-skia-opengl "dev" feature again, as on Windows with a
--all-features build in the CI it'll cause
Skia to be built from source. That's not possible in the CI due to long paths as the skia submodule is checked out.
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.