summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-05-31 13:35:05 +0300
committerAndrei Karas <akaras@inbox.ru>2013-05-31 13:35:05 +0300
commit639d8883192accdc502ec11ea2bfee474320c06e (patch)
tree09784b004c2eb0fc5913373cae2e5e267c5d7f78 /src/gui/widgets
parentb90ff36dd105986947c1396ea2f5cb2f29f776d5 (diff)
downloadmv-639d8883192accdc502ec11ea2bfee474320c06e.tar.gz
mv-639d8883192accdc502ec11ea2bfee474320c06e.tar.bz2
mv-639d8883192accdc502ec11ea2bfee474320c06e.tar.xz
mv-639d8883192accdc502ec11ea2bfee474320c06e.zip
improve desktop class.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/desktop.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp
index 7f3532381..455b36554 100644
--- a/src/gui/widgets/desktop.cpp
+++ b/src/gui/widgets/desktop.cpp
@@ -45,8 +45,7 @@ Desktop::Desktop(const Widget2 *const widget) :
Wallpaper::loadWallpapers();
- std::string appName = branding.getValue("appName", std::string());
-
+ const std::string appName = branding.getValue("appName", std::string());
if (appName.empty())
{
mVersionLabel = new Label(this, FULL_VERSION);
@@ -86,11 +85,16 @@ void Desktop::draw(gcn::Graphics *graphics)
BLOCK_START("Desktop::draw")
Graphics *const g = static_cast<Graphics *const>(graphics);
- if (!mWallpaper || (getWidth() > mWallpaper->getWidth() ||
- getHeight() > mWallpaper->getHeight()))
+ const gcn::Rectangle &rect = mDimension;
+ const int width = rect.width;
+ const int height = rect.height;
+ const int wallpWidth = mWallpaper->getWidth();
+ const int wallpHeight = mWallpaper->getHeight();
+
+ if (!mWallpaper || (width > wallpWidth || height > wallpHeight))
{
g->setColor(mBackgroundGrayColor);
- g->fillRectangle(gcn::Rectangle(0, 0, getWidth(), getHeight()));
+ g->fillRectangle(gcn::Rectangle(0, 0, width, height));
}
if (mWallpaper)
@@ -98,14 +102,14 @@ void Desktop::draw(gcn::Graphics *graphics)
if (!imageHelper->useOpenGL())
{
g->drawImage(mWallpaper,
- (getWidth() - mWallpaper->getWidth()) / 2,
- (getHeight() - mWallpaper->getHeight()) / 2);
+ (width - wallpWidth) / 2,
+ (height - wallpHeight) / 2);
}
else
{
g->drawRescaledImage(mWallpaper, 0, 0, 0, 0,
- mWallpaper->getWidth(), mWallpaper->getHeight(),
- getWidth(), getHeight(), false);
+ wallpWidth, wallpHeight,
+ width, height, false);
}
}
@@ -132,13 +136,17 @@ void Desktop::setBestFittingWallpaper()
if (mWallpaper)
mWallpaper->decRef();
+ const gcn::Rectangle &rect = mDimension;
+ const int width = rect.width;
+ const int height = rect.height;
+
if (!imageHelper->useOpenGL()
- && (nWallPaper->getWidth() != getWidth()
- || nWallPaper->getHeight() != getHeight()))
+ && (nWallPaper->getWidth() != width
+ || nWallPaper->getHeight() != height))
{
// We rescale to obtain a fullscreen wallpaper...
Image *const newRsclWlPpr = ResourceManager::getInstance()
- ->getRescaled(nWallPaper, getWidth(), getHeight());
+ ->getRescaled(nWallPaper, width, height);
// We replace the resource in the resource manager
nWallPaper->decRef();