Merge pull request #1384 from iced-rs/update-lyon

Update `lyon` to `1.0`
This commit is contained in:
Héctor Ramón 2022-07-11 18:22:04 +02:00 committed by GitHub
commit 1404b88ea6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 13 deletions

View file

@ -42,7 +42,7 @@ path = "../pure"
optional = true optional = true
[dependencies.lyon] [dependencies.lyon]
version = "0.17" version = "1.0"
optional = true optional = true
[dependencies.qrcode] [dependencies.qrcode]

View file

@ -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 /// Draws an axis-aligned rectangle given its top-left corner coordinate and
@ -141,10 +141,9 @@ impl Frame {
let options = let options =
tessellation::FillOptions::default().with_fill_rule(rule.into()); tessellation::FillOptions::default().with_fill_rule(rule.into());
let _ = self self.fill_tessellator
.fill_tessellator
.tessellate_rectangle( .tessellate_rectangle(
&lyon::math::Rect::new(top_left, size.into()), &lyon::math::Box2D::new(top_left, top_left + size),
&options, &options,
&mut buffers, &mut buffers,
) )
@ -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 /// Draws the characters of the given [`Text`] on the [`Frame`], filling

View file

@ -10,7 +10,7 @@ pub use builder::Builder;
use crate::canvas::LineDash; use crate::canvas::LineDash;
use iced_native::{Point, Size}; 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; use lyon::path::iterator::PathIterator;
/// An immutable set of points that may or may not be connected. /// 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( walk_along_path(
path.raw().iter().flattened(0.01), path.raw().iter().flattened(0.01),
0.0, 0.0,
lyon::tessellation::StrokeOptions::DEFAULT_TOLERANCE,
&mut RepeatedPattern { &mut RepeatedPattern {
callback: |position: lyon::algorithms::math::Point, callback: |event: WalkerEvent<'_>| {
_tangent,
_distance| {
let point = Point { let point = Point {
x: position.x, x: event.position.x,
y: position.y, y: event.position.y,
}; };
if draw_line { if draw_line {

View file

@ -8,7 +8,7 @@ use lyon::path::builder::SvgPathBuilder;
/// Once a [`Path`] is built, it can no longer be mutated. /// Once a [`Path`] is built, it can no longer be mutated.
#[allow(missing_debug_implementations)] #[allow(missing_debug_implementations)]
pub struct Builder { pub struct Builder {
raw: lyon::path::builder::WithSvg<lyon::path::path::Builder>, raw: lyon::path::builder::WithSvg<lyon::path::path::BuilderImpl>,
} }
impl Builder { impl Builder {