From 1beeaf9db5e4d9bcf9c1fce89463ad47c708b07d Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 12 Feb 2020 09:12:15 +0100 Subject: Fix examples using `Mesh2D` --- examples/bezier_tool/src/main.rs | 52 ++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 31 deletions(-) (limited to 'examples/bezier_tool/src') diff --git a/examples/bezier_tool/src/main.rs b/examples/bezier_tool/src/main.rs index 043d265c..fbb6fa24 100644 --- a/examples/bezier_tool/src/main.rs +++ b/examples/bezier_tool/src/main.rs @@ -102,7 +102,7 @@ mod bezier { // Draw rectangle border with lyon. basic_shapes::stroke_rectangle( &lyon::math::Rect::new( - lyon::math::Point::new(bounds.x + 0.5, bounds.y + 0.5), + lyon::math::Point::new(0.5, 0.5), lyon::math::Size::new( bounds.width - 1.0, bounds.height - 1.0, @@ -121,48 +121,35 @@ mod bezier { for curve in self.curves { path_builder.move_to(lyon::math::Point::new( - curve.from.x + bounds.x, - curve.from.y + bounds.y, + curve.from.x, + curve.from.y, )); path_builder.quadratic_bezier_to( - lyon::math::Point::new( - curve.control.x + bounds.x, - curve.control.y + bounds.y, - ), - lyon::math::Point::new( - curve.to.x + bounds.x, - curve.to.y + bounds.y, - ), + lyon::math::Point::new(curve.control.x, curve.control.y), + lyon::math::Point::new(curve.to.x, curve.to.y), ); } match self.state.pending { None => {} Some(Pending::One { from }) => { - path_builder.move_to(lyon::math::Point::new( - from.x + bounds.x, - from.y + bounds.y, - )); + path_builder + .move_to(lyon::math::Point::new(from.x, from.y)); path_builder.line_to(lyon::math::Point::new( - cursor_position.x, - cursor_position.y, + cursor_position.x - bounds.x, + cursor_position.y - bounds.y, )); } Some(Pending::Two { from, to }) => { - path_builder.move_to(lyon::math::Point::new( - from.x + bounds.x, - from.y + bounds.y, - )); + path_builder + .move_to(lyon::math::Point::new(from.x, from.y)); path_builder.quadratic_bezier_to( lyon::math::Point::new( - cursor_position.x, - cursor_position.y, - ), - lyon::math::Point::new( - to.x + bounds.x, - to.y + bounds.y, + cursor_position.x - bounds.x, + cursor_position.y - bounds.y, ), + lyon::math::Point::new(to.x, to.y), ); } } @@ -186,10 +173,13 @@ mod bezier { ) .unwrap(); - let mesh = Primitive::Mesh2D(Arc::new(Mesh2D { - vertices: buffer.vertices, - indices: buffer.indices, - })); + let mesh = Primitive::Mesh2D { + origin: Point::new(bounds.x, bounds.y), + buffers: Arc::new(Mesh2D { + vertices: buffer.vertices, + indices: buffer.indices, + }), + }; ( Primitive::Clip { -- cgit From f5c80a6d75d5022b175d3562f0965598b6398bd7 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 14 Feb 2020 05:42:19 +0100 Subject: Upgrade `Mesh2D` indices from `u16` to `u32` --- examples/bezier_tool/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/bezier_tool/src') diff --git a/examples/bezier_tool/src/main.rs b/examples/bezier_tool/src/main.rs index fbb6fa24..efdb3924 100644 --- a/examples/bezier_tool/src/main.rs +++ b/examples/bezier_tool/src/main.rs @@ -94,7 +94,7 @@ mod bezier { layout: Layout<'_>, cursor_position: Point, ) -> (Primitive, MouseCursor) { - let mut buffer: VertexBuffers = VertexBuffers::new(); + let mut buffer: VertexBuffers = VertexBuffers::new(); let mut path_builder = lyon::path::Path::builder(); let bounds = layout.bounds(); -- cgit From dadae122533ae0916bebd04d6efab3de145263d4 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 15 Feb 2020 10:08:27 +0100 Subject: Implement MSAA for `triangle` pipeline in `iced_wgpu` --- examples/bezier_tool/src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'examples/bezier_tool/src') diff --git a/examples/bezier_tool/src/main.rs b/examples/bezier_tool/src/main.rs index efdb3924..023eb0f7 100644 --- a/examples/bezier_tool/src/main.rs +++ b/examples/bezier_tool/src/main.rs @@ -286,7 +286,10 @@ use iced::{ }; pub fn main() { - Example::run(Settings::default()) + Example::run(Settings { + antialiasing: true, + ..Settings::default() + }); } #[derive(Default)] -- cgit From 570f769744aabce2d9d9618feadb47e4b92f50ca Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 15 Feb 2020 10:50:07 +0100 Subject: Rename `Settings::antialiasing` to `use_antialiasing` --- examples/bezier_tool/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/bezier_tool/src') diff --git a/examples/bezier_tool/src/main.rs b/examples/bezier_tool/src/main.rs index 023eb0f7..01f8f847 100644 --- a/examples/bezier_tool/src/main.rs +++ b/examples/bezier_tool/src/main.rs @@ -287,7 +287,7 @@ use iced::{ pub fn main() { Example::run(Settings { - antialiasing: true, + use_antialiasing: true, ..Settings::default() }); } -- cgit From 6f7247ca13181bcdfe1a3065215c1b3204723b84 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 18 Feb 2020 09:54:24 +0100 Subject: Rename `Settings::use_antialiasing` to `antialiasing` --- examples/bezier_tool/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/bezier_tool/src') diff --git a/examples/bezier_tool/src/main.rs b/examples/bezier_tool/src/main.rs index 01f8f847..023eb0f7 100644 --- a/examples/bezier_tool/src/main.rs +++ b/examples/bezier_tool/src/main.rs @@ -287,7 +287,7 @@ use iced::{ pub fn main() { Example::run(Settings { - use_antialiasing: true, + antialiasing: true, ..Settings::default() }); } -- cgit