mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 02:39:28 +00:00
Simplify FemtoVG and Skia renderer API (#3153)
Fold show() into the first time render() is invoked, and hide() into the Drop implementation.
This commit is contained in:
parent
2a56e25788
commit
507428b03e
11 changed files with 59 additions and 116 deletions
|
@ -492,10 +492,6 @@ public:
|
|||
{
|
||||
cbindgen_private::slint_skia_renderer_resize(inner, size);
|
||||
}
|
||||
|
||||
void hide() const { cbindgen_private::slint_skia_renderer_hide(inner); }
|
||||
|
||||
void show() const { cbindgen_private::slint_skia_renderer_show(inner); }
|
||||
};
|
||||
|
||||
/// Call this function at each iteration of the event loop to call the timer handler and advance
|
||||
|
|
|
@ -451,18 +451,6 @@ pub mod skia {
|
|||
drop(Box::from_raw(r as *mut SkiaRenderer))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn slint_skia_renderer_show(r: SkiaRendererOpaque) {
|
||||
let r = &*(r as *const SkiaRenderer);
|
||||
r.show().unwrap()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn slint_skia_renderer_hide(r: SkiaRendererOpaque) {
|
||||
let r = &*(r as *const SkiaRenderer);
|
||||
r.hide().unwrap()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn slint_skia_renderer_resize(r: SkiaRendererOpaque, size: IntSize) {
|
||||
let r = &*(r as *const SkiaRenderer);
|
||||
|
|
|
@ -71,16 +71,11 @@ struct MyWindowAdapter : public slint_platform::WindowAdapter
|
|||
return slint::PhysicalSize({ uint32_t(r.right - r.left), uint32_t(r.bottom - r.top) });
|
||||
}
|
||||
|
||||
void show() const override
|
||||
{
|
||||
ShowWindow(hwnd, SW_SHOWNORMAL);
|
||||
m_renderer->show();
|
||||
}
|
||||
void show() const override { ShowWindow(hwnd, SW_SHOWNORMAL); }
|
||||
|
||||
void hide() const override
|
||||
{
|
||||
// TODO: destroy window
|
||||
m_renderer->hide();
|
||||
}
|
||||
|
||||
void request_redraw() const override { InvalidateRect(hwnd, nullptr, false); }
|
||||
|
|
|
@ -106,13 +106,8 @@ public:
|
|||
->dispatch_scale_factor_change_event(devicePixelRatio());
|
||||
auto window = const_cast<QWindow *>(static_cast<const QWindow *>(this));
|
||||
window->QWindow::show();
|
||||
m_renderer->show();
|
||||
}
|
||||
void hide() const override
|
||||
{
|
||||
m_renderer->hide();
|
||||
const_cast<MyWindow *>(this)->QWindow::hide();
|
||||
}
|
||||
void hide() const override { const_cast<MyWindow *>(this)->QWindow::hide(); }
|
||||
slint::PhysicalSize physical_size() const override
|
||||
{
|
||||
auto windowSize = slint::LogicalSize({ float(width()), float(height()) });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue