more retained size fixes

This commit is contained in:
2025-11-17 14:11:33 -05:00
parent b6ece4a5ee
commit b3d0dc3871
3 changed files with 24 additions and 517 deletions

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 93 KiB

BIN
perf.data

Binary file not shown.

View File

@@ -41,7 +41,7 @@ pub struct WidgetInstance {
pub textures: Vec<TextureHandle>, pub textures: Vec<TextureHandle>,
pub primitives: Vec<PrimitiveHandle>, pub primitives: Vec<PrimitiveHandle>,
pub children: Vec<Id>, pub children: Vec<Id>,
pub resize: Option<(Id, Size)>, pub resize: Option<Id>,
pub mask: MaskIdx, pub mask: MaskIdx,
pub layer: usize, pub layer: usize,
pub desired_size: Size, pub desired_size: Size,
@@ -84,25 +84,24 @@ impl<'a> PainterCtx<'a> {
return; return;
}; };
if let Some((rid, size)) = active.resize { if let Some(rid) = active.resize {
// let checked = &mut HashMap::default(); let desired = SizeCtx {
// let mut ctx = SizeCtx { checked: &mut Default::default(),
// checked, text: self.text,
// text: self.text, textures: self.textures,
// textures: self.textures, widgets: self.widgets,
// widgets: self.widgets, size: UiVec2::FULL_SIZE,
// size: UiVec2::FULL_SIZE, screen_size: self.screen_size,
// screen_size: self.screen_size, px_dependent: &mut Default::default(),
// px_dependent: self.px_dependent, id,
// id, }
// }; .size_inner(id, active.region.size());
// let desired = ctx.size_inner(id, active.region.size()); if active.desired_size != desired {
// if size != desired { self.redraw(rid);
self.redraw(rid); if self.draw_started.contains(&id) {
if self.draw_started.contains(&id) { return;
return; }
} }
// }
} }
let Some(active) = self.remove(id) else { let Some(active) = self.remove(id) else {
@@ -209,11 +208,11 @@ impl<'a> PainterCtx<'a> {
desired_size, desired_size,
layer, layer,
}; };
for (cid, size) in sized_children { for cid in sized_children.keys() {
if let Some(w) = self.active.get_mut(&cid) if let Some(w) = self.active.get_mut(cid)
&& w.resize.is_none() && w.resize.is_none()
{ {
w.resize = Some((id, size)) w.resize = Some(id)
} }
} }
for c in &old_children { for c in &old_children {
@@ -411,10 +410,9 @@ impl SizeCtx<'_> {
size size
} }
pub fn size<W>(&mut self, id: &WidgetId<W>) -> Size { pub fn size<W>(&mut self, id: &WidgetId<W>) -> Size {
// TODO: determine if this is useful if let Some(&size) = self.checked.get(&id.id) {
// if let Some(&size) = self.checked.get(&id.id) { return size;
// return size; }
// }
self.size_inner(id.id, self.size) self.size_inner(id.id, self.size)
} }
fn size_raw(&mut self, id: Id) -> Size { fn size_raw(&mut self, id: Id) -> Size {