Opened 15 years ago
Closed 14 years ago
#4720 closed enhancement (fixed)
Wallpapers should be able to fill & keep proper aspect ratio (easy)
Reported by: | olaf | Owned by: | nobody |
---|---|---|---|
Priority: | normal | Milestone: | R1 |
Component: | Preferences/Backgrounds | Version: | R1/Development |
Keywords: | gsoc2010 | Cc: | |
Blocked By: | Blocking: | ||
Platform: | All |
Description
The wallpapers configuration window should allow users to use a smaller or larger wallpaper and stretch it properly. Properly, as in, keep the aspect ratio in tact while filling the screen (cropping some of either the width or height to compensate).
Additionally, but not necessary, allow it to be repositioned as well after being fit to the screen.
Attachments (2)
Change History (12)
comment:1 by , 15 years ago
Owner: | changed from | to
---|
comment:2 by , 15 years ago
by , 15 years ago
Attachment: | wallpaper-fix.diff added |
---|
Replacement for previous fix, with ratio comparing and obeying 80 chars style rule.
follow-up: 4 comment:3 by , 15 years ago
I'm not entirely happy with what I did with the 80 chars style rule. I did my best to make it still kind of understandable, but it's a bit tricky. Any guidelines for this rule?
comment:4 by , 15 years ago
Replying to engleek:
I'm not entirely happy with what I did with the 80 chars style rule. I did my best to make it still kind of understandable, but it's a bit tricky. Any guidelines for this rule?
In this instance it might make sense to break those calculations into their own functions, and call those from the switch cases, since they wouldn't be nested quite as heavily. Otherwise it might be prudent to just do the calculations in multiple steps instead of one giant statement as now.
by , 15 years ago
Attachment: | wallpaper-fix.2.diff added |
---|
Third version, with three extra private methods to apply the 80 chars style rule in a nicer way and improve modularity. Hopefully this won't have too much of a negative impact on performance.
comment:5 by , 15 years ago
Keywords: | gsoc2010 added |
---|
follow-up: 7 comment:6 by , 15 years ago
I've tested the patch, Christopher, but there may be some problems. I have a wallpaper here which exactly fits the screen. But when I switch to the "Scale to fit" mode, the image gets suddenly stretched horizontally somewhat. Have not looked into why this might be.
comment:7 by , 14 years ago
Replying to stippi:
In BRectHorizontalOverlap() and BRectVerticalOverlap(), it looks like engleek swapped the last hostRect.Width/Height in each equation.
In BRectHorizontalOverlap(), it should be
return (((hostRect.Height() / resizedRect.Height()) * resizedRect.Width()) - hostRect.Width()) / 2;
and BRectVertialOverlap() should be
return (((hostRect.Width() / resizedRect.Width()) * resizedRect.Height()) - hostRect.Height()) / 2;
comment:8 by , 14 years ago
Stephan, let me know if you have time to check again with info provided by devheart.
comment:9 by , 14 years ago
Unfortunately, I don't have much time at all. Would be glad if someone else could review, thanks!
comment:10 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
OK I applied the patch with the devheart fix in hrev40144. I removed some braces which were unneeded. Tested OK.
This patch is almost perfect. I think you need to compare aspect ratio of screen and bitmap in order to decide where to overlap. A bitmap may have to overlap at top/bottom OR left/right, depending on whether the aspect ratio is smaller or greater than the view aspect ratio, even though in both cases, the width may be greater than the height.
Other than that, the patch just needs to honor the 80 chars/line limit. :-)