<table><tr><td style="">antlarr created this revision.<br />antlarr added a reviewer: Plasma.<br />Restricted Application added a project: Plasma.<br />Restricted Application added a subscriber: plasma-devel.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D2834" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>The default wallpaper method is to scale the wallpaper, and the previous<br />
algorithm in plasma choosed the wallpaper with closest area to the screen<br />
area (w*h) giving a bit of preference to downscaling over upscaling.<br />
The result was that in widescreens like 1280x720, a 1280x1024 wallpaper<br />
was preferred to be scaled down, instead of scaling down the also<br />
available 1920x1080 wallpaper, which had the same aspect ratio and so,<br />
was not distorted.</p>

<p>This patch changes the Image::findPreferedImageInPackage method to do the<br />
same closest-area algorithm first on wallpapers with the same<br />
aspect ratio and if no wallpaper with same aspect ratio is found, then<br />
fallback to the previous algorithm. Note I added some variables so both<br />
happen in the same loop and we don't have to iterate twice<br />
over the wallpapers.</p>

<p>This fixes <a href="https://bugzilla.opensuse.org/show_bug.cgi?id=990257" class="remarkup-link" target="_blank" rel="noreferrer">https://bugzilla.opensuse.org/show_bug.cgi?id=990257</a></p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Make sure the wallpaper mode is in Scale. Choose a wallpaper with<br />
1920x1080 and 1280x1024 resolutions which shows a perfect circle,<br />
a recognizable object or a face. Then change the screen resolution to<br />
1280x720. The wallpaper should appear with correct aspect ratio.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>rPLASMAWORKSPACE Plasma Workspace</div></div></div><br /><div><strong>BRANCH</strong><div><div>Plasma/5.8</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D2834" rel="noreferrer">https://phabricator.kde.org/D2834</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>wallpapers/image/image.cpp</div></div></div><br /><div><strong>EMAIL PREFERENCES</strong><div><a href="https://phabricator.kde.org/settings/panel/emailpreferences/" rel="noreferrer">https://phabricator.kde.org/settings/panel/emailpreferences/</a></div></div><br /><div><strong>To: </strong>antlarr, Plasma<br /><strong>Cc: </strong>plasma-devel, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas<br /></div>