1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-10 15:04:32 +03:00

add Rect::bottom_right

This commit is contained in:
Wez Furlong 2019-09-21 07:31:44 -07:00
parent 6d902d8a39
commit 896586809f
2 changed files with 11 additions and 4 deletions

View File

@ -115,10 +115,7 @@ pub trait BitmapImage {
/// Draw a 1-pixel wide rectangle
fn draw_rect(&mut self, rect: Rect, color: Color, operator: Operator) {
let bottom_right = Point {
x: rect.top_left.x + rect.width as isize,
y: rect.top_left.y + rect.height as isize,
};
let bottom_right = rect.bottom_right();
// Draw the vertical lines down either side
self.draw_line(

View File

@ -56,6 +56,16 @@ pub struct Rect {
pub height: usize,
}
impl Rect {
#[inline]
pub fn bottom_right(&self) -> Point {
Point {
x: self.top_left.x + self.width as isize,
y: self.top_left.y + self.height as isize,
}
}
}
pub trait PaintContext {
fn get_dimensions(&self) -> Dimensions;