Commit graph

185 commits

Author SHA1 Message Date
Simon Hausmann
27bf9348e6 Rename the backend-gl crate into backend-winit 2022-07-26 17:43:51 +02:00
Olivier Goffart
8c70cd7f57
Move the fonts out of the Backend trait (#1438)
and remove the `'static`
2022-07-26 16:45:54 +02:00
Olivier Goffart
793974ce9f Make just one function to fire both timers and animations
Also simplify the Qt backend since only the paint event will
query the animated properties that should then cause a refresh
one frame later
2022-07-26 15:13:07 +02:00
Olivier Goffart
dab2668598 Fix build of MCU simulator 2022-07-26 11:27:44 +02:00
Olivier Goffart
20d5cb72ed Move the init_dirty_region dirrectly into the Renderer
This means we will query the size of the popup also for the GL backend
even if the backend don't need to be marked dirty, but that should be
alright.
2022-07-25 17:53:15 +02:00
Simon Hausmann
369f347b29 Move the clipboard back from the Window to the Backend trait
Found a way to connect the clipboard to the wayland display through the winit event loop target.
2022-07-25 15:41:51 +02:00
Olivier Goffart
8287ed4b9e Some more simplifications of the PlatformWindow and Backend trait 2022-07-25 14:51:03 +02:00
Olivier Goffart
a4b859f12c Fix clearing up of caches with the simulator 2022-07-25 12:04:34 +02:00
Olivier Goffart
f7637b521f More PlatformWindow trait simplification: Component registation optional
Forward the free graphics resource to the renderer by default
2022-07-25 12:04:34 +02:00
Olivier Goffart
74c041010e Move the text functions out of the Window, into the Renderer trait 2022-07-25 12:04:34 +02:00
Simon Hausmann
f0faa8aaca Simplify code reading properties from the Window item
Use the new getter in WindowInner.
2022-07-23 13:25:44 +02:00
Simon Hausmann
58f74ba441 Clean up the background color handling in the GL backend
Just like the software renderer, query the background color when rendering
and use it as clear color.

In the simulator this was an unused field (because the sw renderer already does the right thing).
2022-07-22 23:15:35 +02:00
Simon Hausmann
0ab71ec503 Perform resolution of font properties against the window defaults in the core library
This simplifies the renderer handling - the FontRequest arriving there
will always be resolved.

And this reduces the amount of property dependencies: If a Text elements
specifies a font-family, no dependency to the window's
default-font-family is created.
2022-07-22 23:09:08 +02:00
Olivier Goffart
9794a4dfad Simplification of the PlatformWindow trait 2022-07-22 18:12:00 +02:00
Olivier Goffart
c2fe06d82d Use the public api::Window for the interface of the software renderer 2022-07-22 18:12:00 +02:00
Olivier Goffart
29404e3f2c Rename i_slint_core:🪟:Window into WindowInner
We already have `api::Window` and also the Window element (`WindowItem`),
So rename the inner part to avoid confusion
2022-07-22 18:12:00 +02:00
Simon Hausmann
c494861ddd Change set_clipboard_set to take a &str instead of a String
Every backend will do something different with the string that needs to go into the clipboard.

Qt will convert it to a QString, copypasta to a String, in theory it could be written
directly to a socket.

Given that we don't know what the perfect representation on the backend side is, passing
a string slice avoids any immediate conversions.
2022-07-22 15:21:21 +02:00
Olivier Goffart
ac4f3e97ad Change slint enum values to be PascalCase in rust
... while still being kebab-case in .slint

Some enums might become public API and we want to have them as
PascalCase to respect the rust conventions
2022-07-22 12:23:52 +02:00
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
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
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
Simon Hausmann
4b8432c5f5 Remove unused by_address dependency 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
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
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
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
Lukas Jung
63970dcced Implement size() and set_size() for SimulatorWindow 2022-06-30 10:59:33 +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
Lukas Jung
45406ddef0
Make the Pico use Interrupts and WFE (#1337) 2022-06-15 17:15:58 +02:00
Simon Hausmann
1cac472f4e Enable panic-probe by default for stm32
The ft5336 crate enforced the panic-semihosting for no apparent reason,
but this is fixed upstream now.
2022-06-15 15:16:03 +02:00
Olivier Goffart
d5e598a5d6 Janitor: Update rp-pico 2022-06-15 13:44:07 +02:00
Simon Hausmann
0c97cb0fcc Enable the data cache for stm32h7
This requires us to flash the cache before swapping the frame buffer pointer.

With slide puzzle span drawing with image tiles goes from ~100ms down to ~50ms,
and theme switching between simple and berlin from ~140ms to ~72ms.

This is with the line renderer.
2022-06-15 13:15:19 +02:00
Simon Hausmann
b7b1101adb Bump system clock frequence on stm32h735
Up to 400 Mhz seems to work. Also fixed assert to match the octospi controller for the hyperram (1 instead of 2).
2022-06-14 19:08:42 +02:00
Simon Hausmann
2d2eb70b51 Fix panic about multiple mutable borrows with the software renderer
When using repeaters - like in the slide puzzle - and during renderer a component
gets deleted, we call free_graphics_resources and try to free
the dirty rectangle list in the partial renderer cache. At that point the cache is
already mutably borrowed, which causes a panic.

As remedy, apply the mutable borrow more fine grained and not right when calling
render().
2022-06-10 08:38:34 +02:00
Olivier Goffart
dc5d1e87cd Compile fix for the MCU simulator
The mcu simulator builds i-slint-core with the std feature, but debug_log maybe
used in #[no_std] contexts, so we need to use a re-export rather than rely on std
being present
2022-06-07 00:05:01 +02:00
Olivier Goffart
a72115518d Move the software renderer to core 2022-06-04 13:40:50 +02:00
Simon Hausmann
44f7bc1279 Fix rendering of source clipped images with the MCU renderer
The slide puzzle makes use of the source-clip-* properties and that unveiled three issues:

 * For the scale factor from image space to physical pixel space (sx/sy),
   use the source clip size, as we're only drawing those
   pixels. That means that the call sites of draw_image_impl need to pass the
  correct original image size if there is no source clip.
* Similarly, the scaled_clip is in image coordinates, but needs to be relative to the source-clip-x/y
* The geometry for the target rectangle on screen
  must originate at (0, 0) so that the apllication of
  sx/sy only changes the size.
2022-06-02 15:51:07 +02:00
Olivier Goffart
6cbf2c0609 Put the new cache in corelib and use it in the GL backend 2022-05-31 10:48:24 +02:00