From 94af34884667e78e231fb1904ae3e9fa785c9a7a Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 2 Jun 2020 04:38:55 +0200 Subject: Rename `Rectangle::round` to `snap` Also use `ceil` instead of `round`. Closes #380. --- core/src/rectangle.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'core') diff --git a/core/src/rectangle.rs b/core/src/rectangle.rs index aa23372e..ce80c661 100644 --- a/core/src/rectangle.rs +++ b/core/src/rectangle.rs @@ -126,15 +126,15 @@ impl Rectangle { } } - /// Rounds the [`Rectangle`] to __unsigned__ integer coordinates. + /// Snaps the [`Rectangle`] to __unsigned__ integer coordinates. /// /// [`Rectangle`]: struct.Rectangle.html - pub fn round(self) -> Rectangle { + pub fn snap(self) -> Rectangle { Rectangle { x: self.x as u32, y: self.y as u32, - width: (self.width + 0.5).round() as u32, - height: (self.height + 0.5).round() as u32, + width: self.width.ceil() as u32, + height: self.height.ceil() as u32, } } } -- cgit