Commit graph

5155 commits

Author SHA1 Message Date
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
f4714f2f5b Add missing file 2020-05-18 16:00:18 +02:00
Olivier Goffart
68cea2aeec Fix soundness hole in FieldOffset
This was cause by the change to allow to create FieldOffset in const constext
because a Fn(T)->U  is not allowed in a const constext.
But we need to be contravariant in T.
2020-05-18 11:06:44 +02:00
Olivier Goffart
07942da4bb vtable: introduce VOffset 2020-05-18 11:06:44 +02:00
Olivier Goffart
1addcad615 vtable: Fix the repr 2020-05-18 11:06:44 +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
810a3905a7 Add VBox::new 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
903fc513de vtable: make sure one cannot call the function with the wrong type 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
49fc23224e vtable: Remove the TraitType wrapper, and allow Option<fn> 2020-05-18 11:06:44 +02:00
Olivier Goffart
8d9a64d249 vtable: add a macro to create a static vtable 2020-05-18 11:06:44 +02:00
Olivier Goffart
62010be72e vtable: support associated consts 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
aa27fceb8c vtable: move the macro in its own macro crate so we can have a runtime 2020-05-18 11:04:54 +02:00
Olivier Goffart
fb691e0808 Implement Component using vtable
(the C++ part not yet ported)
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
25fd60c820 Fix runtime panic in cpp example
Correct the path to the image.
2020-05-14 08:43:00 +02:00
Olivier Goffart
5c5df6b8e3 Macro to generate trait and safe abstraction for a vtable 2020-05-13 23:07:59 +02:00
Simon Hausmann
18a2b7748f Silence VS code warning
... when not targeting wasm.
2020-05-13 13:27:15 +02:00
Simon Hausmann
6f98e2ea56 Fix cargo warning
For now, always depend on console_error_panic_hook. It's useful :-)
2020-05-13 12:08:00 +02:00
Simon Hausmann
3d604b1a0c Ignore the dist directory 2020-05-13 12:07:38 +02:00
Simon Hausmann
e313f39490 Add simple rust wasm test
Needs an initial "npm install" and then "npm start" will build and launch it in the browser.
2020-05-13 11:24:51 +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
3aac8282a8 Allow passing string literals to string properties in Rust
In the Rust code generator, convert to a null terminated byte literal.
2020-05-13 10:01:19 +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
Olivier Goffart
7d1394e349 Add a viewer tool 2020-05-12 19:19:25 +02:00
Olivier Goffart
f88d856990 Put the diagnostic printing in the compiler lib
(with an option so we don't drag the codemap dependencies for the proc_macro case)
2020-05-12 17:42:25 +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