Speed optimization
This commit is contained in:
parent
211ef0de58
commit
faeac76607
@ -38,9 +38,7 @@ pub fn render(
|
||||
let mut line_x = 0.0;
|
||||
let RowView { line, row, line_y, .. } = cell_view;
|
||||
|
||||
for col in 0..line.line.len() {
|
||||
let cell = &line.line[col];
|
||||
|
||||
for (col, cell) in line.line.iter().enumerate() {
|
||||
|
||||
draw_cell(&cell_view, color_model, cell, col, line_x);
|
||||
|
||||
@ -172,9 +170,9 @@ pub fn shape_dirty(
|
||||
let items = ctx.itemize(&styled_line);
|
||||
line.merge(&styled_line, &items);
|
||||
|
||||
for i in 0..line.line.len() {
|
||||
if line[i].dirty {
|
||||
if let Some(item) = line.get_item_mut(i) {
|
||||
for (col, cell) in line.line.iter_mut().enumerate() {
|
||||
if cell.dirty {
|
||||
if let Some(item) = line.item_line[col].as_mut() {
|
||||
let mut glyphs = pango::GlyphString::new();
|
||||
{
|
||||
let analysis = item.analysis();
|
||||
@ -192,7 +190,7 @@ pub fn shape_dirty(
|
||||
}
|
||||
}
|
||||
|
||||
line[i].dirty = false;
|
||||
cell.dirty = false;
|
||||
}
|
||||
|
||||
line.dirty_line = false;
|
||||
|
@ -158,15 +158,6 @@ impl Line {
|
||||
self.item_line[start_cell] = Some(Item::new(new_item.clone(), end_cell - start_cell + 1));
|
||||
}
|
||||
|
||||
pub fn get_item_mut(&mut self, cell_idx: usize) -> Option<&mut Item> {
|
||||
let item_idx = self.cell_to_item(cell_idx);
|
||||
if item_idx >= 0 {
|
||||
self.item_line[item_idx as usize].as_mut()
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_item(&self, cell_idx: usize) -> Option<&Item> {
|
||||
let item_idx = self.cell_to_item(cell_idx);
|
||||
if item_idx >= 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user