Commit graph

1092 commits

Author SHA1 Message Date
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
Simon Hausmann
bdebb77f14 Implement Iterator for the Model in Rust 2020-12-02 12:04:32 +01:00
Olivier Goffart
e73bbbcd10 More work on signal returning value 2020-12-01 18:47:49 +01:00
Simon Hausmann
276bcd6574 Implement Model for ModelHandle
This makes extracting model data out of .60 files a little easier
2020-12-01 16:14:43 +01:00
Olivier Goffart
7bfa998f00 Popup positioning 2020-11-30 18:39:41 +01:00
Olivier Goffart
b0a9d65f55 More Popup WIP 2020-11-30 18:39:41 +01:00
Olivier Goffart
852eeb1c11 WIP popup 2020-11-30 15:20:51 +01:00
Simon Hausmann
2472eb51f0 Add the plaster font to plaster theme of the slide puzzle
For regular builds this is done by adding Rust API that allows
registering a font, and for the web the font is installed into the
browser using JavaScript API.

This is an initial approach to just add this ability. It might make
sense to introduce a syntax in the `.60` file to allow for the
registration of fonts and letting the compiler generate code that
performs this embedding and registration automatically.
2020-11-27 14:29:56 +01:00
Simon Hausmann
5274ad15ec Fix font height determination with the canvas font backend
Since TextMetrics can't give us the ascent/descent yet, the web points
towards another clever alternative: Using offsetHeight on a span and the
same font.

That allows removing the padding hack that also broke the arrow
placement in the printer demo.
2020-11-26 21:03:19 +01:00
Simon Hausmann
732f462b86 Remove unused import 2020-11-26 19:14:08 +01:00
Simon Hausmann
4d9c39537b Fix bogus "rustdoc" warning
This is just an internal comment.
2020-11-26 17:19:09 +01:00
Simon Hausmann
6b6fc1e262 Various fixes to the canvasfont backend
* When no family is specified, explicitly try to select the system font or fall back to sans-serif.
  Do avoid running into Times New Roman that way %-)
* Add padding to the canvas texture height to work around missing height measurements
  and avoid the bottom clipped glyphs that way
2020-11-26 16:56:19 +01:00
Simon Hausmann
49112cda9b Fix deprecation warning from image-rs
Bump to the latest version and use the non-deprecated API
2020-11-26 10:56:21 +01:00
Simon Hausmann
2dd459fdfd Share the glyphmetrics structure between font backends 2020-11-25 12:20:35 +01:00
Simon Hausmann
5e37fa027b A few more font docs 2020-11-25 08:44:42 +01:00
Simon Hausmann
af8df5cfbe More font handling cleanup
Rename FontHandle to PlatformFont
2020-11-25 08:39:32 +01:00
Simon Hausmann
0f7ba74abe Added some documentation for the font module
More to come :-)
2020-11-24 22:54:14 +01:00
Simon Hausmann
4e4d456687 Remove dead code 2020-11-24 22:40:58 +01:00