Olivier Goffart
55da32c343
Qt backend: fix border rectangle of the checkbox in the slide puzzle
2021-01-14 08:53:13 +01:00
Olivier Goffart
705c3f6ec0
Qt Backend: enable anti-aliasing
2021-01-14 08:53:13 +01:00
Olivier Goffart
b0d89d5fd7
Qt backend: font cache
2021-01-14 08:53:13 +01:00
Olivier Goffart
12e954ad03
Qt backend: properly clear the cache
2021-01-14 08:53:13 +01:00
Olivier Goffart
00f165f6ed
Qt backend: cache images
2021-01-14 08:53:13 +01:00
Olivier Goffart
84c7b28256
Decouple the ItemRenderer from QPainter so it can hold a cache
2021-01-14 08:53:13 +01:00
Simon Hausmann
21bd79c1b7
Prospective C++ build fix
...
Include <memory> for std::unique_ptr
2021-01-14 08:53:13 +01:00
Simon Hausmann
e74159f993
Fix license header check
2021-01-14 08:53:13 +01:00
Simon Hausmann
6b300ab194
Use the latest release of femtovg
2021-01-14 08:53:13 +01:00
Simon Hausmann
98162e6325
Implement image fitting
...
Based on the old renderer code
2021-01-14 08:53:13 +01:00
Simon Hausmann
6c24a98036
Unify image drawing functions
2021-01-14 08:53:13 +01:00
Simon Hausmann
30bc16db73
Avoid possible leaks when loading html images and then destroying the window
...
Keep weak references to the canvas, etc. for the DOM closure
2021-01-14 08:53:13 +01:00
Olivier Goffart
0b20d13401
Qt backend: Implement register_application_font_from_memory
2021-01-14 08:53:13 +01:00
Simon Hausmann
54ae1310af
Add support for loading remote images for wasm builds
2021-01-14 08:53:13 +01:00
Olivier Goffart
e77872c775
Let Qt handle all the highdpi thing, and don't borther within SixtyFPS
...
This is less than ideal, because the phx unit has no meening anymore.
Eventually we will want to do that right
2021-01-14 08:53:13 +01:00
Olivier Goffart
754020d999
Qt backend: Popup menu
2021-01-14 08:53:13 +01:00
Simon Hausmann
3dba030243
Fix wasm build
...
This re-enables the wasm port through femtovg's wasm support. The Roboto
is included as a generic fallback font.
2021-01-14 08:53:13 +01:00
Olivier Goffart
10dffa7d79
Use the QPainter directly when using the Qt paint engine
2021-01-14 08:53:13 +01:00
Olivier Goffart
46dbb1ee9e
By default, enable the GL backend also on desktop
...
So it can be chosen with an env variable or if Qt is not available
2021-01-14 08:53:13 +01:00
Olivier Goffart
58904f1858
Revert "Switch to a released version of femtovg"
...
This reverts commit cce8fb8c3863eb9b734e0a6755ebec9fd72dc895.
The version 0.1.0 of femtovg brings an old version of harfbuzz_rs
which brings a conflicting version of freetype with font-kit
2021-01-14 08:53:13 +01:00
Simon Hausmann
930ef429ef
Removed unused crate dependencies
2021-01-14 08:53:13 +01:00
Simon Hausmann
66a34cede9
Switch to a released version of femtovg
...
Only the wasm build will require a git version for now, which we'll patch.
2021-01-14 08:53:13 +01:00
Simon Hausmann
8c23155cae
Implement text selection drawing
2021-01-14 08:53:13 +01:00
Simon Hausmann
cdfc36e881
Fix clicking into text input to place the cursor
...
Implement text_offset_for_x_position
2021-01-14 08:53:13 +01:00
Simon Hausmann
743bcc77f6
Render text inputs and cursors
...
The selection is still missing
2021-01-14 08:53:13 +01:00
Simon Hausmann
cb972402e7
Fix rendering of rectangles with large borders
...
Constrain the border width by the rectangle to avoid that the border
would cancel itself out when too big.
This fixes most of the checkbox rendering in the slide puzzle.
2021-01-14 08:53:13 +01:00
Olivier Goffart
7bd1fb9ec8
Silence warning
2021-01-14 08:53:13 +01:00
Olivier Goffart
1ea522a7d0
Qt backend: Make the animation not take 100% CPU
2021-01-14 08:53:13 +01:00
Olivier Goffart
7dfc43977f
Qt backend: animations
2021-01-14 08:53:13 +01:00
Olivier Goffart
118d40d9e9
QtBackend: Timer
2021-01-14 08:53:13 +01:00
Olivier Goffart
7b4c600a4f
Fix compilation after rebase
2021-01-14 08:53:13 +01:00
Olivier Goffart
d4c357195d
Qt backend: make clicking on a TextInput not panic
2021-01-14 08:53:13 +01:00
Olivier Goffart
1eac260d99
Qt Backend: font size fixes
2021-01-14 08:53:13 +01:00
Olivier Goffart
d71bb9ab84
Qt backend: Image rendering
2021-01-14 08:53:13 +01:00
Olivier Goffart
49c9881d10
fix compile
2021-01-14 08:53:13 +01:00
Olivier Goffart
7d91651b48
Qt backend: input events
2021-01-14 08:53:13 +01:00
Olivier Goffart
4aa9faf532
Qt backend: border rectangle
2021-01-14 08:53:13 +01:00
Olivier Goffart
aeb67fa927
Qt backend: Resize event and layouting
2021-01-14 08:53:13 +01:00
Olivier Goffart
531ff42973
WIP: Qt backend using Qt
2021-01-14 08:53:13 +01:00
Simon Hausmann
35f51fe339
Clean up FontRequest interface
...
Represent a non-specified pixel size and font weight through a None option.
This is cleaner and has the added benefit that the backend can now
easily decide what the default size/weight should be.
2021-01-14 08:53:13 +01:00
Simon Hausmann
36c41ef758
Simplify font interface in the backend
...
For the GL backend a resolved font is just a handle (femtovg::FontId)
and we can cache that. Consequently we don't really need Rc<dyn Font>
but can let `fn font(...)` on the backend return a "resolved" font that
includes the pixel size, which in turn simplifies the Font trait
signatures.
The only caveat is that because on the item level we don't know what the
chosen backend type is, we can only receive a `dyn Font`, which means
it's wrapped - for now - in a Box.
2021-01-14 08:53:13 +01:00
Simon Hausmann
a684f36b8d
Simplify children clip handling
...
Use a save/restore state pattern for the entire renderer instead of passing around clip rectangles as data structure.
That's less data copying and maps naturally to existing mechanisms,
which in turn can use their own dirty handling to make
save_state/restore_state as cheap as possible.
2021-01-14 08:53:13 +01:00
Simon Hausmann
4aea74358c
Improve rendering of rectangle borders
...
The border should extend to the inside of the rectangle,
like in CSS.
2021-01-14 08:53:13 +01:00
Simon Hausmann
fa15accbbd
Load images referenced by multiple items only once
...
Re-apply the caching mechanism from the old renderer
that keeps weak references and drains them after frame rendering.
This fixes switching between the themes in the slide puzzle.
2021-01-14 08:53:13 +01:00
Simon Hausmann
edb17f996f
Move the entire custom application font handling into the backend
...
Some backends may not require a copy of the data, for example.
2021-01-14 08:53:13 +01:00
Simon Hausmann
1ed35fb628
Replace uses of FIELD_OFFSETS.foo.apply_pin(bar) with bar.foo()
2021-01-14 08:53:13 +01:00
Simon Hausmann
65dcb2cb33
Merge BuiltinItem and GeneratePropertyAccessors derive macros
...
... into the new SixtyFPSElement macro. This generates getters for all properties.
2021-01-14 08:53:13 +01:00
Simon Hausmann
a48f4253a2
Minor cleanup in draw_text
...
Create the font request on the text item side to reduce duplication and
remove the fallback logic from the font_weight accessor, in preparation
for automatic generation of that getter.
2021-01-14 08:53:13 +01:00
Simon Hausmann
a02186df22
Add support for application fonts
...
Needed to run the sliding puzzle demo
2021-01-14 08:53:13 +01:00
Olivier Goffart
0522b04d70
Rename create_gl_window to create_window
2021-01-14 08:53:13 +01:00