summaryrefslogtreecommitdiffstats
path: root/wgpu/src/widget/canvas/path
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-04-14 06:49:15 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-04-14 06:49:15 +0200
commitc545af35773307d16eca7ec03ed4794f26491da2 (patch)
treec8bdb7f54cfbdaaeec079ade9c9ea991f38f0c20 /wgpu/src/widget/canvas/path
parent5c923fce4866bcda0d2d2c1023bb046cd92038cc (diff)
downloadiced-c545af35773307d16eca7ec03ed4794f26491da2.tar.gz
iced-c545af35773307d16eca7ec03ed4794f26491da2.tar.bz2
iced-c545af35773307d16eca7ec03ed4794f26491da2.zip
Implement `canvas::Path::rectangle` helper method
Diffstat (limited to 'wgpu/src/widget/canvas/path')
-rw-r--r--wgpu/src/widget/canvas/path/builder.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/wgpu/src/widget/canvas/path/builder.rs b/wgpu/src/widget/canvas/path/builder.rs
index a013149e..6511fa52 100644
--- a/wgpu/src/widget/canvas/path/builder.rs
+++ b/wgpu/src/widget/canvas/path/builder.rs
@@ -133,11 +133,14 @@ impl Builder {
///
/// [`Path`]: struct.Path.html
#[inline]
- pub fn rectangle(&mut self, p: Point, size: Size) {
- self.move_to(p);
- self.line_to(Point::new(p.x + size.width, p.y));
- self.line_to(Point::new(p.x + size.width, p.y + size.height));
- self.line_to(Point::new(p.x, p.y + size.height));
+ pub fn rectangle(&mut self, top_left: Point, size: Size) {
+ self.move_to(top_left);
+ self.line_to(Point::new(top_left.x + size.width, top_left.y));
+ self.line_to(Point::new(
+ top_left.x + size.width,
+ top_left.y + size.height,
+ ));
+ self.line_to(Point::new(top_left.x, top_left.y + size.height));
self.close();
}