1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 13:20:05 -04:00

Add benchmark for text layout and tesselation

This commit is contained in:
Emil Ernerfeldt
2021-02-08 22:53:31 +01:00
parent f5431f308a
commit 1c415bd8fe
4 changed files with 46 additions and 4 deletions

View File

@@ -63,7 +63,7 @@ pub use {
shape::Shape,
stats::PaintStats,
stroke::Stroke,
tessellator::TessellationOptions,
tessellator::{TessellationOptions, Tessellator},
text::{Galley, TextStyle},
texture_atlas::{Texture, TextureAtlas},
};

View File

@@ -45,6 +45,13 @@ impl Mesh {
}
}
/// Restore to default state, but without freeing memory.
pub fn clear(&mut self) {
self.indices.clear();
self.vertices.clear();
self.vertices = Default::default();
}
pub fn bytes_used(&self) -> usize {
std::mem::size_of::<Self>()
+ self.vertices.len() * std::mem::size_of::<Vertex>()

View File

@@ -218,8 +218,8 @@ impl Font {
/// `\n` will (intentionally) show up as the replacement character.
fn glyph_info(&self, c: char) -> (FontIndex, GlyphInfo) {
{
if let Some(glyph_info) = self.glyph_info_cache.read().get(&c) {
return *glyph_info;
if let Some(font_index_glyph_info) = self.glyph_info_cache.read().get(&c) {
return *font_index_glyph_info;
}
}