diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/browserbox.cpp | 4 | ||||
-rw-r--r-- | src/gui/button.cpp | 5 | ||||
-rw-r--r-- | src/gui/checkbox.cpp | 6 | ||||
-rw-r--r-- | src/gui/equipmentwindow.cpp | 6 | ||||
-rw-r--r-- | src/gui/gui.cpp | 5 | ||||
-rw-r--r-- | src/gui/itemcontainer.cpp | 9 | ||||
-rw-r--r-- | src/gui/minimap.cpp | 4 | ||||
-rw-r--r-- | src/gui/playerbox.cpp | 4 | ||||
-rw-r--r-- | src/gui/popupmenu.cpp | 2 | ||||
-rw-r--r-- | src/gui/progressbar.cpp | 5 | ||||
-rw-r--r-- | src/gui/radiobutton.cpp | 2 | ||||
-rw-r--r-- | src/gui/scrollarea.cpp | 16 | ||||
-rw-r--r-- | src/gui/slider.cpp | 12 | ||||
-rw-r--r-- | src/gui/textfield.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/dropdown.cpp | 31 | ||||
-rw-r--r-- | src/gui/widgets/resizegrip.cpp | 2 | ||||
-rw-r--r-- | src/resources/image.cpp | 2 |
17 files changed, 44 insertions, 73 deletions
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp index 65fdde64..4a3f2f64 100644 --- a/src/gui/browserbox.cpp +++ b/src/gui/browserbox.cpp @@ -104,7 +104,7 @@ void BrowserBox::addRow(const std::string &row) std::string newRow; BROWSER_LINK bLink; int idx1, idx2, idx3; - gcn::ImageFont *font = dynamic_cast<gcn::ImageFont*>(getFont()); + gcn::ImageFont *font = static_cast<gcn::ImageFont*>(getFont()); // Use links and user defined colors if (mUseLinksAndUserColors) @@ -294,7 +294,7 @@ BrowserBox::draw(gcn::Graphics *graphics) unsigned int i, j; int x = 0, y = 0; int wrappedLines = 0; - gcn::ImageFont *font = dynamic_cast<gcn::ImageFont*>(getFont()); + gcn::ImageFont *font = static_cast<gcn::ImageFont*>(getFont()); graphics->setColor(BLACK); for (i = 0; i < mTextRows.size(); i++) diff --git a/src/gui/button.cpp b/src/gui/button.cpp index e607b66a..83d4657c 100644 --- a/src/gui/button.cpp +++ b/src/gui/button.cpp @@ -111,9 +111,8 @@ Button::draw(gcn::Graphics *graphics) mode = 0; } - dynamic_cast<Graphics*>(graphics)->drawImageRect(0, 0, - getWidth(), getHeight(), - button[mode]); + static_cast<Graphics*>(graphics)-> + drawImageRect(0, 0, getWidth(), getHeight(), button[mode]); graphics->setColor(getForegroundColor()); diff --git a/src/gui/checkbox.cpp b/src/gui/checkbox.cpp index ec7eb578..fab4780c 100644 --- a/src/gui/checkbox.cpp +++ b/src/gui/checkbox.cpp @@ -66,7 +66,7 @@ CheckBox::~CheckBox() void CheckBox::drawBox(gcn::Graphics* graphics) { - Image *box = NULL; + Image *box; if (mMarked) { if (isEnabled()) { @@ -80,7 +80,5 @@ void CheckBox::drawBox(gcn::Graphics* graphics) box = checkBoxDisabled; } - if (box != NULL) { - dynamic_cast<Graphics*>(graphics)->drawImage(box, 2, 2); - } + static_cast<Graphics*>(graphics)->drawImage(box, 2, 2); } diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index ec84491e..1ae887bc 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -65,8 +65,8 @@ void EquipmentWindow::draw(gcn::Graphics *graphics) } image = item->getInfo().getImage(); - dynamic_cast<Graphics*>(graphics)->drawImage( - image, 36 * (i % 4) + 10, 36 * (i / 4) + 25); + static_cast<Graphics*>(graphics)-> + drawImage(image, 36 * (i % 4) + 10, 36 * (i / 4) + 25); } graphics->drawRectangle(gcn::Rectangle(160, 25, 32, 32)); @@ -77,7 +77,7 @@ void EquipmentWindow::draw(gcn::Graphics *graphics) image = item->getInfo().getImage(); - dynamic_cast<Graphics*>(graphics)->drawImage(image, 160, 25); + static_cast<Graphics*>(graphics)->drawImage(image, 160, 25); graphics->drawText(toString(item->getQuantity()), 170, 62, gcn::Graphics::CENTER); } diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index b9b15429..8f1cc7f4 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -213,9 +213,8 @@ Gui::draw() if ((SDL_GetAppState() & SDL_APPMOUSEFOCUS || button & SDL_BUTTON(1)) && mCustomCursor) { - dynamic_cast<Graphics*>(mGraphics)->drawImage(mMouseCursor, - mouseX - 5, - mouseY - 2); + static_cast<Graphics*>(mGraphics)-> + drawImage(mMouseCursor, mouseX - 5, mouseY - 2); } mGraphics->popClipArea(); diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index a176f226..0e5bcce9 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -105,16 +105,13 @@ ItemContainer::draw(gcn::Graphics *graphics) // Draw selection image below selected item if (mSelectedItem == item) { - dynamic_cast<Graphics*>(graphics)->drawImage( - mSelImg, itemX, itemY); + static_cast<Graphics*>(graphics)->drawImage(mSelImg, itemX, itemY); } // Draw item icon - Image* image; - if ((image = item->getInfo().getImage()) != NULL) + if (Image *image = item->getInfo().getImage()) { - dynamic_cast<Graphics*>(graphics)->drawImage( - image, itemX, itemY); + static_cast<Graphics*>(graphics)->drawImage(image, itemX, itemY); } // Draw item caption diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 69c5eb6e..2720225d 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -72,8 +72,8 @@ void Minimap::draw(gcn::Graphics *graphics) if (mMapImage != NULL) { - dynamic_cast<Graphics*>(graphics)->drawImage( - mMapImage, getPadding(), getTitleBarHeight()); + static_cast<Graphics*>(graphics)-> + drawImage(mMapImage, getPadding(), getTitleBarHeight()); } Beings &beings = beingManager->getAll(); diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp index fad156f1..95366bee 100644 --- a/src/gui/playerbox.cpp +++ b/src/gui/playerbox.cpp @@ -80,7 +80,7 @@ PlayerBox::draw(gcn::Graphics *graphics) if (mPlayer) { // Draw character - mPlayer->draw(dynamic_cast<Graphics*>(graphics), 40, 42); + mPlayer->draw(static_cast<Graphics*>(graphics), 40, 42); } } @@ -92,5 +92,5 @@ PlayerBox::drawBorder(gcn::Graphics *graphics) w = getWidth() + bs * 2; h = getHeight() + bs * 2; - dynamic_cast<Graphics*>(graphics)->drawImageRect(0, 0, w, h, background); + static_cast<Graphics*>(graphics)->drawImageRect(0, 0, w, h, background); } diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index c7c77ef4..cc764d35 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -124,7 +124,7 @@ void PopupMenu::handleLink(const std::string& link) mBeing->getType() == Being::NPC && current_npc == 0) { - dynamic_cast<NPC*>(mBeing)->talk(); + static_cast<NPC*>(mBeing)->talk(); } // Trade action diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp index 2bdfc856..6d18b2f7 100644 --- a/src/gui/progressbar.cpp +++ b/src/gui/progressbar.cpp @@ -93,9 +93,8 @@ void ProgressBar::logic() void ProgressBar::draw(gcn::Graphics *graphics) { - dynamic_cast<Graphics*>(graphics)->drawImageRect(0, 0, - getWidth(), getHeight(), - mBorder); + static_cast<Graphics*>(graphics)-> + drawImageRect(0, 0, getWidth(), getHeight(), mBorder); // The bar if (mProgress > 0) diff --git a/src/gui/radiobutton.cpp b/src/gui/radiobutton.cpp index bbebe48f..e318116a 100644 --- a/src/gui/radiobutton.cpp +++ b/src/gui/radiobutton.cpp @@ -80,6 +80,6 @@ void RadioButton::drawBox(gcn::Graphics* graphics) } if (box != NULL) { - dynamic_cast<Graphics*>(graphics)->drawImage(box, 2, 2); + static_cast<Graphics*>(graphics)->drawImage(box, 2, 2); } } diff --git a/src/gui/scrollarea.cpp b/src/gui/scrollarea.cpp index 903ec95d..816f94a8 100644 --- a/src/gui/scrollarea.cpp +++ b/src/gui/scrollarea.cpp @@ -228,8 +228,8 @@ void ScrollArea::drawBorder(gcn::Graphics *graphics) int h = getHeight() + bs * 2; if (mOpaque) { - dynamic_cast<Graphics*>(graphics)->drawImageRect(0, 0, w, h, - background); + static_cast<Graphics*>(graphics)-> + drawImageRect(0, 0, w, h, background); } } @@ -269,8 +269,8 @@ void ScrollArea::drawButton(gcn::Graphics *graphics, BUTTON_DIR dir) break; } - dynamic_cast<Graphics*>(graphics)->drawImage( - buttons[dir][state], dim.x, dim.y); + static_cast<Graphics*>(graphics)-> + drawImage(buttons[dir][state], dim.x, dim.y); } void ScrollArea::drawUpButton(gcn::Graphics *graphics) @@ -313,14 +313,14 @@ void ScrollArea::drawVMarker(gcn::Graphics *graphics) { gcn::Rectangle dim = getVerticalMarkerDimension(); - dynamic_cast<Graphics*>(graphics)->drawImageRect( - dim.x, dim.y, dim.width, dim.height, vMarker); + static_cast<Graphics*>(graphics)-> + drawImageRect(dim.x, dim.y, dim.width, dim.height, vMarker); } void ScrollArea::drawHMarker(gcn::Graphics *graphics) { gcn::Rectangle dim = getHorizontalMarkerDimension(); - dynamic_cast<Graphics*>(graphics)->drawImageRect( - dim.x, dim.y, dim.width, dim.height, vMarker); + static_cast<Graphics*>(graphics)-> + drawImageRect(dim.x, dim.y, dim.width, dim.height, vMarker); } diff --git a/src/gui/slider.cpp b/src/gui/slider.cpp index 98efc409..f0170a1b 100644 --- a/src/gui/slider.cpp +++ b/src/gui/slider.cpp @@ -109,22 +109,22 @@ void Slider::draw(gcn::Graphics *graphics) int x = 0; int y = (h - hStart->getHeight()) / 2; - dynamic_cast<Graphics*>(graphics)->drawImage(hStart, x, y); + static_cast<Graphics*>(graphics)->drawImage(hStart, x, y); w -= hStart->getWidth() + hEnd->getWidth(); x += hStart->getWidth(); - dynamic_cast<Graphics*>(graphics)->drawImagePattern( - hMid, x, y, w, hMid->getHeight()); + static_cast<Graphics*>(graphics)-> + drawImagePattern(hMid, x, y, w, hMid->getHeight()); x += w; - dynamic_cast<Graphics*>(graphics)->drawImage(hEnd, x, y); + static_cast<Graphics*>(graphics)->drawImage(hEnd, x, y); drawMarker(graphics); } void Slider::drawMarker(gcn::Graphics *graphics) { - dynamic_cast<Graphics*>(graphics)->drawImage(hGrip, - getMarkerPosition(), (getHeight() - hGrip->getHeight()) / 2); + static_cast<Graphics*>(graphics)-> + drawImage(hGrip, getMarkerPosition(), (getHeight() - hGrip->getHeight()) / 2); } diff --git a/src/gui/textfield.cpp b/src/gui/textfield.cpp index adf41a9a..ce7f6d5f 100644 --- a/src/gui/textfield.cpp +++ b/src/gui/textfield.cpp @@ -98,5 +98,5 @@ void TextField::drawBorder(gcn::Graphics *graphics) w = getWidth() + bs * 2; h = getHeight() + bs * 2; - dynamic_cast<Graphics*>(graphics)->drawImageRect(0, 0, w, h, skin); + static_cast<Graphics*>(graphics)->drawImageRect(0, 0, w, h, skin); } 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*>(graphics)->drawImageRect(0, 0, w, h, skin); + static_cast<Graphics*>(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*>(graphics)->drawImage( - buttons[dir][state], x, y + 1); + static_cast<Graphics*>(graphics)-> + drawImage(buttons[mDroppedDown][mPushed], getWidth() - height, 1); } diff --git a/src/gui/widgets/resizegrip.cpp b/src/gui/widgets/resizegrip.cpp index 50a6fce4..6be50f2c 100644 --- a/src/gui/widgets/resizegrip.cpp +++ b/src/gui/widgets/resizegrip.cpp @@ -61,5 +61,5 @@ ResizeGrip::~ResizeGrip() void ResizeGrip::draw(gcn::Graphics *graphics) { - dynamic_cast<Graphics*>(graphics)->drawImage(gripImage, 0, 0); + static_cast<Graphics*>(graphics)->drawImage(gripImage, 0, 0); } diff --git a/src/resources/image.cpp b/src/resources/image.cpp index 993b0a2b..ad280eeb 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -343,5 +343,5 @@ SubImage::~SubImage() Image *SubImage::getSubImage(int x, int y, int w, int h) { - return NULL; + return mParent->getSubImage(mBounds.x + x, mBounds.y + y, w, h); } |