diff --git a/druid-shell/Cargo.toml b/druid-shell/Cargo.toml index 4706015ba8..29c052c7da 100755 --- a/druid-shell/Cargo.toml +++ b/druid-shell/Cargo.toml @@ -17,7 +17,7 @@ default-target = "x86_64-pc-windows-msvc" default = ["gtk"] gtk = ["gio", "gdk", "gdk-sys", "glib", "glib-sys", "gtk-sys", "gtk-rs", "gdk-pixbuf"] x11 = ["x11rb", "nix", "cairo-sys-rs"] -# Implement HasRawWindowHandle for WindowHandle +# Implement HasRawWindowHandle for WindowHandle raw-win-handle = ["raw-window-handle"] # passing on all the image features. AVIF is not supported because it does not @@ -40,8 +40,8 @@ hdr = ["piet-common/hdr"] [dependencies] # NOTE: When changing the piet or kurbo versions, ensure that # the kurbo version included in piet is compatible with the kurbo version specified here. -piet-common = "=0.3.2" -kurbo = "0.7.1" +piet-common = "=0.4.0" +kurbo = "0.8.1" tracing = "0.1.22" lazy_static = "1.4.0" @@ -99,7 +99,7 @@ version = "0.3.44" features = ["Window", "MouseEvent", "CssStyleDeclaration", "WheelEvent", "KeyEvent", "KeyboardEvent"] [dev-dependencies] -piet-common = { version = "=0.3.2", features = ["png"] } +piet-common = { version = "=0.4.0", features = ["png"] } static_assertions = "1.1.0" test-env-log = { version = "0.2.5", features = ["trace"], default-features = false } tracing-subscriber = "0.2.15" diff --git a/druid/Cargo.toml b/druid/Cargo.toml index 6557909aa1..19496ba4c7 100644 --- a/druid/Cargo.toml +++ b/druid/Cargo.toml @@ -78,7 +78,7 @@ console_error_panic_hook = { version = "0.1.6" } float-cmp = { version = "0.8.0", features = ["std"], default-features = false } # tempfile 3.2.0 broke wasm; I assume it will be yanked (Jan 12, 2021) tempfile = "=3.1.0" -piet-common = { version = "=0.3.2", features = ["png"] } +piet-common = { version = "=0.4.0", features = ["png"] } pulldown-cmark = { version = "0.8", default-features = false } test-env-log = { version = "0.2.5", features = ["trace"], default-features = false } diff --git a/druid/src/data.rs b/druid/src/data.rs index 7225579bd5..07b004f5b5 100644 --- a/druid/src/data.rs +++ b/druid/src/data.rs @@ -413,9 +413,18 @@ impl Data for kurbo::Rect { } } +impl Data for kurbo::RoundedRectRadii { + fn same(&self, other: &Self) -> bool { + self.top_left.same(&other.top_left) + && self.top_right.same(&other.top_right) + && self.bottom_left.same(&other.bottom_left) + && self.bottom_right.same(&other.bottom_right) + } +} + impl Data for kurbo::RoundedRect { fn same(&self, other: &Self) -> bool { - self.rect().same(&other.rect()) && self.radius().same(&other.radius()) + self.rect().same(&other.rect()) && self.radii().same(&other.radii()) } } diff --git a/druid/src/widget/flex.rs b/druid/src/widget/flex.rs index ce5f936a06..a91cfdc410 100644 --- a/druid/src/widget/flex.rs +++ b/druid/src/widget/flex.rs @@ -823,7 +823,7 @@ impl Widget for Flex { let color = env.get_debug_color(ctx.widget_id().to_raw()); let my_baseline = ctx.size().height - ctx.widget_state.baseline_offset; let line = crate::kurbo::Line::new((0.0, my_baseline), (ctx.size().width, my_baseline)); - let stroke_style = crate::piet::StrokeStyle::new().dash(vec![4.0, 4.0], 0.0); + let stroke_style = crate::piet::StrokeStyle::new().dash_pattern(&[4.0, 4.0]); ctx.stroke_styled(line, &color, 1.0, &stroke_style); } } diff --git a/druid/src/widget/svg.rs b/druid/src/widget/svg.rs index cd7038cd73..62125d5aca 100644 --- a/druid/src/widget/svg.rs +++ b/druid/src/widget/svg.rs @@ -311,7 +311,9 @@ impl SvgRenderer { let brush = self.brush_from_usvg(&stroke.paint, stroke.opacity, ctx); let mut stroke_style = StrokeStyle::new() .line_join(match stroke.linejoin { - usvg::LineJoin::Miter => LineJoin::Miter, + usvg::LineJoin::Miter => LineJoin::Miter { + limit: stroke.miterlimit.value(), + }, usvg::LineJoin::Round => LineJoin::Round, usvg::LineJoin::Bevel => LineJoin::Bevel, }) @@ -319,10 +321,10 @@ impl SvgRenderer { usvg::LineCap::Butt => LineCap::Butt, usvg::LineCap::Round => LineCap::Round, usvg::LineCap::Square => LineCap::Square, - }) - .miter_limit(stroke.miterlimit.value()); + }); if let Some(dash_array) = &stroke.dasharray { - stroke_style.set_dash(dash_array.clone(), stroke.dashoffset as f64); + stroke_style.set_dash_pattern(dash_array.clone()); + stroke_style.set_dash_offset(stroke.dashoffset as f64); } ctx.stroke_styled(path, &*brush, stroke.width.value(), &stroke_style); }