Update `pathfinder_geometry`

This commit is contained in:
Patrick Walton 2020-06-23 13:00:35 -07:00
parent 23c171fb6f
commit b8055c38c1
3 changed files with 15 additions and 12 deletions

View File

@ -293,16 +293,9 @@ impl MulAssign<Vector2F> for LineSegment2F {
#[derive(Clone, Copy, Debug, Default)]
#[repr(C)]
pub struct LineSegmentU4 {
pub from: u8,
pub to: u8,
}
#[derive(Clone, Copy, Debug, Default)]
#[repr(C)]
pub struct LineSegmentU8 {
pub from_x: u8,
pub from_y: u8,
pub to_x: u8,
pub to_y: u8,
pub struct LineSegmentU16 {
pub from_x: u16,
pub from_y: u16,
pub to_x: u16,
pub to_y: u16,
}

View File

@ -327,6 +327,11 @@ impl RectI {
self.0.w() - self.0.y()
}
#[inline]
pub fn area(self) -> i32 {
self.width() * self.height()
}
#[inline]
pub fn upper_right(&self) -> Vector2I {
Vector2I(self.0.zy())

View File

@ -349,6 +349,11 @@ impl Vector2I {
Vector2I(self.0.max(other.0))
}
#[inline]
pub fn area(self) -> i32 {
self.x() * self.y()
}
#[inline]
pub fn to_f32(self) -> Vector2F {
Vector2F(self.0.to_f32x2())