1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 14:50:03 -04:00

Stop wrapping FontsImpl in an Arc<Mutex<_>>

We never need to clone it, and none of its methods took `self` as
mutable, meaning it wasn't making use of the semantic difference between
the two.

This API is about to get reworked, and simplifying it is a first step.
This commit is contained in:
valadaptive
2025-07-03 18:21:08 -04:00
parent aedd43c88f
commit bbf9ac4d4b
23 changed files with 106 additions and 105 deletions

View File

@@ -165,14 +165,13 @@ pub fn criterion_benchmark(c: &mut Criterion) {
let wrap_width = 512.0;
let font_id = egui::FontId::default();
let text_color = egui::Color32::WHITE;
let fonts = egui::epaint::text::Fonts::new(
let mut fonts = egui::epaint::text::Fonts::new(
pixels_per_point,
max_texture_side,
egui::epaint::AlphaFromCoverage::default(),
egui::FontDefinitions::default(),
);
{
let mut locked_fonts = fonts.lock();
c.bench_function("text_layout_uncached", |b| {
b.iter(|| {
use egui::epaint::text::{LayoutJob, layout};
@@ -183,7 +182,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
text_color,
wrap_width,
);
layout(&mut locked_fonts.fonts, job.into())
layout(&mut fonts.fonts, job.into())
});
});
}