Attempt to scale background image if a background image with native resolution is not available

pull/1/head
Timothy Pearson 7 years ago
parent 1d5818b9eb
commit 4abbb950f3
  1. 23
      src/thememoodin.cpp

@ -161,6 +161,7 @@ void ThemeMoodin::initBackground(TQPainter* p)
return;
TQString bgImage;
bool scaleBgImage;
if (mUsersBackground)
{
@ -170,18 +171,29 @@ void ThemeMoodin::initBackground(TQPainter* p)
kdesktoprc.setGroup(TQString("Desktop%1").arg(num));
bgImage = kdesktoprc.readPathEntry("Wallpaper", TQString());
if (kdesktoprc.readPathEntry("WallpaperMode", TQString()) == "Scaled") {
scaleBgImage = true;
}
else {
scaleBgImage = false;
}
}
else
{
if (!mBackgroundImage.isEmpty())
bgImage = mTheme->locateThemeData(mBackgroundImage);
scaleBgImage = false;
}
if (bgImage.isEmpty())
if (bgImage.isEmpty()) {
bgImage = mTheme->locateThemeData(TQString("Background-%1x%2.jpg").arg(width()).arg(height()));
scaleBgImage = false;
}
if (bgImage.isEmpty())
if (bgImage.isEmpty()) {
bgImage = mTheme->locateThemeData("Background.jpg");
scaleBgImage = true;
}
if (bgImage.isEmpty())
{
@ -190,7 +202,12 @@ void ThemeMoodin::initBackground(TQPainter* p)
}
TQImage* bg = mCache->cacheFile(bgImage);
p->drawImage(0, 0, *bg);
if (scaleBgImage) {
p->drawImage(0, 0, (*bg).scale(width(), height()));
}
else {
p->drawImage(0, 0, *bg);
}
delete bg;
if (mKubuntuStyle) {

Loading…
Cancel
Save