We already keep the context in an RC, might as well keep another copy :-)
This re-applies commit 9b0dfa14b5 but
replaces the Clone trait on Shader, which would lead to duplicate and
too early program deletion, with an Rc<Shader>.
This adds horizontal_alignment/vertical_alignment properties, along with
width/height to Text.
This still uses a hard-coded enumeration in the compiler, which is meant
to go away in favor of general enum support.
Move fields out of the HighLevelRenderingPrimitive that are suitable to
represent as uniform variables. That reduces fields like Image or
Rectangle to their image or dimension, and only if *they* change, then
we re-do the work of building geometry and uploading it to the GPU.
Instead, the typically animated properties such as the position or the
color are passed separately with each draw call. This avoids re-decoding
PNG files and uploading them again when moving an image element around
on the screen.
Into the previous Rectangle and BorderRectangle that allows (rounded) borders through a stroke in addition to the fill.
Next step is to make the compiler make the choice automatically depending
on the properties used.
There's still an open question about how to avoid the border properties
for all rectangles but allocate them only for those who have a border.
Regardless, this border illustrates the issue with the lack of text sizing.
When the path was constructed from events (SVG commands), then we don't really need to build an intermediate path,
neither for rendering nor for path layouting.
Some arcs may not result in any content, for example if the radius is too small
or start and end pointer overlap. Let Lyon do the
checking for us and handle it accordingly.
Newer versions of Lyon will allow the re-use of the SvgArc created temporarily.
Instead of trying to convert the individual (future) elements, let's use a builder.
This way the markup remains simple and due to
future support for bindings we can't really
pre-compute the path events anyway.
This comes with a factory function that re-directs to the backend and a
run member function to replace
sixtyfps_runtime_run_component_with_gl_renderer. For now it's all still
hidden in the generated run() method.
This is relatively straight-forward via a pass in the compiler to
collect the resources to embed and then use include_bytes! (once per
resource).
What's really annoying is that the rust resource enum can't store a
&'static [u8] because cbindgen doesn't represent that, probably because
the slice representation isn't guaranteed to stay as it is. So instead
this, for now, uses raw pointers.