From d61fdaf1932724f86a68484c4a05195ca270646e Mon Sep 17 00:00:00 2001 From: Guillaume Melquiond Date: Fri, 27 Jul 2007 22:30:19 +0000 Subject: Removed useless yet costly dynamic casts. --- src/gui/widgets/dropdown.cpp | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) (limited to 'src/gui/widgets/dropdown.cpp') diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 0bf0e673..1176ef2a 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -145,7 +145,7 @@ void DropDown::draw(gcn::Graphics* graphics) graphics->setColor(highlightColor); graphics->drawLine(0, h, getWidth(), h); graphics->setColor(shadowColor); - graphics->drawLine(0, h + 1,getWidth(),h + 1); + graphics->drawLine(0, h + 1, getWidth(), h + 1); } } @@ -156,34 +156,13 @@ void DropDown::drawBorder(gcn::Graphics *graphics) w = getWidth() + bs * 2; h = getHeight() + bs * 2; - dynamic_cast(graphics)->drawImageRect(0, 0, w, h, skin); + static_cast(graphics)->drawImageRect(0, 0, w, h, skin); } void DropDown::drawButton(gcn::Graphics *graphics) { + int height = mDroppedDown ? mOldH : getHeight(); - unsigned short state = 0; - unsigned short dir = 0; - gcn::Rectangle dim; - - if (mPushed) - state = 1; - - if (mDroppedDown) - dir = 1; - - int height; - if (mDroppedDown) - { - height = mOldH; - } - else - { - height = getHeight(); - } - int x = getWidth() - height; - int y = 0; - - dynamic_cast(graphics)->drawImage( - buttons[dir][state], x, y + 1); + static_cast(graphics)-> + drawImage(buttons[mDroppedDown][mPushed], getWidth() - height, 1); } -- cgit v1.2.3-60-g2f50