Having a const generic for that didn't turn to be a good API.
Also made the C++ side more difficult
(Also renamed buffer_stride to pixel_stride)
Closes#2135
Two bugs:
- There was an extra `* 4` that caused panic when the Text was clipped
- There was a bug in glyph handling when the text is being split in
several runs
The current implementation of the software renderer doesn't drawn the
background under the border, so if the border is translusent, we don't
see the background color.
This patch blend the color of the border with the coler of the
background.
Software renderer part of #1988 (minus clipping)
Instead of the ClippedImage. Because we use the colorize property more
often than the source property, and these are soon going to be even more
expensive
Remove platform glyph abstraction, just use non-zero u16 as glyph index
like everyone else. As a bonus, this reduces the memory consumption of
the glyph buffers per glyph from a size of a pointer to the size of the
u16.
The default impl of unregister_component in WindowAdapterSealed would call free_graphics_resources
on the rendere. Any re-implementation would have to do the same,
which the winit backend forwarded through
the winit backend specific internal renderer interface.
Instead, the original call site for unregister_component now calls
free_graphics_resources and unregister_component (for accessibility tree dirty notification).
Replace register_root_component in the WindowAdapterSealed altogether with
a default font size getter on the renderer.
This is overall simpler and allows removing the doc-hidden getter in the software renderer.
* janitor: Fix clippy error drop_copy
Clippy says cache_entry is Copy, so calling drop on it is useless since
it will drop a copied value.
* janitor: Fix clippy error
... about cloning a double ref.
Co-authored-by: Olivier Goffart <olivier@woboq.com>
Permit the style metrics to provide a `default-font-size` and bind that
to the `Window` if set. If not provided, then the backend can set a
`default-font-size`. By ensuring that the value is non-zero at run-time,
we can later introduce a rem unit that can act as factor relative to
this non-zero font size.
- On the web, to return the image size, we need to use the natural size
of the image, and not its dom size, as the later get modified since
commit b727aba4a0
- The target size did not take in account the image fit, that's because
former version of resvg could only render by respecting the aspect
ratio. But since the web don't have this limitation, we now need to
take it into account. And new version of resvg can also scale with
any aspect ratio
Their choice of i16 is specific to the software renderer. In say the Skia renderer
the physical coordinate space would still use Skia's Scalar (floating points).