diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2015-06-29 13:13:07 -0500 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2015-09-05 00:14:29 +0900 |
commit | 1ffd7de051798f2283b0f8947fd1fe9e8e70bb9b (patch) | |
tree | 8ef782dab3f72f0574cf249b3a0eea51b9c0caa2 /src | |
parent | c6f7132fa04aac46cb75a1078ea27fcca0445e0a (diff) | |
download | ksplash-engine-moodin-1ffd7de051798f2283b0f8947fd1fe9e8e70bb9b.tar.gz ksplash-engine-moodin-1ffd7de051798f2283b0f8947fd1fe9e8e70bb9b.zip |
Attempt to scale background image if a background image with native resolution is not available
(cherry picked from commit 4abbb950f32b10b6bd64b36766c4129060fe5eb2)
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'src')
-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) { |