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:
Simon Hausmann 2023-07-25 17:17:40 +02:00 committed by GitHub
parent 2a56e25788
commit 507428b03e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 59 additions and 116 deletions

View file

@ -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

View file

@ -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);

View file

@ -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); }

View file

@ -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()) });