1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 05:40:03 -04:00

Add a bunch of #[inline]

This commit is contained in:
Emil Ernerfeldt
2023-12-18 17:22:31 +01:00
parent a726e656a4
commit 4060d02f27
2 changed files with 7 additions and 0 deletions

View File

@@ -409,6 +409,7 @@ impl Rect {
/// Linearly interpolate so that `[0, 0]` is [`Self::min`] and
/// `[1, 1]` is [`Self::max`].
#[inline]
pub fn lerp_inside(&self, t: Vec2) -> Pos2 {
Pos2 {
x: lerp(self.min.x..=self.max.x, t.x),
@@ -417,6 +418,7 @@ impl Rect {
}
/// Linearly self towards other rect.
#[inline]
pub fn lerp_towards(&self, other: &Rect, t: f32) -> Self {
Self {
min: self.min.lerp(other.min, t),
@@ -611,6 +613,7 @@ impl std::fmt::Debug for Rect {
/// from (min, max) or (left top, right bottom)
impl From<[Pos2; 2]> for Rect {
#[inline]
fn from([min, max]: [Pos2; 2]) -> Self {
Self { min, max }
}