Replaced jwidget_flush_redraw recursiveness with a std::queue.

This commit is contained in:
David Capello 2010-04-19 22:42:58 -03:00
parent 19483aed3c
commit 5c00d14cc0

View File

@ -33,13 +33,14 @@
#include "config.h"
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <stdarg.h>
#include <string.h>
#include <cassert>
#include <cctype>
#include <climits>
#include <cstdarg>
#include <cstring>
#include <queue>
#ifdef REPORT_SIGNALS
# include <stdio.h>
# include <cstdio>
#endif
#include <allegro.h>
#ifdef ALLEGRO_WINDOWS
@ -1164,15 +1165,25 @@ void jwidget_set_theme(JWidget widget, JTheme theme)
void jwidget_flush_redraw(JWidget widget)
{
std::queue<Widget*> processing;
int c, nrects;
JMessage msg;
JLink link;
JRect rc;
processing.push(widget);
while (!processing.empty()) {
widget = processing.front();
processing.pop();
assert_valid_widget(widget);
if (jwidget_is_hidden(widget))
return;
continue;
JI_LIST_FOR_EACH(widget->children, link)
processing.push((Widget*)link->data);
nrects = JI_REGION_NUM_RECTS(widget->update_region);
if (nrects > 0) {
@ -1200,9 +1211,7 @@ void jwidget_flush_redraw(JWidget widget)
jregion_empty(widget->update_region);
}
JI_LIST_FOR_EACH(widget->children, link)
jwidget_flush_redraw((JWidget)link->data);
}
}
void jwidget_invalidate(JWidget widget)