Commit graph

573 commits

Author SHA1 Message Date
Simon Hausmann
8a3ff06eb5 Move the clipboard handling from the Backend trait into PlatformWindow
Access to the clipboard implies access to the windowing system.
2022-07-22 08:10:44 +02:00
Simon Hausmann
acaf0c3fe2 janitor: remove unecessary .rs file for module 2022-07-21 14:48:49 +02:00
Simon Hausmann
f4421116a4 Remove all femtovg specific code from the OpenGLContext type
This also removes a bunch of setup code from the GL window.

This will make it easier to use the OpenGLContext with other renderers such as Skia.
2022-07-21 14:48:49 +02:00
Simon Hausmann
a901668122 Move all use of CanvasRc from GLWindow into FemtovgRenderer 2022-07-21 14:48:49 +02:00
Simon Hausmann
da63468c22 Move the femtovg Canvas into the femtovg renderer 2022-07-21 14:48:49 +02:00
Simon Hausmann
38454dd26e Furhter improve GL renderer encapsulation
Don't access the texture/graphics cache from the item renderer through the GLWindow
but borrow them from the FemtoVG renderer directly.
2022-07-21 14:48:49 +02:00
Simon Hausmann
edfe1958e8 Add a lifetime to the GL item renderer
This allows avoiding extra RC clones.
2022-07-21 14:48:49 +02:00
Simon Hausmann
b37c995916 Move the item graphics cache to the femtovg renderer 2022-07-21 14:48:49 +02:00
Simon Hausmann
160b37cb3c Begin hiding internals of the Femtovg renderer 2022-07-21 14:48:49 +02:00
Simon Hausmann
c55878ae49 Begin separate the femtovg renderer into a module of its own 2022-07-21 14:48:49 +02:00
Olivier Goffart
c41749fc12 Rename PropertyChangeHandler to PropertyDirtyHandler
The handler is called whenever the properties it depends on becomes dirty,
not when it changes.

This has caused confusion before, so rename it
2022-07-21 13:16:40 +02:00
Olivier Goffart
7ccd36f7f2 Simplify PopupWindow handling
When the popup is implemented as an overlay on the window, no need
for the backend to do anything
2022-07-21 12:36:53 +02:00
Olivier Goffart
847a532732 Move the SVG rendering to a buffer in core 2022-07-20 12:57:37 +02:00
Olivier Goffart
ed88f75862 Remove unneeded dependencies from the gl backend
Since image rendering is now done in core
2022-07-20 12:57:37 +02:00
Simon Hausmann
4b8432c5f5 Remove unused by_address dependency 2022-07-20 12:57:37 +02:00
Simon Hausmann
5619abb878 Move ImageCacheKey into the image module
That way it'll be eaiser to deal with the code with image-decoders disabled
2022-07-20 12:57:37 +02:00
Simon Hausmann
3ef35c5ef9 WIP: compile the GL backend without image cache and its own image decoding 2022-07-20 12:57:37 +02:00
Simon Hausmann
67a2f0ce3f WIP: Make image decoding a feature of the core library
This includes the cache of decoded images, the HTMLImage element support
and the SVG rendering adapter.

The objective is that Image holds an ImageInner, which is not a path
anymore that the backend has to process, but instead always either
decoded image data, a pointer to a static texture or an SVG tree that
can be rendered to the desired size.
2022-07-20 12:57:37 +02:00
Lukas Jung
e4559f0ea6
Fix Bugs Introduced by GL Jitter on Resize Fix (#1397) 2022-07-15 10:03:03 +02:00
Simon Hausmann
9799571396 Make it possible to implement the ItemRenderer trait with a lifetime
The as_any() method returning a `&mut dyn Any` meant that the type has to be
'static. The class solution of returning &()
doesn't work because it has to be a mutable ref. Therefore just return an Option.
2022-07-12 20:37:14 +02:00
Simon Hausmann
0b20f58ada GL backend: speed up updates to layer content
Now that we store the layer textures as Rc<Texture>, before rendering a
layer we can take a clone of a possibly existing layer texture and if if
the layer's tracker is dirty, we can re-use the existing layer texture
if it's the same size.

This avoids unnecessary texture allocations.
2022-07-11 23:19:05 +02:00
Simon Hausmann
94b4f81be6 Translate logical to physical coordinates for window position and size
Our API exposes physical coordinates, Qt operates on "logical" coordinates.
2022-07-08 18:37:01 +02:00
Simon Hausmann
937c37677e Add API for setting and getting the size of a Window in Rust and C++ 2022-07-08 18:37:01 +02:00
Simon Hausmann
3ce9977f0a Add slint::Window::(set_)position
Fixes #323
2022-07-08 18:37:01 +02:00
Tobias Hunger
82000405b3
qt_accessible: Fix warning suggesting to use std::move (#1400) 2022-07-08 17:04:53 +02:00
Tobias Hunger
20c1c45253
Button: Implement support to make the Button a toggle (#1384)
Add flags that enable the Button to be used as a Toggle, e.g. for use in toolbars or similar places.

Co-authored-by: Simon Hausmann <hausmann@gmail.com>
2022-07-08 16:17:06 +02:00
Olivier Goffart
ceb030a5f7 stm32h735g: be sure to wait until the the buffer is no longer shown before drawing onto it 2022-07-06 17:06:40 +02:00
Olivier Goffart
4ecc2cd1c0 swrenderer: add a renderer that operate dirrectly on the frame buffer 2022-07-06 17:06:40 +02:00
ogoffart
6b15d2e479 Bump version number to 0.2.6 2022-07-06 09:58:14 +00:00
Lukas Jung
4f5986167b
Add Tutorial to set up VSCode Debugging for RP Pico (#1390) 2022-07-05 17:24:39 +02:00
Tobias Hunger
a30533a053 Do not needlessly create the tree of accessible items
... only do that when the OS accessibility layer requests this
data.
2022-07-05 16:53:29 +02:00
Olivier Goffart
9ee13035de Qt backend: rerun the build script when qt_accessible.rs changes as it contains C++ 2022-07-05 10:10:09 +02:00
Simon Hausmann
9661e66bb4 GL backend: reduce memory allocations for text rendering
Fix a logic bug in the function to determine if we need to fall back to
other fonts or if the font we selected provides complete coverage.

In the common case where coverage is given, we start with some unknown
coverage (in old_uncovered_*) and end up with empty
remaining_required_*_coverage. That also happens to be less than
old_uncovered_*. Since that check came first, we always returned
"Improved", which meant we still built up the font fallback list, even
though we didn't need to. Fix the order of checks to avoid that.
2022-07-05 09:26:13 +02:00
Tobias Hunger
29248f0c6f Qt: Update the accessibility tree when the component tree changes
This makes the Qt accessibility story actually useful: It will now
update as the models in the UI update:-)
2022-06-30 11:51:49 +02:00
Tobias Hunger
dd59d41ee6 Rename init_*_items to register_component
I want to track component structure changes in the window without
generating more code. So use a more generic name for the init_*_items
functions, so that I can add the functionality I need in there.

Also add a register_component to PlatformWindow and call that.
2022-06-30 11:51:49 +02:00
Tobias Hunger
581533f302 Rename free_*_graphics_resources to unregister_component
I want a more generic name as I want to do to track component structure
changes in addition to resource freeing and I do not want to add another
call into the generated code.
2022-06-30 11:51:49 +02:00
Tobias Hunger
539dec2962 a11y: Allow to update the accessibility tree
Qt sends the necessary crate/delete events automatically as the
placeholder QObjects are created/deleted.
2022-06-30 11:51:49 +02:00
Lukas Jung
63970dcced Implement size() and set_size() for SimulatorWindow 2022-06-30 10:59:33 +02:00
Lukas Jung
d63407066d Add documentation to WinitWindow::size() and set_size(). 2022-06-30 10:59:33 +02:00
Lukas Jung
e1b4727c9c Fix resize jitter bug on macOS with GL Backend 2022-06-30 10:59:33 +02:00
Olivier Goffart
deba176c72 Janitor: bump dependencies versions 2022-06-29 09:02:43 +02:00
Simon Hausmann
966e2586a6
Clean up texture caching in the GL renderer (#1375)
Clean up texture caching in the GL renderer

In preparation for moving the image decoding and caching of decoded
image data into the core library, change the texture cache to be really
a cache of textures. Previously it cached Rc<CachedImage>, which could
have also been just a CPU side image. However this was "run-time"
asserted. Instead, with this patch it's an `Rc<Texture>` and that will
always be GPU side.
2022-06-27 19:01:00 +02:00
Olivier Goffart
50bd72c535 stm32h735h: copy assets from flash to ram so we can access them 2022-06-18 20:00:21 +02:00
Olivier Goffart
00583ade05 Add env variable to put data into a different section
This also makes sixtyfps::Slice Send and Sync
2022-06-18 20:00:21 +02:00
Olivier Goffart
e777cb0fea MCU simulator: fix partial rendering by not drawing the non-dirty rect
Fixes #1324
2022-06-17 10:34:11 +02:00
Olivier Goffart
b62132392d stm32h735g: Use a intermediate line vector in the RAM for rendring
It is much faster than blending on the frame buffer which is in hyperram
2022-06-17 09:30:09 +02:00
Olivier Goffart
711fa66ca3 rp2040 backend: use DMA to send pixels to the screen via SPI 2022-06-17 09:30:09 +02:00
Olivier Goffart
5494e4ec28 mcu pico: fix the screen artifacts by re-implementing display-interface-spi
The display-interface-spi crate the not flush the internal fifo between the write
and the changes of the CS and DC pins, which result of changing these pins before
the screen recieve all the data over the spi and causes artifacts on the screen.

So re-implement the logic in our crate and use `transfer` instead of `write`
which flushes the fifo correctly.
2022-06-16 21:36:15 +02:00
Olivier Goffart
87c10eea31 MCU pico: adjust the threshold for the key handling 2022-06-16 18:31:58 +02:00
Tobias Hunger
821b5fc141
qt_accessible: Fix another warning about an unused constant (#1352) 2022-06-16 15:14:04 +02:00