mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-30 23:27:22 +00:00
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.
This commit is contained in:
parent
68a255b1d2
commit
f15bc6147e
13 changed files with 20 additions and 65 deletions
|
@ -485,11 +485,6 @@ public:
|
|||
}
|
||||
|
||||
void render() const { cbindgen_private::slint_skia_renderer_render(inner); }
|
||||
|
||||
void resize(PhysicalSize size) const
|
||||
{
|
||||
cbindgen_private::slint_skia_renderer_resize(inner, size);
|
||||
}
|
||||
};
|
||||
|
||||
/// Call this function at each iteration of the event loop to call the timer handler and advance
|
||||
|
|
|
@ -445,12 +445,6 @@ pub mod skia {
|
|||
drop(Box::from_raw(r as *mut SkiaRenderer))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn slint_skia_renderer_resize(r: SkiaRendererOpaque, size: IntSize) {
|
||||
let r = &*(r as *const SkiaRenderer);
|
||||
r.resize_event(PhysicalSize { width: size.width, height: size.height }).unwrap();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn slint_skia_renderer_render(r: SkiaRendererOpaque) {
|
||||
let r = &*(r as *const SkiaRenderer);
|
||||
|
|
|
@ -89,8 +89,6 @@ struct MyWindowAdapter : public slint_platform::WindowAdapter
|
|||
|
||||
void resize(uint32_t width, uint32_t height)
|
||||
{
|
||||
slint::PhysicalSize windowSize({ width, height });
|
||||
m_renderer->resize(windowSize);
|
||||
dispatch_resize_event(slint::LogicalSize({ (float)width, (float)height }));
|
||||
}
|
||||
|
||||
|
|
|
@ -121,9 +121,6 @@ public:
|
|||
void resizeEvent(QResizeEvent *ev) override
|
||||
{
|
||||
auto logicalSize = ev->size();
|
||||
float scale_factor = devicePixelRatio();
|
||||
m_renderer->resize(slint::PhysicalSize({ uint32_t(logicalSize.width() * scale_factor),
|
||||
uint32_t(logicalSize.height() * scale_factor) }));
|
||||
WindowAdapter::dispatch_resize_event(
|
||||
slint::LogicalSize({ float(logicalSize.width()), float(logicalSize.height()) }));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue