From 0e9c8d981843947d2210bf3782ddacf01ae8fff9 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 23 Mar 2013 20:30:06 +0300 Subject: improve a bit draw speed in basiccontainer class. --- src/guichan/basiccontainer.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'src/guichan') diff --git a/src/guichan/basiccontainer.cpp b/src/guichan/basiccontainer.cpp index a89e55ea4..5defa924e 100644 --- a/src/guichan/basiccontainer.cpp +++ b/src/guichan/basiccontainer.cpp @@ -264,27 +264,30 @@ namespace gcn for (WidgetListConstIterator iter = mWidgets.begin(); iter != mWidgets.end(); ++ iter) { - if ((*iter)->isVisible()) + Widget *const widget = *iter; + if (widget->isVisible()) { // If the widget has a frame, // draw it before drawing the widget - if ((*iter)->getFrameSize() > 0) + if (widget->getFrameSize() > 0) { - Rectangle rec = (*iter)->getDimension(); - rec.x -= (*iter)->getFrameSize(); - rec.y -= (*iter)->getFrameSize(); - rec.width += 2 * (*iter)->getFrameSize(); - rec.height += 2 * (*iter)->getFrameSize(); + Rectangle rec = widget->getDimension(); + const int frame = widget->getFrameSize(); + const int frame2 = frame * 2; + rec.x -= frame; + rec.y -= frame; + rec.width += frame2; + rec.height += frame2; graphics->pushClipArea(rec); BLOCK_START("BasicContainer::drawChildren 1") - (*iter)->drawFrame(graphics); + widget->drawFrame(graphics); BLOCK_END("BasicContainer::drawChildren 1") graphics->popClipArea(); } - graphics->pushClipArea((*iter)->getDimension()); + graphics->pushClipArea(widget->getDimension()); BLOCK_START("BasicContainer::drawChildren 2") - (*iter)->draw(graphics); + widget->draw(graphics); BLOCK_END("BasicContainer::drawChildren 2") graphics->popClipArea(); } -- cgit v1.2.3-70-g09d2