Simon Hausmann
99d1000749
Change interior mutability of GraphicsWindow
...
The interior mutability was visible to the outside via new() returning a
Rc<RefCell<..>>.
When doing deep recursions during rendering for example, that window is
mutably borrowed. That in turn prevents us from adding further members
such as window scale properties, etc. that may be read *during* that
traversal as they'd require an immutable refernce to a already mutably
borrowed refcell contents.
So instead, make the individual fields refcells.
2020-08-06 16:56:49 +02:00
Olivier Goffart
571e74d2ce
Handle Touch event
2020-08-06 11:41:49 +02:00
Olivier Goffart
479173c22f
Implement spacing in GridLayout
2020-08-05 15:42:38 +02:00
Simon Hausmann
5e6bc55fe6
Reduce precision for the cubic easing curve
...
As suggested by Olivier. Also added another test.
2020-08-05 15:41:30 +02:00
Simon Hausmann
00b05bf891
Fix easing curves once more
...
Olivier is right, mixing t and x like that is not correct. Revert to the
previous formula with increased precision.
2020-08-05 15:32:58 +02:00
Simon Hausmann
99c71cca05
Avoid jumps when using cubic easing curves
...
solve_t_for_x uses newton's method or binary search with the provided
tolerance to find t. The default tolerance is 0.1 and our control points
are between 0.1, so the resulting t is not very fine grained.
Instead, first go from t to x and then x becomes the new t for y.
The included but commented out test can be used to verify that the
curves are correct.
2020-08-05 14:51:07 +02:00
Simon Hausmann
f755518dd5
Fix value of width/height on the root item if not specified
...
Fixes the broken gallery :-)
2020-08-05 13:33:05 +02:00
Olivier Goffart
d43fcfe3ea
Remove stray dbg!
2020-08-05 13:28:20 +02:00
Simon Hausmann
5dfb9aa875
Fix initialize size of printer demo
...
Map it to 800x600 logical pixels for a better initial look.
This implements respecting the initial values for width/height and tries
to apply them to the window begin created.
The PinnedOptionalProp wrapper is needed because while cbindgen mapped
the previous Option<&...> to a raw pointer, the new Option<Pin<&...>> is
not detected as a pointer.
2020-08-05 13:22:53 +02:00
Olivier Goffart
1741b90b4e
Implement a SIXTYFPS_SLOW_ANIMATIONS env variable
...
that can be set to a factor to reduce the speed of animations
2020-08-05 13:21:29 +02:00
Olivier Goffart
9bb6a1f2a1
Remove useless debug output
2020-08-05 10:54:59 +02:00
Simon Hausmann
0f1b1fd0db
Fix initial value of the scale factor window property
...
We need to initialize it property once we have a platform window.
2020-08-05 10:49:53 +02:00
Simon Hausmann
d3c596669c
Add larger icons to the printer demo
...
The icons on the main screen are now nicely large and they scale down on
activation.
2020-08-05 10:04:11 +02:00
Simon Hausmann
48df8d0911
Rework the API between the items and the renderer
...
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.
2020-08-05 09:44:12 +02:00
Simon Hausmann
a9297af00d
Update the rendering primitives lazily using a property listener scope
...
This also allows avoiding the need to store the high-level rendering
primitive item in the low-level primitive struct for comparison later.
2020-08-04 22:48:03 +02:00
Simon Hausmann
685a3fb8ab
Rename Text::font_pixel_size to just font_size
...
Since length are resolution independent, it doesn't make sense anymore
to have the pixel infix.
2020-08-04 16:56:42 +02:00
Simon Hausmann
71a1daaf5a
Don't crash if we can't find the unicode replacement character
...
Fall back to a question mark :-)
2020-08-04 14:28:45 +02:00
Olivier Goffart
2d04e47230
Remove stray dbg
2020-08-04 12:59:49 +02:00
Olivier Goffart
1d0eacc87f
Fix wasm build
2020-08-04 12:22:40 +02:00
Olivier Goffart
01a626cf49
Fix panic when the glyph do not exist in the font
...
This happen with emoji.
Show a replacement character (�) instead
2020-08-04 12:18:30 +02:00
Simon Hausmann
4f0bf0b982
Rename dpi to (window) scale_factor
2020-08-04 09:01:30 +02:00
Simon Hausmann
57154a7467
Oops, fix build
2020-08-04 08:33:50 +02:00
Simon Hausmann
df4e837b04
Move model placeholder module out of abi
2020-08-04 08:27:34 +02:00
Simon Hausmann
f79b80f1e6
Split corelib::abi::sharedarray into corelib::sharedarray and corelib::sharedarray::ffi
2020-08-04 08:26:44 +02:00
Simon Hausmann
3ad7a55038
Split corelib::abi::signals into corelib::signals and corelib::signals:ffi
2020-08-04 08:24:04 +02:00
Olivier Goffart
b9088aa178
Fix linking of C++ code
2020-08-03 18:45:25 +02:00
Olivier Goffart
da11b33e9b
Version check
...
Compilation error when the compiler and the runtime are not on the same version
2020-08-03 18:44:36 +02:00
Simon Hausmann
37f874a26b
Rename test_ellapse_time to mock_elapsed_time
2020-08-03 17:52:42 +02:00
Simon Hausmann
f2166d91a6
Move tests out of abi
2020-08-03 17:48:17 +02:00
Simon Hausmann
dbd6708959
Move string out of abi
...
And split the FFI-only bits into an ffi submodule.
2020-08-03 17:44:49 +02:00
Simon Hausmann
0252d2ac34
Move slice out of abi
2020-08-03 17:41:16 +02:00
Simon Hausmann
9b13b363c3
Move corelib::abi::properties to corelib::properties
...
And the bits that are only there for the C binding are now in an ffi sub-module.
2020-08-03 17:32:28 +02:00
Olivier Goffart
1bfd708784
Change the field_offsets() function to a FIELD_OFFSETS associated const
2020-08-03 16:04:55 +02:00
Simon Hausmann
785bdb62ed
Fix linking on Linux
2020-08-03 15:35:19 +02:00
Simon Hausmann
a662d36dc3
Move ItemTreeNode from datastructures into item_tree
2020-08-03 14:38:08 +02:00
Simon Hausmann
f284af27c0
Fix build without rtti
2020-08-03 14:34:34 +02:00
Simon Hausmann
76adda0abd
Move ComponentWindow and friends from datastructures into eventloop
2020-08-03 14:26:47 +02:00
Simon Hausmann
8338bd4360
Move CachedRenderingData from datastructures into item_rendering
2020-08-03 14:17:38 +02:00
Simon Hausmann
45b02e9a3e
Move the item visitor bits from datastructures into item_tree
2020-08-03 14:10:32 +02:00
Simon Hausmann
37fa04098f
Move MouseEvent and MouseEventType from datastructures into input
2020-08-03 13:55:33 +02:00
Simon Hausmann
97a2fb2c7b
Move datastructures::EasingCurve into animations
2020-08-03 13:49:20 +02:00
Simon Hausmann
30d7a0b36d
Move PathData and friends from datastructure to
...
graphics
2020-08-03 13:43:44 +02:00
Simon Hausmann
b05a11945e
Move datastructures::LayoutInfo into layout
2020-08-03 13:31:43 +02:00
Simon Hausmann
1b270f42d0
Move datastructures::Color into graphics
2020-08-03 13:27:35 +02:00
Simon Hausmann
fa87363dc5
Move Point, Rect and Size into graphics
...
And move the expanded structures for cbindgen into an ffi sub-module.
2020-08-03 13:24:39 +02:00
Simon Hausmann
a2cec9e86f
Clean up LyonPathIterator API
...
* Remove Lyon from the name and instead call it PathDataIterator.
* Remove the fit() function and just provide two factory functions.
2020-08-03 13:18:38 +02:00
Simon Hausmann
ce7f66320b
Move datastructures::Resource into graphics
...
It's only used for graphics at the moment and used
for image resources.
2020-08-03 12:47:05 +02:00
Simon Hausmann
05f3ff10a6
Rename graphics::RenderingPrimitive to HighLevelRenderingPrimitive
...
That plays better with the existing LowlLevelRenderingPrimitive.
2020-08-03 12:39:57 +02:00
Simon Hausmann
550d0122a5
Move datastructures::RenderingPrimitive to graphics
2020-08-03 12:39:52 +02:00
Simon Hausmann
aa398c6277
Rename Resource::EmbeddedDataOwned -> EmbeddedRgbaImage
2020-08-03 12:20:17 +02:00