Checkpoint

This commit is contained in:
Antonio Scandurra 2023-10-17 08:57:20 +02:00
parent b040ae8d4d
commit 9e7a579365

View file

@ -185,6 +185,7 @@ impl LineLayoutCache {
text, text,
font_size, font_size,
runs, runs,
wrap_width,
} as &dyn AsCacheKeyRef; } as &dyn AsCacheKeyRef;
let curr_frame = self.curr_frame.upgradable_read(); let curr_frame = self.curr_frame.upgradable_read();
if let Some(layout) = curr_frame.get(key) { if let Some(layout) = curr_frame.get(key) {
@ -210,6 +211,7 @@ impl LineLayoutCache {
text: text.clone(), text: text.clone(),
font_size, font_size,
runs: SmallVec::from(runs), runs: SmallVec::from(runs),
wrap_width,
}; };
curr_frame.insert(key, wrapped_line.clone()); curr_frame.insert(key, wrapped_line.clone());
wrapped_line wrapped_line
@ -226,6 +228,7 @@ struct CacheKey {
text: SharedString, text: SharedString,
font_size: Pixels, font_size: Pixels,
runs: SmallVec<[(usize, FontId); 1]>, runs: SmallVec<[(usize, FontId); 1]>,
wrap_width: Option<Pixels>,
} }
#[derive(Copy, Clone, PartialEq, Eq)] #[derive(Copy, Clone, PartialEq, Eq)]
@ -233,6 +236,7 @@ struct CacheKeyRef<'a> {
text: &'a str, text: &'a str,
font_size: Pixels, font_size: Pixels,
runs: &'a [(usize, FontId)], runs: &'a [(usize, FontId)],
wrap_width: Option<Pixels>,
} }
impl<'a> PartialEq for (dyn AsCacheKeyRef + 'a) { impl<'a> PartialEq for (dyn AsCacheKeyRef + 'a) {
@ -255,6 +259,7 @@ impl AsCacheKeyRef for CacheKey {
text: &self.text, text: &self.text,
font_size: self.font_size, font_size: self.font_size,
runs: self.runs.as_slice(), runs: self.runs.as_slice(),
wrap_width: self.wrap_width,
} }
} }
} }