Commit graph

86 commits

Author SHA1 Message Date
Simon Hausmann
f15bc6147e Simplify FemtoVG and Skia renderer APIs: remove resize()
We can convey the new physical window size from the run-time
through the private renderer API
when a window resize event is dispatched.
2023-07-25 19:33:26 +02:00
Simon Hausmann
7d136b6568 Remove the window parameter from the render() function of all the renderers
This makes for a slimmer API and instead we can create the renderer <-> window association
behind the scenes ourselves,
in set_component.
2023-07-25 17:28:08 +02:00
Simon Hausmann
507428b03e
Simplify FemtoVG and Skia renderer API (#3153)
Fold show() into the first time render() is invoked,
and hide() into the Drop implementation.
2023-07-25 17:17:40 +02:00
Olivier Goffart
2a56e25788
C++: rename PlatformEvent to Platform::Task 2023-07-25 16:15:35 +02:00
Olivier Goffart
3a420d5769 C++ platform: return the updated region from the render function 2023-07-24 09:44:36 +02:00
Simon Hausmann
cc36915241 Add RGB565 rendering function to the C++ software renderer 2023-07-21 09:16:20 +02:00
Olivier Goffart
81bb6e2c70 C++ platform: duration_until_next_timer_update and change return type of duration_since_start 2023-07-20 10:58:33 +02:00
Olivier Goffart
de532d372a C++ experimental platform event loop 2023-07-20 10:26:09 +02:00
Olivier Goffart
3fabff9a0c C++ Platform: allow to override the duration_since_start 2023-07-14 16:12:12 +02:00
Simon Hausmann
3565023a15 Improve error handling in C++ Skia Renderer API
- Don't try to create a GLX context when we only have an XCB window handle,
  XLib is required for that.
- Make it possible to create a NativeWindowHandle from Xlib data types.

Fixes #2978
2023-07-14 15:33:03 +02:00
Olivier Goffart
4a505c6788 C++: Make the platform support work without the "std" feature
Add a experimental-platform feature that doesn't include skia
2023-07-14 10:46:21 +02:00
Aurindam Jana
5a4a7fee63
Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
Olivier Goffart
aa8ef4e302 C++: add a "std" feature to the slint-cpp crate
And make it no_std otherwise

This is a first step towards getting C++ on MCU (#2136)
2023-07-05 21:48:01 +02:00
Olivier Goffart
11dea135f7 Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
Aurindam Jana
039e54a5de
Add royalty free license to files except examples and docs (#2888) 2023-06-15 11:20:50 +02:00
Olivier Goffart
4dd10f4a78 Make WindowAdaptor::request_redraw public 2023-06-13 20:29:52 +02:00
Olivier Goffart
0e31f097a4 Un-seal the WindowAdapter trait 2023-06-13 17:44:04 +02:00
Olivier Goffart
23b910725f Rename WindowAdapterSealed to WindowAdapterInternal 2023-06-13 17:44:04 +02:00
Olivier Goffart
6341769cbd WindowAdaptor: move a few function to the public trait
Note: the addition of MinimalSoftwareWindow::set_size is there because
it would be a breaking change for user who called set_size on the
MinimalSoftwareWindow while also using the WindowAdapter trait.
This was the case of a test.
The same problem theorically exist with set_position and position, but
is unlikely to be a problem because i don't think people would use the
position with a MinimalSoftwareWindow

The renderer() is now public as well. That's because I want to make sure
that the scealed trait don't have non-provided method
2023-06-13 17:44:04 +02:00
Simon Hausmann
fb1d37286f Clean up the Skia renderer API
Accept display and window handles with life time, instead of &dyn
HasRaw*Handle.
2023-06-07 12:20:57 +02:00
Simon Hausmann
599d86e4e1 Simplify Skia renderer API
Remove the size argument from render().
2023-05-26 10:46:59 +02:00
Simon Hausmann
dd61890e23 Fix rendering of the Qt platform example with high-dpi
- Provide a C++ platform event for the scale factor change and send it
- Report the correct logical and physical sizes to Slint
2023-05-25 05:29:52 +02:00
Simon Hausmann
fe4a434ce4 Remove the WindowAdapter from the renderer constructor
This allows disentangling the native window creation from the renderer
creation, which is rather ugly and complicated on the C++ side.
2023-05-21 14:40:43 +02:00
Olivier Goffart
dd5ef9993f
Platform: Add a Resized event and use that to convey the changes in size (#2759) 2023-05-21 12:12:30 +02:00
Simon Hausmann
d9bc7a08f9 Fix crash when using experimental C++ SkiaRenderer API
Don't box the Result<Renderer, Error>, but box just the renderer.
Otherwhise the cast to the renderer pointer is nonsense.
2023-05-17 14:33:39 +02:00
Simon Hausmann
db07384e9f Remove stray outdated comment 2023-05-11 10:42:09 +02:00
Simon Hausmann
3340c31249 Clean up C++ experimental native window handle API
- Use explicit constructor functions
- Box the implementation
2023-05-11 10:42:09 +02:00
Simon Hausmann
0475b91daf skia: Simplify renderer API
Remove the generic window handle owner part of the API. Instead assume
that the caller provides safety for the given window handles, like we do
for FemtoVG and like softbuffer does it in its public API.
2023-05-11 10:42:09 +02:00
Simon Hausmann
d0cdc462c7 Simplify Skia Renderer
Allocate the renderer's surface type in the constructor.

This also changes the C++ API to match this, which complicates some code
a little bit.
2023-05-11 10:42:09 +02:00
Olivier Goffart
476ab383ea software_renderer: return the modified region from the render call
Closes #2389
2023-03-24 17:29:01 +01:00
Simon Hausmann
8ffb5131c7
Introduce error handling in the FemtoVG and Skia renderers (#2402)
Avoid unwrap() and expect() and instead propagate errors all the way
down to run_event_loop(), show(), and hide() in the Slint AIP.
2023-03-24 14:18:11 +01:00
Olivier Goffart
6889dfa5f5 Rust: Make new(), run() and show() report errors from the backend
Fixes #2198
2023-02-10 05:00:03 +01:00
Olivier Goffart
a19efc30db
Replace the MAX_BUFFER_AGE const generic with a runtime enum
Having a const generic for that didn't turn to be a good API.
Also made the C++ side more difficult

(Also renamed buffer_stride to pixel_stride)

Closes #2135
2023-02-08 14:44:01 +01:00
Simon Hausmann
6a87a07e12 Add support for showing the renderer on macOS with AppKit 2022-12-12 17:02:11 +01:00
Olivier Goffart
fe0e881418 C++ wrapper for the Skia backend 2022-12-12 17:02:11 +01:00
Olivier Goffart
8d686637f4
Experimental platform API from C++ 2022-12-12 12:54:31 +01:00