Fix flickering freq/gain options views.

Was caused by invalidating ALL of the parent view, when only the overlapping views would need to be repainted.
This commit is contained in:
Jared Boone 2016-01-27 21:47:10 -08:00
parent b801366e4e
commit 275b644edd
2 changed files with 13 additions and 1 deletions

View File

@ -95,7 +95,9 @@ void Widget::hidden(bool hide) {
// If parent is hidden, either of these is a no-op.
if( hide ) {
parent()->set_dirty();
// TODO: Instead of dirtying parent entirely, dirty only children
// that overlap with this widget.
parent()->dirty_overlapping_children_in_rect(parent_rect);
/* TODO: Notify self and all non-hidden children that they're
* now effectively hidden?
*/
@ -198,6 +200,14 @@ void Widget::visible(bool v) {
}
}
void Widget::dirty_overlapping_children_in_rect(const Rect& child_rect) {
for(auto child : children()) {
if( !child_rect.intersect(child->parent_rect).is_empty() ) {
child->set_dirty();
}
}
}
/* View ******************************************************************/
void View::set_parent_rect(const Rect new_parent_rect) {

View File

@ -131,6 +131,8 @@ protected:
.highlighted = false,
.visible = false,
};
void dirty_overlapping_children_in_rect(const Rect& child_rect);
};
class View : public Widget {