Replace time with std::time in components/gfx (#31168)

* Replace time with std::time in components/gfx

Signed-off-by: devjos <github_11837948@feido.de>

* Remove time dependency in components/gfx/Cargo.toml

Signed-off-by: devjos <github_11837948@feido.de>

---------

Signed-off-by: devjos <github_11837948@feido.de>
This commit is contained in:
Johannes S 2024-01-25 09:31:40 +01:00 committed by GitHub
parent af6652fc09
commit 886f6c58d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 6 deletions

View file

@ -8,6 +8,7 @@ use std::collections::HashMap;
use std::rc::Rc;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use std::time::Instant;
use std::{iter, str};
use app_units::Au;
@ -253,7 +254,7 @@ impl Font {
.borrow_mut()
.entry(lookup_key)
.or_insert_with(|| {
let start_time = time::precise_time_ns();
let start_time = Instant::now();
let mut glyphs = GlyphStore::new(
text.len(),
options
@ -276,9 +277,11 @@ impl Font {
.shape_text(text, options, &mut glyphs);
}
let end_time = time::precise_time_ns();
TEXT_SHAPING_PERFORMANCE_COUNTER
.fetch_add((end_time - start_time) as usize, Ordering::Relaxed);
let end_time = Instant::now();
TEXT_SHAPING_PERFORMANCE_COUNTER.fetch_add(
(end_time.duration_since(start_time).as_nanos()) as usize,
Ordering::Relaxed,
);
Arc::new(glyphs)
})
.clone();