diff options
author | Timothy Pearson <[email protected]> | 2015-06-29 13:13:07 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2015-06-29 13:13:07 -0500 |
commit | 4abbb950f32b10b6bd64b36766c4129060fe5eb2 (patch) | |
tree | 939aad31163bb04e8d65f8b0cc9b34ff88526634 /src/thememoodin.cpp | |
parent | 1d5818b9eb3abe6edbdd74b017c7910c5b3fc805 (diff) | |
download | ksplash-engine-moodin-4abbb950f32b10b6bd64b36766c4129060fe5eb2.tar.gz ksplash-engine-moodin-4abbb950f32b10b6bd64b36766c4129060fe5eb2.zip |
Attempt to scale background image if a background image with native resolution is not available
Diffstat (limited to 'src/thememoodin.cpp')
-rw-r--r-- | src/thememoodin.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/thememoodin.cpp b/src/thememoodin.cpp index d1711fa..2ad557c 100644 --- a/src/thememoodin.cpp +++ b/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) { |