bump soft-buffer to 0.2 (#2038)

This commit is contained in:
Florian Blasius 2023-01-09 08:08:59 +00:00 committed by GitHub
parent d7e903214c
commit ed67f3aabb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 8 deletions

View file

@ -90,7 +90,3 @@ panic = "abort"
[profile.dev]
panic = "abort"
[patch.crates-io]
# Pull in fix for https://github.com/john01dav/softbuffer/issues/22
softbuffer = { git = "https://github.com/slint-ui/softbuffer", branch = "simon/macos-scale-fix" }

View file

@ -61,7 +61,7 @@ rgb = { version = "0.8.27", optional = true }
i-slint-renderer-skia = { version = "=0.3.4", path = "../../renderers/skia", optional = true }
# For the software renderer
softbuffer = { version = "0.1.1", optional = true }
softbuffer = { version = "0.2.0", optional = true }
[target.'cfg(target_arch = "wasm32")'.dependencies]
web-sys = { version = "0.3", features=["console", "WebGlContextAttributes", "CanvasRenderingContext2d", "HtmlInputElement", "HtmlCanvasElement", "Window", "Document", "CssStyleDeclaration", "Event", "KeyboardEvent", "InputEvent", "CompositionEvent"] }

View file

@ -12,7 +12,7 @@ use std::rc::{Rc, Weak};
pub struct WinitSoftwareRenderer<const MAX_BUFFER_AGE: usize> {
renderer: SoftwareRenderer<MAX_BUFFER_AGE>,
canvas: RefCell<Option<softbuffer::GraphicsContext<Rc<winit::window::Window>>>>,
canvas: RefCell<Option<softbuffer::GraphicsContext>>,
}
impl<const MAX_BUFFER_AGE: usize> super::WinitCompatibleRenderer
@ -28,8 +28,9 @@ impl<const MAX_BUFFER_AGE: usize> super::WinitCompatibleRenderer
}
fn show(&self, window: &Rc<winit::window::Window>) {
*self.canvas.borrow_mut() =
Some(unsafe { softbuffer::GraphicsContext::new(window.clone()).unwrap() });
*self.canvas.borrow_mut() = Some(unsafe {
softbuffer::GraphicsContext::new(window.as_ref(), window.as_ref()).unwrap()
});
}
fn hide(&self) {