mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 05:10:03 -04:00
Optimize: add #[inline(always)] to various low-level things
saves up to 20% (text tesselation), and at least 5% overall
This commit is contained in:
@@ -138,10 +138,12 @@ impl FontImpl {
|
||||
}
|
||||
|
||||
/// Height of one row of text. In points
|
||||
#[inline(always)]
|
||||
pub fn row_height(&self) -> f32 {
|
||||
self.height_in_points
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn pixels_per_point(&self) -> f32 {
|
||||
self.pixels_per_point
|
||||
}
|
||||
@@ -202,11 +204,13 @@ impl Font {
|
||||
slf
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn round_to_pixel(&self, point: f32) -> f32 {
|
||||
(point * self.pixels_per_point).round() / self.pixels_per_point
|
||||
}
|
||||
|
||||
/// Height of one row of text. In points
|
||||
#[inline(always)]
|
||||
pub fn row_height(&self) -> f32 {
|
||||
self.row_height
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user