GUI: Implement dirty-checking for widget redraws

This commit is contained in:
Bastien Bouclet 2018-01-06 14:40:02 +01:00
parent 3b50b57f54
commit 0496ede62f
34 changed files with 245 additions and 199 deletions

View file

@ -153,7 +153,7 @@ void Dialog::releaseFocus() {
}
}
void Dialog::draw() {
void Dialog::markAsDirty() {
//TANOKU - FIXME when is this enabled? what does this do?
// Update: called on tab drawing, mainly...
// we can pass this as open a new dialog or something
@ -161,6 +161,14 @@ void Dialog::draw() {
g_gui._redrawStatus = GUI::GuiManager::kRedrawTopDialog;
}
void Dialog::markWidgetsAsDirty() {
Widget *w = _firstWidget;
while (w) {
w->markAsDirty();
w = w->_next;
}
}
void Dialog::drawDialog() {
if (!isVisible())
@ -168,6 +176,15 @@ void Dialog::drawDialog() {
g_gui.theme()->drawDialogBackground(Common::Rect(_x, _y, _x+_w, _y+_h), _backgroundType);
markWidgetsAsDirty();
drawWidgets();
}
void Dialog::drawWidgets() {
if (!isVisible())
return;
// Draw all children
Widget *w = _firstWidget;
while (w) {