Skip to content

Commit

Permalink
Fixes Skia fallback to software renderer (#1197)
Browse files Browse the repository at this point in the history
  • Loading branch information
ultimaweapon authored Dec 21, 2024
1 parent b12a51a commit ea9dc26
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions gui/src/ui/backend/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pub(super) use self::window::Window;

use i_slint_core::graphics::RequestedGraphicsAPI;
use i_slint_renderer_skia::SkiaRenderer;
use slint::platform::WindowAdapter;
use slint::{PhysicalSize, PlatformError};
Expand Down Expand Up @@ -29,12 +30,15 @@ impl slint::platform::Platform for SlintBackend {
// Create renderer.
let win = Rc::new(win);
let size = win.inner_size();
let renderer = SkiaRenderer::new(
win.clone(),
win.clone(),
PhysicalSize::new(size.width, size.height),
)?;

let size = PhysicalSize::new(size.width, size.height);
let renderer = SkiaRenderer::default();
let api = if cfg!(target_os = "macos") {
RequestedGraphicsAPI::Metal
} else {
RequestedGraphicsAPI::Vulkan
};

renderer.set_window_handle(win.clone(), win.clone(), size, Some(api))?;
renderer.set_pre_present_callback(Some(Box::new({
let win = win.clone();

Expand Down

0 comments on commit ea9dc26

Please sign in to comment.