From fe34b7a339261d8fc9a96bf993d529c2ad37299c Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 11 Jul 2022 15:53:33 +0200 Subject: Update `lyon` to `1.0` :tada: Congrats and thanks to @nical! --- graphics/src/widget/canvas/frame.rs | 2 +- graphics/src/widget/canvas/path.rs | 11 +++++------ graphics/src/widget/canvas/path/builder.rs | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) (limited to 'graphics/src') diff --git a/graphics/src/widget/canvas/frame.rs b/graphics/src/widget/canvas/frame.rs index 8e198b29..0a164fa8 100644 --- a/graphics/src/widget/canvas/frame.rs +++ b/graphics/src/widget/canvas/frame.rs @@ -144,7 +144,7 @@ impl Frame { let _ = self .fill_tessellator .tessellate_rectangle( - &lyon::math::Rect::new(top_left, size.into()), + &lyon::math::Box2D::new(top_left, top_left + size), &options, &mut buffers, ) diff --git a/graphics/src/widget/canvas/path.rs b/graphics/src/widget/canvas/path.rs index f834e286..608507ad 100644 --- a/graphics/src/widget/canvas/path.rs +++ b/graphics/src/widget/canvas/path.rs @@ -10,7 +10,7 @@ pub use builder::Builder; use crate::canvas::LineDash; use iced_native::{Point, Size}; -use lyon::algorithms::walk::{walk_along_path, RepeatedPattern}; +use lyon::algorithms::walk::{walk_along_path, RepeatedPattern, WalkerEvent}; use lyon::path::iterator::PathIterator; /// An immutable set of points that may or may not be connected. @@ -81,13 +81,12 @@ pub(super) fn dashed(path: &Path, line_dash: LineDash<'_>) -> Path { walk_along_path( path.raw().iter().flattened(0.01), 0.0, + lyon::tessellation::StrokeOptions::DEFAULT_TOLERANCE, &mut RepeatedPattern { - callback: |position: lyon::algorithms::math::Point, - _tangent, - _distance| { + callback: |event: WalkerEvent<'_>| { let point = Point { - x: position.x, - y: position.y, + x: event.position.x, + y: event.position.y, }; if draw_line { diff --git a/graphics/src/widget/canvas/path/builder.rs b/graphics/src/widget/canvas/path/builder.rs index 88acf544..c49ccdc3 100644 --- a/graphics/src/widget/canvas/path/builder.rs +++ b/graphics/src/widget/canvas/path/builder.rs @@ -8,7 +8,7 @@ use lyon::path::builder::SvgPathBuilder; /// Once a [`Path`] is built, it can no longer be mutated. #[allow(missing_debug_implementations)] pub struct Builder { - raw: lyon::path::builder::WithSvg, + raw: lyon::path::builder::WithSvg, } impl Builder { -- cgit From f7059a1c9a6ce46ba833400dde860912da780464 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 11 Jul 2022 15:59:38 +0200 Subject: Remove unnecessary `let` bindings in `canvas::Frame` --- graphics/src/widget/canvas/frame.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'graphics/src') diff --git a/graphics/src/widget/canvas/frame.rs b/graphics/src/widget/canvas/frame.rs index 0a164fa8..2f46079c 100644 --- a/graphics/src/widget/canvas/frame.rs +++ b/graphics/src/widget/canvas/frame.rs @@ -110,7 +110,7 @@ impl Frame { ) }; - let _ = result.expect("Tessellate path"); + result.expect("Tessellate path"); } /// Draws an axis-aligned rectangle given its top-left corner coordinate and @@ -141,8 +141,7 @@ impl Frame { let options = tessellation::FillOptions::default().with_fill_rule(rule.into()); - let _ = self - .fill_tessellator + self.fill_tessellator .tessellate_rectangle( &lyon::math::Box2D::new(top_left, top_left + size), &options, @@ -189,7 +188,7 @@ impl Frame { ) }; - let _ = result.expect("Stroke path"); + result.expect("Stroke path"); } /// Draws the characters of the given [`Text`] on the [`Frame`], filling -- cgit