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:
@@ -63,7 +63,7 @@ pub use {
|
||||
shape::Shape,
|
||||
stats::PaintStats,
|
||||
stroke::Stroke,
|
||||
tessellator::TessellationOptions,
|
||||
tessellator::{TessellationOptions, Tessellator},
|
||||
text::{Galley, TextStyle},
|
||||
texture_atlas::{Texture, TextureAtlas},
|
||||
};
|
||||
|
||||
@@ -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>()
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user