1
0
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:
Emil Ernerfeldt
2021-03-28 23:16:19 +02:00
parent ccc501f302
commit 46425f1e38
10 changed files with 144 additions and 7 deletions

View File

@@ -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
}