equal
deleted
inserted
replaced
309 } |
309 } |
310 |
310 |
311 impl Rect { |
311 impl Rect { |
312 pub const EMPTY: Self = Self { |
312 pub const EMPTY: Self = Self { |
313 top_left: Point::ZERO, |
313 top_left: Point::ZERO, |
314 bottom_right: Point::ZERO, |
314 bottom_right: Point::diag(-1), |
315 }; |
315 }; |
316 |
316 |
317 #[inline] |
317 #[inline] |
318 pub fn new(top_left: Point, bottom_right: Point) -> Self { |
318 pub fn new(top_left: Point, bottom_right: Point) -> Self { |
319 debug_assert!(top_left.x <= bottom_right.x + 1); |
319 debug_assert!(top_left.x <= bottom_right.x + 1); |
452 } |
452 } |
453 |
453 |
454 #[inline] |
454 #[inline] |
455 pub fn with_margins(&self, left: i32, right: i32, top: i32, bottom: i32) -> Self { |
455 pub fn with_margins(&self, left: i32, right: i32, top: i32, bottom: i32) -> Self { |
456 Self::from_box( |
456 Self::from_box( |
457 self.left() + left, |
457 self.left() - left, |
458 self.right() + right, |
458 self.right() + right, |
459 self.top() + top, |
459 self.top() - top, |
460 self.bottom() + bottom, |
460 self.bottom() + bottom, |
461 ) |
461 ) |
462 } |
462 } |
463 |
463 |
464 #[inline] |
464 #[inline] |