From b94678289a5e671fc168ec58525b7aae2a56e6ec Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 3 May 2015 22:44:42 +0300 Subject: Remove useless dynamic_cast. --- src/gui/fonts/font.cpp | 12 ++++-------- src/gui/popups/popupmenu.cpp | 2 +- src/gui/widgets/tabbedarea.cpp | 2 +- src/gui/windowmenu.cpp | 12 +++++------- src/gui/windows/botcheckerwindow.cpp | 9 ++++----- src/gui/windows/chatwindow.cpp | 3 +-- 6 files changed, 16 insertions(+), 24 deletions(-) (limited to 'src/gui') diff --git a/src/gui/fonts/font.cpp b/src/gui/fonts/font.cpp index cac29d758..469d4e81c 100644 --- a/src/gui/fonts/font.cpp +++ b/src/gui/fonts/font.cpp @@ -213,12 +213,8 @@ void Font::drawString(Graphics *const graphics, return; } - Graphics *const g = dynamic_cast(graphics); - if (!g) - return; - - Color col = g->getColor(); - const Color &col2 = g->getColor2(); + Color col = graphics->getColor(); + const Color &col2 = graphics->getColor2(); const float alpha = static_cast(col.a) / 255.0F; /* The alpha value is ignored at string generation so avoid caching the @@ -240,7 +236,7 @@ void Font::drawString(Graphics *const graphics, if (image) { image->setAlpha(alpha); - g->drawImage(image, x, y); + graphics->drawImage(image, x, y); } } else @@ -262,7 +258,7 @@ void Font::drawString(Graphics *const graphics, const Image *const image = chunk2->img; if (image) - g->drawImage(image, x, y); + graphics->drawImage(image, x, y); } BLOCK_END("Font::drawString") } diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index f01a57a4e..591ccf540 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -1884,7 +1884,7 @@ void PopupMenu::showPopup(const int x, const int y, Button *const button) for (std::vector