diff --git a/Cargo.toml b/Cargo.toml index ac20779..1dbb6d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ description = "Adwaita-like SCTK Frame" [dependencies] smithay-client-toolkit = { version = "0.17.0", default_features = false } -tiny-skia = { version = "0.8", default-features = false, features = ["std", "simd"] } +tiny-skia = { version = "0.11", default-features = false, features = ["std", "simd"] } log = "0.4" memmap2 = { version = "0.5.8", optional = true } diff --git a/src/buttons.rs b/src/buttons.rs index 3e024c2..0251175 100644 --- a/src/buttons.rs +++ b/src/buttons.rs @@ -321,7 +321,9 @@ impl Button { let x = x - hsize; let y = y - hsize; - pb.push_rect(x, y, size, size); + if let Some(rect) = Rect::from_xywh(x, y, size, size) { + pb.push_rect(rect); + } if state.contains(WindowState::MAXIMIZED) { if let Some(rect) = diff --git a/src/lib.rs b/src/lib.rs index 9899043..2802702 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,7 +3,7 @@ use std::num::NonZeroU32; use std::sync::Arc; use tiny_skia::{ - ClipMask, Color, FillRule, Path, PathBuilder, Pixmap, PixmapMut, PixmapPaint, Point, Rect, + Color, FillRule, Mask, Path, PathBuilder, Pixmap, PixmapMut, PixmapPaint, Point, Rect, Transform, }; @@ -535,13 +535,13 @@ fn draw_headerbar( if let Some(clip) = Rect::from_xywh(text_canvas_start_x, 0., text_canvas_end_x, canvas_h) { - let mut mask = ClipMask::new(); - mask.set_path( - canvas_w as u32, - canvas_h as u32, + let mut mask = Mask::new(canvas_w as u32, canvas_h as u32) + .expect("Invalid mask width and height"); + mask.fill_path( &PathBuilder::from_rect(clip), FillRule::Winding, false, + Transform::identity(), ); pixmap.draw_pixmap( x as i32,