summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-11-06 21:13:16 +0300
committerAndrei Karas <akaras@inbox.ru>2012-11-07 12:46:08 +0300
commitd812d9fac7bae4eff66a5ce8275be19d0ca77a32 (patch)
tree7f9619d23a44202a76282849bb1284773302309f /src/gui/widgets
parent1bcaac517036751a8fee9ff3d6561f5866e6969e (diff)
downloadplus-d812d9fac7bae4eff66a5ce8275be19d0ca77a32.tar.gz
plus-d812d9fac7bae4eff66a5ce8275be19d0ca77a32.tar.bz2
plus-d812d9fac7bae4eff66a5ce8275be19d0ca77a32.tar.xz
plus-d812d9fac7bae4eff66a5ce8275be19d0ca77a32.zip
Add own profiler and profiler info to some code.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/avatarlistbox.cpp5
-rw-r--r--src/gui/widgets/browserbox.cpp3
-rw-r--r--src/gui/widgets/button.cpp5
-rw-r--r--src/gui/widgets/checkbox.cpp2
-rw-r--r--src/gui/widgets/desktop.cpp2
-rw-r--r--src/gui/widgets/dropdown.cpp4
-rw-r--r--src/gui/widgets/dropshortcutcontainer.cpp5
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/extendedlistbox.cpp2
-rw-r--r--src/gui/widgets/guitable.cpp2
-rw-r--r--src/gui/widgets/icon.cpp2
-rw-r--r--src/gui/widgets/itemcontainer.cpp7
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp8
-rw-r--r--src/gui/widgets/label.cpp2
-rw-r--r--src/gui/widgets/listbox.cpp4
-rw-r--r--src/gui/widgets/passwordfield.cpp2
-rw-r--r--src/gui/widgets/playerbox.cpp4
-rw-r--r--src/gui/widgets/popup.cpp2
-rw-r--r--src/gui/widgets/progressbar.cpp6
-rw-r--r--src/gui/widgets/progressindicator.cpp2
-rw-r--r--src/gui/widgets/radiobutton.cpp2
-rw-r--r--src/gui/widgets/scrollarea.cpp9
-rw-r--r--src/gui/widgets/shoplistbox.cpp5
-rw-r--r--src/gui/widgets/slider.cpp3
-rw-r--r--src/gui/widgets/sliderlist.cpp2
-rw-r--r--src/gui/widgets/spellshortcutcontainer.cpp3
-rw-r--r--src/gui/widgets/tab.cpp5
-rw-r--r--src/gui/widgets/tabbedarea.cpp7
-rw-r--r--src/gui/widgets/textfield.cpp4
-rw-r--r--src/gui/widgets/textpreview.cpp2
-rw-r--r--src/gui/widgets/window.cpp2
-rw-r--r--src/gui/widgets/windowcontainer.cpp11
-rw-r--r--src/gui/widgets/windowcontainer.h4
33 files changed, 126 insertions, 4 deletions
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index 1f5556a5d..dcb280596 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -89,8 +89,12 @@ AvatarListBox::~AvatarListBox()
void AvatarListBox::draw(gcn::Graphics *gcnGraphics)
{
+ BLOCK_START("AvatarListBox::draw")
if (!mListModel || !player_node)
+ {
+ BLOCK_END("AvatarListBox::draw")
return;
+ }
AvatarListModel *const model = static_cast<AvatarListModel *const>(
mListModel);
@@ -276,6 +280,7 @@ void AvatarListBox::draw(gcn::Graphics *gcnGraphics)
}
setWidth(parent->getWidth() - 10);
+ BLOCK_END("AvatarListBox::draw")
}
void AvatarListBox::mousePressed(gcn::MouseEvent &event)
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index 4d0e5e32c..1fa563915 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -335,6 +335,7 @@ void BrowserBox::mouseMoved(gcn::MouseEvent &event)
void BrowserBox::draw(gcn::Graphics *graphics)
{
+ BLOCK_START("BrowserBox::draw")
const gcn::ClipRectangle cr = graphics->getCurrentClipArea();
Graphics *const graphics2 = static_cast<Graphics *const>(graphics);
mYStart = cr.y - cr.yOffset;
@@ -400,7 +401,7 @@ void BrowserBox::draw(gcn::Graphics *graphics)
}
}
- return;
+ BLOCK_END("BrowserBox::draw")
}
int BrowserBox::calcHeight()
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index 31bde646f..5a12893a6 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -276,6 +276,7 @@ void Button::updateAlpha()
void Button::draw(gcn::Graphics *graphics)
{
+ BLOCK_START("Button::draw")
int mode;
if (!isEnabled())
@@ -289,7 +290,10 @@ void Button::draw(gcn::Graphics *graphics)
const Skin *const skin = button[mode];
if (!skin)
+ {
+ BLOCK_END("Button::draw")
return;
+ }
updateAlpha();
@@ -409,6 +413,7 @@ void Button::draw(gcn::Graphics *graphics)
g2->drawImage(mImages[mode], imageX, imageY);
g2->drawText(getCaption(), textX, textY, getAlignment());
}
+ BLOCK_END("Button::draw")
}
void Button::mouseReleased(gcn::MouseEvent& mouseEvent)
diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp
index 0c2b7ca14..786c77fd2 100644
--- a/src/gui/widgets/checkbox.cpp
+++ b/src/gui/widgets/checkbox.cpp
@@ -91,6 +91,7 @@ CheckBox::~CheckBox()
void CheckBox::draw(gcn::Graphics* graphics)
{
+ BLOCK_START("CheckBox::draw")
drawBox(graphics);
graphics->setFont(getFont());
@@ -98,6 +99,7 @@ void CheckBox::draw(gcn::Graphics* graphics)
graphics->drawText(getCaption(), mPadding + mImageSize + mSpacing,
mPadding);
+ BLOCK_END("CheckBox::draw")
}
void CheckBox::updateAlpha()
diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp
index 0a6657d3e..6079d33a8 100644
--- a/src/gui/widgets/desktop.cpp
+++ b/src/gui/widgets/desktop.cpp
@@ -82,6 +82,7 @@ void Desktop::widgetResized(const gcn::Event &event A_UNUSED)
void Desktop::draw(gcn::Graphics *graphics)
{
+ BLOCK_START("Desktop::draw")
Graphics *const g = static_cast<Graphics *const>(graphics);
if (!mWallpaper || (getWidth() > mWallpaper->getWidth() ||
@@ -112,6 +113,7 @@ void Desktop::draw(gcn::Graphics *graphics)
g->fillRectangle(gcn::Rectangle(mVersionLabel->getDimension()));
Container::draw(graphics);
+ BLOCK_END("Desktop::draw")
}
void Desktop::setBestFittingWallpaper()
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index a896b4698..bde16760b 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -186,6 +186,7 @@ void DropDown::updateAlpha()
void DropDown::draw(gcn::Graphics* graphics)
{
+ BLOCK_START("DropDown::draw")
int h;
if (mDroppedDown)
@@ -227,15 +228,18 @@ void DropDown::draw(gcn::Graphics* graphics)
graphics->setColor(mShadowColor);
graphics->drawLine(0, h + 1, getWidth(), h + 1);
}
+ BLOCK_END("DropDown::draw")
}
void DropDown::drawFrame(gcn::Graphics *graphics)
{
+ BLOCK_START("DropDown::drawFrame")
const int bs = getFrameSize();
const int w = getWidth() + bs * 2;
const int h = getHeight() + bs * 2;
static_cast<Graphics*>(graphics)->drawImageRect(0, 0, w, h, skinRect);
+ BLOCK_END("DropDown::drawFrame")
}
void DropDown::drawButton(gcn::Graphics *graphics)
diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp
index 95a09533e..756738eb0 100644
--- a/src/gui/widgets/dropshortcutcontainer.cpp
+++ b/src/gui/widgets/dropshortcutcontainer.cpp
@@ -91,6 +91,7 @@ void DropShortcutContainer::draw(gcn::Graphics *graphics)
if (!dropShortcut)
return;
+ BLOCK_START("DropShortcutContainer::draw")
if (Client::getGuiAlpha() != mAlpha)
{
mAlpha = Client::getGuiAlpha();
@@ -113,7 +114,10 @@ void DropShortcutContainer::draw(gcn::Graphics *graphics)
const Inventory *const inv = PlayerInfo::getInventory();
if (!inv)
+ {
+ BLOCK_END("DropShortcutContainer::draw")
return;
+ }
for (unsigned i = 0; i < mMaxItems; i++)
{
@@ -166,6 +170,7 @@ void DropShortcutContainer::draw(gcn::Graphics *graphics)
gcn::Graphics::CENTER);
}
}
+ BLOCK_END("DropShortcutContainer::draw")
}
void DropShortcutContainer::mouseDragged(gcn::MouseEvent &event)
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index 79abadf9c..1d1a5a60b 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -104,6 +104,7 @@ void EmoteShortcutContainer::draw(gcn::Graphics *graphics)
if (!emoteShortcut)
return;
+ BLOCK_START("EmoteShortcutContainer::draw")
mAlpha = Client::getGuiAlpha();
if (Client::getGuiAlpha() != mAlpha && mBackgroundImg)
mBackgroundImg->setAlpha(mAlpha);
@@ -157,6 +158,7 @@ void EmoteShortcutContainer::draw(gcn::Graphics *graphics)
spr->draw(g, tPosX, tPosY);
}
}
+ BLOCK_END("EmoteShortcutContainer::draw")
}
void EmoteShortcutContainer::mouseDragged(gcn::MouseEvent &event A_UNUSED)
diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp
index f1b41c03f..bb138b456 100644
--- a/src/gui/widgets/extendedlistbox.cpp
+++ b/src/gui/widgets/extendedlistbox.cpp
@@ -54,6 +54,7 @@ void ExtendedListBox::draw(gcn::Graphics *graphics)
if (!mListModel)
return;
+ BLOCK_START("ExtendedListBox::draw")
ExtendedListModel *const model = static_cast<ExtendedListModel* const>(
mListModel);
Graphics *const g = static_cast<Graphics *const>(graphics);
@@ -95,4 +96,5 @@ void ExtendedListBox::draw(gcn::Graphics *graphics)
image->getWidth() + mImagePadding + mSpacing, y + textPos);
}
}
+ BLOCK_END("ExtendedListBox::draw")
}
diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp
index 39f08340d..935fa833d 100644
--- a/src/gui/widgets/guitable.cpp
+++ b/src/gui/widgets/guitable.cpp
@@ -293,6 +293,7 @@ void GuiTable::draw(gcn::Graphics* graphics)
if (!mModel || !getRowHeight())
return;
+ BLOCK_START("GuiTable::draw")
if (Client::getGuiAlpha() != mAlpha)
mAlpha = Client::getGuiAlpha();
@@ -386,6 +387,7 @@ void GuiTable::draw(gcn::Graphics* graphics)
mTopWidget->draw(graphics);
graphics->popClipArea();
}
+ BLOCK_END("GuiTable::draw")
}
void GuiTable::moveToTop(gcn::Widget *widget)
diff --git a/src/gui/widgets/icon.cpp b/src/gui/widgets/icon.cpp
index e152d3c4b..7b4f4857e 100644
--- a/src/gui/widgets/icon.cpp
+++ b/src/gui/widgets/icon.cpp
@@ -54,10 +54,12 @@ void Icon::setImage(Image *const image)
void Icon::draw(gcn::Graphics *g)
{
+ BLOCK_START("Icon::draw")
if (mImage)
{
Graphics *const graphics = static_cast<Graphics*>(g);
graphics->drawImage(mImage, (getWidth() - mImage->mBounds.w) / 2,
(getHeight() - mImage->mBounds.h) / 2);
}
+ BLOCK_END("Icon::draw")
}
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 616c5caa2..6e9ce1657 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -208,10 +208,14 @@ ItemContainer::~ItemContainer()
void ItemContainer::logic()
{
+ BLOCK_START("ItemContainer::logic")
gcn::Widget::logic();
if (!mInventory)
+ {
+ BLOCK_END("ItemContainer::logic")
return;
+ }
const int lastUsedSlot = mInventory->getLastUsedSlot();
@@ -220,6 +224,7 @@ void ItemContainer::logic()
mLastUsedSlot = lastUsedSlot;
adjustHeight();
}
+ BLOCK_END("ItemContainer::logic")
}
void ItemContainer::draw(gcn::Graphics *graphics)
@@ -227,6 +232,7 @@ void ItemContainer::draw(gcn::Graphics *graphics)
if (!mInventory || !mShowMatrix)
return;
+ BLOCK_START("ItemContainer::draw")
Graphics *const g = static_cast<Graphics *const>(graphics);
g->setFont(getFont());
@@ -313,6 +319,7 @@ void ItemContainer::draw(gcn::Graphics *graphics)
itemY + mEquippedTextPadding, gcn::Graphics::CENTER);
}
}
+ BLOCK_END("ItemContainer::draw")
}
void ItemContainer::selectNone()
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index ccc8cb4c3..44248258c 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -100,9 +100,13 @@ void ItemShortcutContainer::setWidget2(const Widget2 *const widget)
void ItemShortcutContainer::draw(gcn::Graphics *graphics)
{
+ BLOCK_START("ItemShortcutContainer::draw")
const ItemShortcut *const selShortcut = itemShortcut[mNumber];
if (!selShortcut)
+ {
+ BLOCK_END("ItemShortcutContainer::draw")
return;
+ }
mAlpha = Client::getGuiAlpha();
if (Client::getGuiAlpha() != mAlpha)
@@ -126,7 +130,10 @@ void ItemShortcutContainer::draw(gcn::Graphics *graphics)
const Inventory *const inv = PlayerInfo::getInventory();
if (!inv)
+ {
+ BLOCK_END("ItemShortcutContainer::draw")
return;
+ }
for (unsigned i = 0; i < mMaxItems; i++)
{
@@ -231,6 +238,7 @@ void ItemShortcutContainer::draw(gcn::Graphics *graphics)
gcn::Graphics::CENTER);
}
}
+ BLOCK_END("ItemShortcutContainer::draw")
}
void ItemShortcutContainer::mouseDragged(gcn::MouseEvent &event)
diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp
index 0286caa7f..2d565a571 100644
--- a/src/gui/widgets/label.cpp
+++ b/src/gui/widgets/label.cpp
@@ -69,6 +69,7 @@ void Label::init()
void Label::draw(gcn::Graphics* graphics)
{
+ BLOCK_START("Label::draw")
int textX;
const int textY = getHeight() / 2 - getFont()->getHeight() / 2;
@@ -92,6 +93,7 @@ void Label::draw(gcn::Graphics* graphics)
graphics->setFont(getFont());
graphics->setColor(mForegroundColor);
graphics->drawText(getCaption(), textX, textY, getAlignment());
+ BLOCK_END("Label::draw")
}
void Label::adjustSize()
diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp
index b90522229..4de4e360f 100644
--- a/src/gui/widgets/listbox.cpp
+++ b/src/gui/widgets/listbox.cpp
@@ -86,6 +86,7 @@ void ListBox::draw(gcn::Graphics *graphics)
if (!mListModel)
return;
+ BLOCK_START("ListBox::draw")
updateAlpha();
mHighlightColor.a = static_cast<int>(mAlpha * 255.0f);
@@ -109,6 +110,7 @@ void ListBox::draw(gcn::Graphics *graphics)
graphics->drawText(mListModel->getElementAt(i),
mPadding, y + mPadding);
}
+ BLOCK_END("ListBox::draw")
}
void ListBox::keyPressed(gcn::KeyEvent &keyEvent)
@@ -225,11 +227,13 @@ void ListBox::refocus()
void ListBox::adjustSize()
{
+ BLOCK_START("ListBox::adjustSize")
if (mListModel)
{
setHeight(getRowHeight() * mListModel->getNumberOfElements()
+ 2 * mPadding);
}
+ BLOCK_END("ListBox::adjustSize")
}
void ListBox::logic()
diff --git a/src/gui/widgets/passwordfield.cpp b/src/gui/widgets/passwordfield.cpp
index f301f2fe7..512c12761 100644
--- a/src/gui/widgets/passwordfield.cpp
+++ b/src/gui/widgets/passwordfield.cpp
@@ -33,6 +33,7 @@ PasswordField::PasswordField(const Widget2 *const widget,
void PasswordField::draw(gcn::Graphics *graphics)
{
+ BLOCK_START("PasswordField::draw")
// std::string uses cow, thus cheap copy
const std::string original = mText;
if (mPasswordChar)
@@ -41,4 +42,5 @@ void PasswordField::draw(gcn::Graphics *graphics)
mText = "";
TextField::draw(graphics);
mText = original;
+ BLOCK_END("PasswordField::draw")
}
diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp
index 747cd91ab..f378373b2 100644
--- a/src/gui/widgets/playerbox.cpp
+++ b/src/gui/widgets/playerbox.cpp
@@ -97,6 +97,7 @@ void PlayerBox::init(std::string skin)
void PlayerBox::draw(gcn::Graphics *graphics)
{
+ BLOCK_START("PlayerBox::draw")
if (mBeing)
{
// Draw character
@@ -114,10 +115,12 @@ void PlayerBox::draw(gcn::Graphics *graphics)
mBackground.grid[a]->setAlpha(Client::getGuiAlpha());
}
}
+ BLOCK_END("PlayerBox::draw")
}
void PlayerBox::drawFrame(gcn::Graphics *graphics)
{
+ BLOCK_START("PlayerBox::drawFrame")
if (mDrawBackground)
{
int w, h, bs;
@@ -128,4 +131,5 @@ void PlayerBox::drawFrame(gcn::Graphics *graphics)
static_cast<Graphics*>(graphics)->drawImageRect(
0, 0, w, h, mBackground);
}
+ BLOCK_END("PlayerBox::drawFrame")
}
diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp
index b870d2eb1..03beec766 100644
--- a/src/gui/widgets/popup.cpp
+++ b/src/gui/widgets/popup.cpp
@@ -102,6 +102,7 @@ void Popup::setWindowContainer(WindowContainer *const wc)
void Popup::draw(gcn::Graphics *graphics)
{
+ BLOCK_START("Popup::draw")
Graphics *const g = static_cast<Graphics*>(graphics);
if (mRedraw)
@@ -116,6 +117,7 @@ void Popup::draw(gcn::Graphics *graphics)
// g->drawImageRect(0, 0, getWidth(), getHeight(), mSkin->getBorder());
drawChildren(graphics);
+ BLOCK_END("Popup::draw")
}
gcn::Rectangle Popup::getChildrenArea()
diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp
index 590447b89..ef3aa19a0 100644
--- a/src/gui/widgets/progressbar.cpp
+++ b/src/gui/widgets/progressbar.cpp
@@ -90,6 +90,7 @@ ProgressBar::~ProgressBar()
void ProgressBar::logic()
{
+ BLOCK_START("ProgressBar::logic")
if (mSmoothColorChange && mColorToGo != mColor)
{
// Smoothly changing the color for a nicer effect.
@@ -115,6 +116,7 @@ void ProgressBar::logic()
if (mProgressToGo < mProgress)
mProgress = std::max(0.0f, mProgress - 0.005f);
}
+ BLOCK_END("ProgressBar::logic")
}
void ProgressBar::updateAlpha()
@@ -139,11 +141,11 @@ void ProgressBar::updateAlpha()
void ProgressBar::draw(gcn::Graphics *graphics)
{
+ BLOCK_START("ProgressBar::draw")
updateAlpha();
-
mColor.a = static_cast<int>(mAlpha * 255);
-
render(static_cast<Graphics*>(graphics));
+ BLOCK_END("ProgressBar::draw")
}
void ProgressBar::setProgress(const float progress)
diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp
index 936e357ab..10b2bba88 100644
--- a/src/gui/widgets/progressindicator.cpp
+++ b/src/gui/widgets/progressindicator.cpp
@@ -65,6 +65,7 @@ void ProgressIndicator::logic()
void ProgressIndicator::draw(gcn::Graphics *graphics)
{
+ BLOCK_START("ProgressIndicator::draw")
if (mIndicator)
{
// Draw the indicator centered on the widget
@@ -72,4 +73,5 @@ void ProgressIndicator::draw(gcn::Graphics *graphics)
const int y = (getHeight() - 32) / 2;
mIndicator->draw(static_cast<Graphics*>(graphics), x, y);
}
+ BLOCK_END("ProgressIndicator::draw")
}
diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp
index 98e1182e1..1c56f787e 100644
--- a/src/gui/widgets/radiobutton.cpp
+++ b/src/gui/widgets/radiobutton.cpp
@@ -149,6 +149,7 @@ void RadioButton::drawBox(gcn::Graphics* graphics)
void RadioButton::draw(gcn::Graphics* graphics)
{
+ BLOCK_START("RadioButton::draw")
drawBox(graphics);
graphics->setFont(getFont());
@@ -156,6 +157,7 @@ void RadioButton::draw(gcn::Graphics* graphics)
graphics->drawText(getCaption(), mPadding + mImageSize + mSpacing,
mPadding);
+ BLOCK_END("RadioButton::draw")
}
void RadioButton::mouseEntered(gcn::MouseEvent& event A_UNUSED)
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index 0b7b73e6e..5658c6a8f 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -177,8 +177,12 @@ void ScrollArea::init(std::string skinName)
void ScrollArea::logic()
{
+ BLOCK_START("ScrollArea::logic")
if (!isVisible())
+ {
+ BLOCK_END("ScrollArea::logic")
return;
+ }
gcn::ScrollArea::logic();
gcn::Widget *const content = getContent();
@@ -208,6 +212,7 @@ void ScrollArea::logic()
setHorizontalScrollAmount(mHScroll - mLeftButtonScrollAmount);
else if (mRightButtonPressed)
setHorizontalScrollAmount(mHScroll + mRightButtonScrollAmount);
+ BLOCK_END("ScrollArea::logic")
}
void ScrollArea::updateAlpha()
@@ -236,6 +241,7 @@ void ScrollArea::updateAlpha()
void ScrollArea::draw(gcn::Graphics *graphics)
{
+ BLOCK_START("ScrollArea::draw")
if (mVBarVisible)
{
drawUpButton(graphics);
@@ -254,10 +260,12 @@ void ScrollArea::draw(gcn::Graphics *graphics)
updateAlpha();
drawChildren(graphics);
+ BLOCK_END("ScrollArea::draw")
}
void ScrollArea::drawFrame(gcn::Graphics *graphics)
{
+ BLOCK_START("ScrollArea::drawFrame")
if (mOpaque)
{
const int bs = getFrameSize();
@@ -307,6 +315,7 @@ void ScrollArea::drawFrame(gcn::Graphics *graphics)
// static_cast<Graphics*>(graphics)->
// drawImageRect(0, 0, w, h, background);
}
+ BLOCK_END("ScrollArea::drawFrame")
}
void ScrollArea::setOpaque(bool opaque)
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp
index 0134a64c9..86c2e2e67 100644
--- a/src/gui/widgets/shoplistbox.cpp
+++ b/src/gui/widgets/shoplistbox.cpp
@@ -84,8 +84,12 @@ void ShopListBox::setPlayersMoney(const int money)
void ShopListBox::draw(gcn::Graphics *gcnGraphics)
{
+ BLOCK_START("ShopListBox::draw")
if (!mListModel || !mShopItems)
+ {
+ BLOCK_END("ShopListBox::draw")
return;
+ }
if (Client::getGuiAlpha() != mAlpha)
mAlpha = Client::getGuiAlpha();
@@ -156,6 +160,7 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics)
ITEM_ICON_SIZE + mPadding,
y + (ITEM_ICON_SIZE - getFont()->getHeight()) / 2 + mPadding);
}
+ BLOCK_END("ShopListBox::draw")
}
void ShopListBox::adjustSize()
diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp
index 4ba57b257..1f6a68be9 100644
--- a/src/gui/widgets/slider.cpp
+++ b/src/gui/widgets/slider.cpp
@@ -112,9 +112,11 @@ void Slider::updateAlpha()
void Slider::draw(gcn::Graphics *graphics)
{
+ BLOCK_START("Slider::draw")
if (!buttons[0].grid[HSTART] || !buttons[1].grid[HSTART]
|| !buttons[0].grid[HEND])
{
+ BLOCK_END("Slider::draw")
return;
}
@@ -174,6 +176,7 @@ void Slider::draw(gcn::Graphics *graphics)
}
drawMarker(graphics);
+ BLOCK_END("Slider::draw")
}
void Slider::drawMarker(gcn::Graphics *const graphics) const
diff --git a/src/gui/widgets/sliderlist.cpp b/src/gui/widgets/sliderlist.cpp
index c108930d1..d57b1a092 100644
--- a/src/gui/widgets/sliderlist.cpp
+++ b/src/gui/widgets/sliderlist.cpp
@@ -108,12 +108,14 @@ void SliderList::resize()
void SliderList::draw(gcn::Graphics *graphics)
{
+ BLOCK_START("SliderList::draw")
if (mOldWidth != getWidth())
{
resize();
mOldWidth = getWidth();
}
Container::draw(graphics);
+ BLOCK_END("SliderList::draw")
}
void SliderList::updateLabel()
diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index cfc3863eb..10e82676e 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -93,6 +93,7 @@ void SpellShortcutContainer::draw(gcn::Graphics *graphics)
if (!spellShortcut)
return;
+ BLOCK_START("SpellShortcutContainer::draw")
if (Client::getGuiAlpha() != mAlpha)
{
mAlpha = Client::getGuiAlpha();
@@ -155,7 +156,7 @@ void SpellShortcutContainer::draw(gcn::Graphics *graphics)
{
// Draw the item image being dragged by the cursor.
}
-
+ BLOCK_END("SpellShortcutContainer::draw")
}
void SpellShortcutContainer::mouseDragged(gcn::MouseEvent &event)
diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp
index aea8efb37..6747b19e0 100644
--- a/src/gui/widgets/tab.cpp
+++ b/src/gui/widgets/tab.cpp
@@ -147,6 +147,7 @@ void Tab::updateAlpha()
void Tab::draw(gcn::Graphics *graphics)
{
+ BLOCK_START("Tab::draw")
int mode = TAB_STANDARD;
// check which type of tab to draw
@@ -184,7 +185,10 @@ void Tab::draw(gcn::Graphics *graphics)
const Skin *const skin = tabImg[mode];
if (!skin)
+ {
+ BLOCK_END("Tab::draw")
return;
+ }
updateAlpha();
@@ -206,6 +210,7 @@ void Tab::draw(gcn::Graphics *graphics)
// draw label
drawChildren(graphics);
+ BLOCK_END("Tab::draw")
}
void Tab::widgetResized(const gcn::Event &event A_UNUSED)
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index 0321e5044..ded2986d3 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -129,10 +129,15 @@ Tab *TabbedArea::getTab(const std::string &name) const
void TabbedArea::draw(gcn::Graphics *graphics)
{
+ BLOCK_START("TabbedArea::draw")
if (mTabs.empty())
+ {
+ BLOCK_END("TabbedArea::draw")
return;
+ }
drawChildren(graphics);
+ BLOCK_END("TabbedArea::draw")
}
gcn::Widget *TabbedArea::getWidget(const std::string &name) const
@@ -274,7 +279,9 @@ void TabbedArea::removeTab(Tab *tab)
void TabbedArea::logic()
{
+ BLOCK_START("TabbedArea::logic")
logicChildren();
+ BLOCK_END("TabbedArea::logic")
}
void TabbedArea::mousePressed(gcn::MouseEvent &mouseEvent)
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index a31ae59fe..fc9c73a68 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -119,6 +119,7 @@ void TextField::updateAlpha()
void TextField::draw(gcn::Graphics *graphics)
{
+ BLOCK_START("TextField::draw")
updateAlpha();
if (isFocused())
@@ -131,13 +132,16 @@ void TextField::draw(gcn::Graphics *graphics)
graphics->setColor(mForegroundColor);
graphics->setFont(getFont());
graphics->drawText(mText, mPadding - mXScroll, mPadding);
+ BLOCK_END("TextField::draw")
}
void TextField::drawFrame(gcn::Graphics *graphics)
{
+ BLOCK_START("TextField::drawFrame")
const int bs = 2 * getFrameSize();
static_cast<Graphics*>(graphics)->drawImageRect(0, 0,
getWidth() + bs, getHeight() + bs, skin);
+ BLOCK_END("TextField::drawFrame")
}
void TextField::setNumeric(const bool numeric)
diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp
index f9f0269c0..8468da782 100644
--- a/src/gui/widgets/textpreview.cpp
+++ b/src/gui/widgets/textpreview.cpp
@@ -78,6 +78,7 @@ TextPreview::~TextPreview()
void TextPreview::draw(gcn::Graphics* graphics)
{
+ BLOCK_START("TextPreview::draw")
if (Client::getGuiAlpha() != mAlpha)
mAlpha = Client::getGuiAlpha();
@@ -112,6 +113,7 @@ void TextPreview::draw(gcn::Graphics* graphics)
TextRenderer::renderText(graphics, mText, mPadding + 1, mPadding + 1,
gcn::Graphics::LEFT, gcn::Color(mTextColor->r, mTextColor->g,
mTextColor->b, alpha), mFont, mOutline, mShadow);
+ BLOCK_END("TextPreview::draw")
}
void TextPreview::adjustSize()
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index e4a279e6c..ecf8f0f99 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -186,6 +186,7 @@ void Window::draw(gcn::Graphics *graphics)
if (!mSkin)
return;
+ BLOCK_START("Window::draw")
Graphics *const g = static_cast<Graphics*>(graphics);
bool update = false;
@@ -237,6 +238,7 @@ void Window::draw(gcn::Graphics *graphics)
{
drawChildren(graphics);
}
+ BLOCK_END("Window::draw")
}
void Window::setContentSize(int width, int height)
diff --git a/src/gui/widgets/windowcontainer.cpp b/src/gui/widgets/windowcontainer.cpp
index 9acba77b2..8c985737c 100644
--- a/src/gui/widgets/windowcontainer.cpp
+++ b/src/gui/widgets/windowcontainer.cpp
@@ -37,10 +37,12 @@ WindowContainer::WindowContainer(const Widget2 *const widget) :
void WindowContainer::logic()
{
+ BLOCK_START("WindowContainer::logic")
delete_all(mDeathList);
mDeathList.clear();
gcn::Container::logic();
+ BLOCK_END("WindowContainer::logic")
}
void WindowContainer::scheduleDelete(gcn::Widget *const widget)
@@ -59,3 +61,12 @@ void WindowContainer::adjustAfterResize(const int oldScreenWidth,
window->adjustPositionAfterResize(oldScreenWidth, oldScreenHeight);
}
}
+
+#ifdef USE_PROFILER
+void WindowContainer::draw(gcn::Graphics* graphics)
+{
+ BLOCK_START("WindowContainer::draw")
+ Container::draw(graphics);
+ BLOCK_END("WindowContainer::draw")
+}
+#endif
diff --git a/src/gui/widgets/windowcontainer.h b/src/gui/widgets/windowcontainer.h
index 7a7b77fe1..fd25a1162 100644
--- a/src/gui/widgets/windowcontainer.h
+++ b/src/gui/widgets/windowcontainer.h
@@ -57,6 +57,10 @@ class WindowContainer : public Container
void adjustAfterResize(const int oldScreenWidth,
const int oldScreenHeight);
+#ifdef USE_PROFILER
+ void draw(gcn::Graphics* graphics);
+#endif
+
private:
/**
* List of widgets that are scheduled to be deleted.