mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 06:40:06 -04:00
cargo fmt
This commit is contained in:
@@ -776,7 +776,9 @@ impl GalleyCache {
|
|||||||
|
|
||||||
let hash = crate::util::hash(&job); // TODO(emilk): even faster hasher?
|
let hash = crate::util::hash(&job); // TODO(emilk): even faster hasher?
|
||||||
|
|
||||||
(hash, match self.cache.entry(hash) {
|
(
|
||||||
|
hash,
|
||||||
|
match self.cache.entry(hash) {
|
||||||
std::collections::hash_map::Entry::Occupied(entry) => {
|
std::collections::hash_map::Entry::Occupied(entry) => {
|
||||||
// The job was found in cache - no need to re-layout.
|
// The job was found in cache - no need to re-layout.
|
||||||
let cached = entry.into_mut();
|
let cached = entry.into_mut();
|
||||||
@@ -797,13 +799,17 @@ impl GalleyCache {
|
|||||||
let job = Arc::new(job);
|
let job = Arc::new(job);
|
||||||
if allow_split_paragraphs && should_cache_each_paragraph_individually(&job) {
|
if allow_split_paragraphs && should_cache_each_paragraph_individually(&job) {
|
||||||
let mut child_hashes = Vec::new();
|
let mut child_hashes = Vec::new();
|
||||||
let galley = self.layout_each_paragraph_individuallly(fonts, job, &mut child_hashes);
|
let galley =
|
||||||
|
self.layout_each_paragraph_individuallly(fonts, job, &mut child_hashes);
|
||||||
let galley = Arc::new(galley);
|
let galley = Arc::new(galley);
|
||||||
self.cache.insert(hash, CachedGalley {
|
self.cache.insert(
|
||||||
|
hash,
|
||||||
|
CachedGalley {
|
||||||
last_used: self.generation,
|
last_used: self.generation,
|
||||||
children: Some(child_hashes.into()),
|
children: Some(child_hashes.into()),
|
||||||
galley: galley.clone()
|
galley: galley.clone(),
|
||||||
});
|
},
|
||||||
|
);
|
||||||
galley
|
galley
|
||||||
} else {
|
} else {
|
||||||
let galley = super::layout(fonts, job);
|
let galley = super::layout(fonts, job);
|
||||||
@@ -816,7 +822,8 @@ impl GalleyCache {
|
|||||||
galley
|
galley
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn layout(
|
fn layout(
|
||||||
@@ -833,7 +840,7 @@ impl GalleyCache {
|
|||||||
&mut self,
|
&mut self,
|
||||||
fonts: &mut FontsImpl,
|
fonts: &mut FontsImpl,
|
||||||
job: Arc<LayoutJob>,
|
job: Arc<LayoutJob>,
|
||||||
child_hashes: &mut Vec<u64>
|
child_hashes: &mut Vec<u64>,
|
||||||
) -> Galley {
|
) -> Galley {
|
||||||
profiling::function_scope!();
|
profiling::function_scope!();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user