Olivier Goffart
9ef1c36a52
Move the eventloop module to the backend
2021-01-14 08:53:13 +01:00
Olivier Goffart
ab08502c77
Move the GraphicsWindow to the graphics backend
2021-01-14 08:53:13 +01:00
Simon Hausmann
41910f6694
Remove HasFont trait
...
This was only used for syntactic sugar which, as it turns out,
we can also have with a regular associated function that takes
Pin<&Self> \o/
2021-01-14 08:53:13 +01:00
Olivier Goffart
80380c4cc7
Remove dependencies between window and winit
2021-01-14 08:53:13 +01:00
Olivier Goffart
d6ec9a08cb
Remove the dependency between window and eventloop
2021-01-14 08:53:13 +01:00
Simon Hausmann
727c9a19f7
Add basic text item support
...
This needs more work, but gets something onto the screen at least.
2021-01-14 08:53:13 +01:00
Olivier Goffart
9050c29305
Don't use the window through the eventloop module
2021-01-14 08:53:13 +01:00
Olivier Goffart
e2ac322be0
Move the ComponentWindow in its own module
2021-01-14 08:52:22 +01:00
Olivier Goffart
e4900f52b8
Fix some warnings
2021-01-14 08:52:22 +01:00
Olivier Goffart
c7ff67d0fc
Move the ItemRenderer to the item_rendering module
2021-01-14 08:52:22 +01:00
Olivier Goffart
b0fd400cd1
Fix panic: 'already borrowed: BorrowMutError', graphics.rs:702
...
Both with_platform_window and set_scale_factor borrow the backend.
2021-01-14 08:52:22 +01:00
Simon Hausmann
769ad146e7
Preparation for text handling
...
Ensure the dpi on the canvas is up-to-date before/after rendering, as
measure_text etc. rely on it and it's otherwise initialized to 1 by
default. Unfortunately this requires jumping through some hoops, but
that can be fixed later in the canvas.
2021-01-14 08:52:22 +01:00
Simon Hausmann
5906f39a47
Silence some warnings
2021-01-14 08:52:22 +01:00
Simon Hausmann
c74c8592a0
Minor simplification of new_renderer
trait function
...
It's not necesary to pass the window dimensions when the renderer owns
the window.
2021-01-14 08:52:22 +01:00
Simon Hausmann
de4194c9ba
Make ItemRenderer take &mut again
...
It's cleaner and indeed possible
2021-01-14 08:52:22 +01:00
Olivier Goffart
16a1b7b2bd
Cache the pixmap in the native style
2021-01-14 08:52:22 +01:00
Simon Hausmann
43127cb059
Implement releasing of textures when items are destroyed
...
This means going back to an immutable renderer reference and interior
mutability for the canvas and the gpu cache. This is because while
traversing the item tree for rendering we may end up destroying
other items due to the lazyness of the models.
2021-01-14 08:52:22 +01:00
Simon Hausmann
1f9ba94c59
Rename the image cache
...
... to a more general gpu_cache and store an enum. That way we can
encapsulate the resource releasing - in the future - entirely in the
backend through run-time polymorphism in the backend (gpu cache data
enum) instead of a vtable method in the item to destruct the correct
type of data.
2021-01-14 08:52:22 +01:00
Olivier Goffart
b157648ab2
More work towards getting native widget with the femtovg backend
2021-01-14 08:52:22 +01:00
Simon Hausmann
e334efbcc5
Fix borrow error panic
...
Don't try to borrow the backend mutably when destroying items.
2021-01-14 08:52:22 +01:00
Olivier Goffart
f7c8d53e7a
Port the Qt Native item to the new API
...
this mostly restores code that was removed in commit 1a260b9dce13db38128f1f489633ba96f264d461
2021-01-14 08:52:22 +01:00
Simon Hausmann
d159a3b523
Implement caching of images
...
Don't re-load/decode the image every frame (and leak it), just load it
once per source change.
2021-01-14 08:52:22 +01:00
Olivier Goffart
4e9021b550
Use a type alias so that cbindgen generates the ItemVTable
2021-01-14 08:52:22 +01:00
Simon Hausmann
d92fe445d5
Remove the old GL renderer
...
and try to stub in the hooks to trigger the new one
2021-01-14 08:52:22 +01:00
Simon Hausmann
607fecdb18
Simplify rendering interface
...
Instead of passing through a generic transformation matrix, let's just
pass through what we actually use: a translation point
2021-01-14 08:52:22 +01:00
Simon Hausmann
d4f603246c
WIP: Start a femtovg backend
2021-01-14 08:52:22 +01:00
Simon Hausmann
8dea0c88d1
Beginning of a different way of rendering items
...
This is the start of a different rendering abstraction, the result of a
separate discussion.
The objective is to provide a better backend encapsulation, that will
make it easier to implement other backends and let the backend decide
what to cache and what not. This is done by passing the struct with the
Property<> fields directly to the backend, so that it can decide what
the cache and what to use every time.
2021-01-14 08:52:22 +01:00
Olivier Goffart
b126d2056a
Remove the color property from clip
2021-01-07 17:06:50 +01:00
Olivier Goffart
40ebf16257
Fix build without the rtti feature
2021-01-05 09:48:04 +01:00
Olivier Goffart
b42c16851a
Use the color property of the window as a background
2020-12-18 16:54:19 +01:00
Olivier Goffart
61399e566a
Add a title to the Window
...
also add a color, but not yet implemented
2020-12-18 16:47:14 +01:00
Olivier Goffart
16f5a03c14
Run cargo fmt
2020-12-18 10:29:15 +01:00
Olivier Goffart
dfa25b96f7
Rename SharedArray to SharedVector
2020-12-18 10:26:07 +01:00
Olivier Goffart
0d2d48be4f
Rename "signal" to "callback"
2020-12-18 09:51:01 +01:00
Simon Hausmann
ca1fb8ab0d
Fix GPU primitive vs. rendering variable division for Rectangle
...
Changing the border radius or border width does not require uploading a new geometry.
Therefore these can become rendering variables.
2020-12-15 18:08:33 +01:00
Olivier Goffart
2b5213c408
Refactor the rendering variables in a enum instead of an array
...
And finish the ImageFit::contain implementation
2020-12-15 12:16:44 +01:00
Simon Hausmann
625978fe1a
WIP: Add an image-fit property to Image/ClippedImage
2020-12-15 10:26:54 +01:00
Olivier Goffart
63a0d9308b
Bump version
2020-12-14 08:49:54 +01:00
Olivier Goffart
f6d60c2662
Update winit
2020-12-11 16:17:45 +01:00
Olivier Goffart
a949570c57
Timer in C++
2020-12-10 13:08:58 +01:00
Olivier Goffart
395e11a558
Change the default window title
2020-12-10 10:52:33 +01:00
Simon Hausmann
3ead4813e2
Fix build
...
Ammend the parent commit by making the `Signal` import conditional to
RTTI.
2020-12-10 09:46:25 +01:00
Simon Hausmann
753ea9eee8
Fix warning about unused import
2020-12-10 09:41:52 +01:00
Olivier Goffart
e75f617125
Fix event loop being blocked because it wouldn't notice that animation is still running
...
The active_animation was set to false, but if the animation tick did not change, the animation tick
was not maked dirty, and we wouldn't then re-evaluate animated property that would set the
active_animation to true again
2020-12-09 17:28:14 +01:00
Simon Hausmann
447bc9aa6d
Split the text and image items into text.rs/image.rs
2020-12-08 17:19:31 +01:00
Olivier Goffart
198a1e17c1
Close the combobox on click
2020-12-07 17:08:48 +01:00
Olivier Goffart
125ec13f24
Bump version numbers
...
Note: this does not update the documentation yet
2020-12-07 15:41:29 +01:00
Olivier Goffart
6cde0ec836
Update strum version
2020-12-07 11:29:02 +01:00
Simon Hausmann
1e683de64d
Simplify Rust Timer API
...
Don't require the caller to Box the closure. With the assumption that
the majority of callers *want* the closure to be boxed (i.e. it's not
already boxed), the API becomes easier to use.
2020-12-04 10:57:19 +01:00
Simon Hausmann
2cc86d3753
Add support for standalone singleshot timers
...
This allows registering an FcOnce callback for single timer use.
2020-12-03 18:54:16 +01:00