Simon Hausmann
23d3964a0d
Add boilerplate for text items
...
Forward the text and color properties to the rendering backend, where
right now we just rendering all the glyphs into a dedicated texture.
Next steps are a glyph atlas texture, blending the specified color with
the alpha of the glyphs, configurable size and family, shaping with
Harfbuzz and may more things.
2020-05-18 19:04:12 +02:00
Olivier Goffart
b78f708786
Add SharedString::push_str
2020-05-18 18:45:33 +02:00
Olivier Goffart
ed842b3ae6
String: add comparison and simple test
2020-05-18 18:03:47 +02:00
Olivier Goffart
25bf149e13
Add a shared string that can be used in properties
2020-05-18 17:09:40 +02:00
Simon Hausmann
e6be2c91b8
Fix translation of children of images
...
Propagate the x/y of images also to the children.
2020-05-18 16:01:53 +02:00
Simon Hausmann
a7d5bd9f59
Minor rendering cleanup
...
Remove the x/y parameters from the rectangle primitive. They're always zero
since we always render with a transformation
matrix.
2020-05-18 16:01:53 +02:00
Olivier Goffart
5a9cbaae66
vtable add support for field offset in the vtable
2020-05-18 11:06:44 +02:00
Olivier Goffart
751a3fbe59
Work on const field offset crate to give type safe offsets
2020-05-18 11:06:44 +02:00
Olivier Goffart
aff3d7e14b
vtable: add safe way to construct references
2020-05-18 11:06:44 +02:00
Olivier Goffart
b745c616f7
Add a trait to get the vtable for a type
2020-05-18 11:06:44 +02:00
Olivier Goffart
4ca45ca4da
vtable crate: Some refactoring and simplifications
2020-05-18 11:06:44 +02:00
Olivier Goffart
0a973f65d5
vtable: Some more safety fix
2020-05-18 11:06:44 +02:00
Olivier Goffart
f74cfe73cd
Use the vtable crate for the ItemVTable
2020-05-18 11:06:44 +02:00
Olivier Goffart
544cb1a198
Fix C++ compilation using the vtable crate
2020-05-18 11:06:42 +02:00
Olivier Goffart
4988fcb543
More fix to use vtable for component. All rust code compiles
2020-05-18 11:06:31 +02:00
Olivier Goffart
686f4c9591
More work on the vtable macro to adapt the Component
...
This does not work yet
2020-05-18 11:04:54 +02:00
Olivier Goffart
1ced4224b5
More work on the vtable crate
2020-05-18 11:04:54 +02:00
Olivier Goffart
4b19818f6c
WIP: port Component to vtable
2020-05-18 11:04:54 +02:00
Simon Hausmann
6110e4952d
Move item rendering related code into a separate module
...
.. and keep less code in the central lib.rs.
2020-05-13 10:55:13 +02:00
Simon Hausmann
3142883ca8
Render the contents of image elements
...
The source property is a path relative to the path of the executable.
That is still rather inconvenient. It would be more convenient to make
it relative to the source file, but the corresponding proc-macro span
source_file() accessor is not public/stable.
Perhaps there's a way of doing this also through the generated code and
std::file!().
2020-05-13 10:27:09 +02:00
Simon Hausmann
e144e885e1
Generalize the offset state in the rendering loop
...
Using a transform allows for additional properties such as scale and rotation
later.
2020-05-13 08:17:30 +02:00
Simon Hausmann
6ba90975b8
Further cleanup of the internal run_event_loop
...
Let the callback take a frame and that's it. Then the caller can take
care of presenting it, etc.
2020-05-12 22:16:04 +02:00
Simon Hausmann
5117452e94
Remove TODO comment fixed by previous commit
2020-05-12 22:12:11 +02:00
Simon Hausmann
c26a2a1562
Fix GL context state handling
...
Make our GL context not current when done with the initialization
and make it current for the duration fo primitive creation and frame
rendering.
Fixes #4
2020-05-12 21:42:34 +02:00
Simon Hausmann
0b807190c7
GL Renderer cleanup
...
Get rid of the vertex array object that's not really used. We do bind the binding
manually right now anyway and this can be reintroduced later.
2020-05-12 19:22:01 +02:00
Simon Hausmann
ea03e08306
Clean up rectangle creation
...
Use a simple shared convenience method in the GraphicsBackend trait
2020-05-12 19:22:01 +02:00
Simon Hausmann
5986d5f2b8
More visitor cleanups
...
Provide a non-mutable visitor as well, as the actual rendering loop doesn't need
to change the items fortunately.
2020-05-12 16:33:50 +02:00
Simon Hausmann
f22b18584e
Remove the cells in CachedRenderingData
...
Since we have a mutable accessor to this structure, we can skip the cells and make the code easier to read.
2020-05-12 16:26:58 +02:00
Simon Hausmann
93bb21f082
Fix dead code warning when targeting wasm
2020-05-12 16:24:56 +02:00
Simon Hausmann
93de9cf90c
Change visit_items to take a mutable ref
...
This is safer, Olivier says :-)
2020-05-12 16:17:39 +02:00
Simon Hausmann
573a2bb0a9
Minor cleanup
...
Rename dirty_bit to cache_ok -- that makes the code slightly more readable.
2020-05-12 16:05:26 +02:00
Simon Hausmann
c5bcba2c3c
Added basic rendering of cache primitives to the Items
2020-05-12 16:00:41 +02:00
Simon Hausmann
1791469390
Allow the item visitor to mutate items
2020-05-12 15:45:14 +02:00
Simon Hausmann
85e2ac36ef
Prepare for caching rendering info for Items
...
Replace the RenderTree with a RenderingCache that is just the free-list vector
of rendering primitives.
2020-05-12 15:44:08 +02:00
Olivier Goffart
638c445cf9
Support for rendering sub-elements with proper offset
2020-05-12 15:38:50 +02:00
Simon Hausmann
743ad34099
Renaming RenderNode to CachedRenderingData
...
The name node suggests some kind of connected (tree) data structure, which
isn't quite what it is. It really is meant just
to be a way of storing cached rendering data for this item.
2020-05-12 13:55:57 +02:00
Olivier Goffart
7c2f40da90
Generator for the rust API
2020-05-12 11:43:29 +02:00
Simon Hausmann
7efcbd5816
Simplify geometry handing
...
Replace the use of kurbo's primitives with lyon/euclid. This means less data copying,
conversion and also no annoying precision
casts.
2020-05-11 19:23:03 +02:00
Olivier Goffart
471dd0f778
Make run_component safe
2020-05-11 15:35:17 +02:00
Olivier Goffart
88e904d228
Draft of the layouting runtime code
2020-05-11 15:33:38 +02:00
Simon Hausmann
c966f6e546
Add primitive rectangle rendering
...
This is still uncached, but gets something onto the screen.
2020-05-11 15:33:14 +02:00
Simon Hausmann
83eb00b080
Run the C++ generated component through the GL backend
...
... which in turn forward to the corelib, but with the GL renderer attached.
2020-05-11 15:05:33 +02:00
Simon Hausmann
63d3f5125e
Move the main loop implementation into the core library
2020-05-11 14:30:41 +02:00
Simon Hausmann
3a954e4cea
Move window system creation and other GL related code into the GL backend
2020-05-11 13:11:55 +02:00
Simon Hausmann
e4ce0bcd7e
Prepare for exposing the rendering backend to C
...
... by building a cdylib.
2020-05-11 10:56:33 +02:00
Olivier Goffart
bd039be10c
Introduce the datastructure to allow models and repeater
2020-05-11 10:10:25 +02:00
Olivier Goffart
cc170d1d76
More comments
2020-05-11 09:00:21 +02:00
Simon Hausmann
35831c57c7
Use glow without glutin
...
We don't need the dependency for glow
2020-05-09 14:29:07 +02:00
Simon Hausmann
8843f655eb
Reduce the binary size
...
Only use the png loader from image
2020-05-07 21:02:46 +02:00
Simon Hausmann
50b7b753e8
Minor GL renderer cleanups
...
Rename GLVertexBuffer to GLArrayBuffer, as that's what it is. Also added TODO
issue reference.
2020-05-07 20:50:01 +02:00