Skip to content

Commit

Permalink
Cargo fmt after path changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchmindtree committed Aug 6, 2019
1 parent 3a859e6 commit 6eb9d88
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/draw/drawing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub struct DrawingContext<'a, S> {
/// The intermediary mesh for buffering yet-to-be-drawn paths and meshes.
pub mesh: &'a mut draw::IntermediaryMesh<S>,
/// A re-usable fill tessellator for 2D paths.
pub fill_tessellator: &'a mut FillTessellator
pub fill_tessellator: &'a mut FillTessellator,
}

/// Construct a new **Drawing** instance.
Expand Down
2 changes: 1 addition & 1 deletion src/draw/primitive/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::geom;
pub use self::ellipse::Ellipse;
pub use self::line::Line;
pub use self::mesh::Mesh;
pub use self::path::{Path, PathInit, PathFill, PathStroke};
pub use self::path::{Path, PathFill, PathInit, PathStroke};
pub use self::polygon::Polygon;
pub use self::quad::Quad;
pub use self::rect::Rect;
Expand Down
42 changes: 26 additions & 16 deletions src/draw/primitive/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,7 @@ impl PathStroke {
}

/// Submit path events as a polyline of colored points.
pub fn colored_points_closed<S, I>(
self,
ctxt: DrawingContext<S>,
points: I,
) -> Path<S>
pub fn colored_points_closed<S, I>(self, ctxt: DrawingContext<S>, points: I) -> Path<S>
where
S: BaseFloat,
I: IntoIterator,
Expand All @@ -322,10 +318,16 @@ where
I: IntoIterator<Item = PathEvent>,
for<'a> PathGeometryBuilder<'a, 'ctxt, S>: GeometryBuilder<T::VertexInput>,
{
let DrawingContext { mesh, fill_tessellator } = ctxt;
let DrawingContext {
mesh,
fill_tessellator,
} = ctxt;
let color = Cell::new(None);
let stroke = &mut StrokeTessellator::default();
let tessellators = Tessellators { fill: fill_tessellator, stroke };
let tessellators = Tessellators {
fill: fill_tessellator,
stroke,
};
let mut tessellator = T::tessellator(tessellators);
let mut builder = mesh.builder();
let res = self.opts.tessellate(
Expand Down Expand Up @@ -356,11 +358,7 @@ where
/// Consumes an iterator of points and converts them to an iterator yielding path events.
///
/// Closes the start and end points.
pub fn points_closed<'ctxt, S, I>(
self,
ctxt: DrawingContext<'ctxt, S>,
points: I,
) -> Path<S>
pub fn points_closed<'ctxt, S, I>(self, ctxt: DrawingContext<'ctxt, S>, points: I) -> Path<S>
where
S: BaseFloat,
I: IntoIterator,
Expand All @@ -383,15 +381,21 @@ where
I::Item: Into<Point2<S>>,
for<'a> PathGeometryBuilder<'a, 'ctxt, S>: GeometryBuilder<T::VertexInput>,
{
let DrawingContext { mesh, fill_tessellator } = ctxt;
let DrawingContext {
mesh,
fill_tessellator,
} = ctxt;
let color = Cell::new(None);
let iter = points.into_iter().map(Into::into).map(|p| {
let p: geom::Point2 = p.cast().expect("failed to cast point");
lyon::math::point(p.x, p.y)
});
let events = lyon::path::iterator::FromPolyline::new(close, iter).path_events();
let stroke = &mut StrokeTessellator::default();
let tessellators = Tessellators { fill: fill_tessellator, stroke };
let tessellators = Tessellators {
fill: fill_tessellator,
stroke,
};
let mut tessellator = T::tessellator(tessellators);
let mut builder = mesh.builder();
let res = self.opts.tessellate(
Expand Down Expand Up @@ -421,7 +425,10 @@ where
I::Item: Into<ColoredPoint2<S>>,
for<'a> PathGeometryBuilder<'a, 'ctxt, S>: GeometryBuilder<T::VertexInput>,
{
let DrawingContext { mesh, fill_tessellator } = ctxt;
let DrawingContext {
mesh,
fill_tessellator,
} = ctxt;
let color = Cell::new(None);
let iter = points.into_iter().map(Into::into).map(|p| {
color.set(Some(p.color));
Expand All @@ -430,7 +437,10 @@ where
});
let events = lyon::path::iterator::FromPolyline::new(close, iter).path_events();
let stroke = &mut StrokeTessellator::default();
let tessellators = Tessellators { fill: fill_tessellator, stroke };
let tessellators = Tessellators {
fill: fill_tessellator,
stroke,
};
let mut tessellator = T::tessellator(tessellators);
let mut builder = mesh.builder();
let res = self.opts.tessellate(
Expand Down
2 changes: 1 addition & 1 deletion src/geom/vector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -907,8 +907,8 @@ mod cgmath_impl {
}

mod lyon_impl {
use crate::math::Zero;
use super::{Vector2, Vector3, Vector4};
use crate::math::Zero;

impl<S> From<lyon::math::Point> for Vector2<S>
where
Expand Down

0 comments on commit 6eb9d88

Please sign in to comment.