Rendering tests/cases/examples/rectangle_clip.60 shows a border radius
for the clipped area that's not identical with the border radius of the
inner edge of the rectangle stroke.
It appears that the stroke's inner radius is not exactly the difference
of the line (border) width but rather scaled by kappa.
Fix issue in
https://github.com/sixtyfpsui/sixtyfps/issues/207#issuecomment-825780094
For the purpose of alignment, we need to use the font height, not the actual
text height, because otherwise it does not look visualy centered if the
text does not have letters that goes under the baseline
When rendering into a layer, we applied the y coordinate system flip
using a transform. That transform is incompatible with
Canvas::fill/stroke_text, which uses transform_point to transform the
glyph quads. That appears to not work, as opposed to the
y-flip in the main vertex shader.
Fortunately we can work around it by doing the flip when rendering the
layer image (as part of the fill).
Closes#199
As reported in issue #176 , there is a difference between the rendering
with Qt and femtovg. It appears that this is due to incorrect
assumptions about whether the rgb values in the intermediate buffer
image for colorization have the alpha-channel pre-multiplied or not.
When rendering into the image buffer, we would pre-multiply the alpha,
but when rendering the buffer itself, femtovg's fragment shader would
assume texture type 2 and multiply the alpha again. Therefore set the
image flag to avoid that.
For rendering itself as well as font_metrics() queries, store the result
in the item's rendering cache. This will be needed as the lookup is
about to become more expensive due to the need of calling OS functions
that do text analysis to determine a list of fallback fonts.
When text hasn't changed but we re-render items or re-do the layout, we
need that to be cached.
Pass everything needed for delayed evaluation for
`PlatformWindow::font_metrics()` to permit caching the font matching
result in the Text/TextInput's rendering cache.
We query text metrics frequently for text items, for example when in
layouts. This requires font resolution, which is about to become more
much more expensive due to analysis of the underlying text. To speed
this up, the objective is to use the item rendering cache. Making that
work in turn requires querying all related properties inside a property
tracker. That means we need to delay querying anything related to that,
including the font request needed for the `font_metrics()` function on
the PlatformWindow trait.
In order to determine the best list of fallback fonts for text
rendering, we need to know what text we're going to render. That's why
this patch passes the text through all the way.
Cache the default font properties in a Property<FontRequest>, so that we
can query it in the future when determining the GLFont for text
rendering. When that will happen through a property tracker, the dirty
propagation should mark the item cache dirty when default font
properties change.
* Provide an internal behavior parameter to run_event_loop() that we can use
from the preview to not quit when the last window was closed.
* Fix Drop for the winit event loop GraphicsWindow to drop the backend window correctly
when unmapping, not when the graphics window dies. Otherwise QuitOnLastWindowClosed doesn't work.
This way we can serve preview requests immediately.
This basically makes post_event safe to call before the event loop is entered.
The events will be queued up and sent when the event loop
is created and we have access
to the proxy, which will take over the queue.
* sixtyfps_timer_start needs to *take* the timer id out of the Rust
timer to avoid that the subsequent drop stops the timer again
* For the Qt event loop, call `timer_event()` once before entering
QCoreApplication::exec(), to schedule any timers that were started
beforehand.
* Added a way to quit the event loop gently, in order to use that
from the C++ unit test.
Remove the `application` infix from `register_application_font`, to
reduce the changes that it might be interpreted to be a function that
also changes the default font in all text elements.
Remove the pos parameter to the render functions and instead let
the item renderer apply the transformation on the rendere (femtovg
canvas or QPainter).
So `draw_*` functions in the backend now always operate in item local
coordinates.
Commit 8a66af0746 resulted in pending html
images not being strongly referenced anymore through the item's
rendering cache when first queried in the image size query. That means
they initially reported a size (1x1) and after loading they *should*
mark the bindings dirty that depend on the implicit size, but since the
image was deleted (and along with it the notifying property), the image
kept its visible (1x1) size.
Similarly, images would get loaded too much from disk - same cause,
different effect.
To fix this, go back to the earlier design where the renderer's image
cache keeps a strong reference.
Don't use the item's rendering cache to determine the image size, as
that's soley for rendering. The Qt backend doesn't use the item cache
and the GL backend neither after this change. Instead both backends have
a cache for decoded images.