Rect needs to have and height and width.

This commit is contained in:
2015-11-16 15:13:01 +01:00
parent 5d5a693508
commit 2828a8ea04

View File

@@ -51,6 +51,9 @@ impl<T> Layer<T> where T: Clone {
else if y1 < 0 || y2 >= self.height as i32 { else if y1 < 0 || y2 >= self.height as i32 {
None None
} }
else if x2 - x1 <= 0 || y2 - y1 <= 0 {
None
}
else { else {
Some(Rect::new_unwrap(x1, y1, (x2 - x1) as u32, (y2 - y1) as u32)) Some(Rect::new_unwrap(x1, y1, (x2 - x1) as u32, (y2 - y1) as u32))
} }