Merge lp:~hzliu123/ubiquity/fix-stretched-wallpaper.lp1207249 into lp:ubiquity

Proposed by Hao-Ran Liu
Status: Rejected
Rejected by: Dimitri John Ledkov
Proposed branch: lp:~hzliu123/ubiquity/fix-stretched-wallpaper.lp1207249
Merge into: lp:ubiquity
Diff against target: 60 lines (+33/-4)
2 files modified
debian/changelog (+6/-1)
src/wallpaper/wallpaper.c (+27/-3)
To merge this branch: bzr merge lp:~hzliu123/ubiquity/fix-stretched-wallpaper.lp1207249
Reviewer Review Type Date Requested Status
Ubuntu Installer Team Pending
Review via email: mp+178044@code.launchpad.net

Commit message

src/wallpaper/wallpaper.c: Cropping wallpaper image instead of stretching it if image's aspect ratio doesn't match monitor's aspect ratio (LP: #1207249)

Description of the change

This patch is for fixing bug 1207249.

src/wallpaper/wallpaper.c:
Cropping wallpaper image instead of stretching it if image's aspect ratio doesn't match monitor's aspect ratio

To post a comment you must log in.
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

This only needed for precise. Rejecting this branch, will accept the other one.

Unmerged revisions

5972. By Hao-Ran Liu

[ Hao-Ran Liu ]
src/wallpaper/wallpaper.c: Cropping wallpaper image instead of stretching
it if image's aspect ratio doesn't match monitor's aspect ratio
(LP: #1207249)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2013-07-31 12:57:08 +0000
+++ debian/changelog 2013-08-01 11:45:41 +0000
@@ -5,7 +5,12 @@
5 * Refactor network manager code to create a separte GTK class and5 * Refactor network manager code to create a separte GTK class and
6 base class for both frontends to use6 base class for both frontends to use
77
8 -- Jonathan Riddell <jriddell@ubuntu.com> Wed, 31 Jul 2013 13:55:44 +01008 [ Hao-Ran Liu ]
9 * src/wallpaper/wallpaper.c: Cropping wallpaper image instead of stretching
10 it if image's aspect ratio doesn't match monitor's aspect ratio
11 (LP: #1207249)
12
13 -- Hao-Ran Liu (Joseph Liu) <hao-ran.liu@canonical.com> Thu, 01 Aug 2013 19:27:26 +0800
914
10ubiquity (2.15.12) saucy; urgency=low15ubiquity (2.15.12) saucy; urgency=low
1116
1217
=== modified file 'src/wallpaper/wallpaper.c'
--- src/wallpaper/wallpaper.c 2012-04-23 14:13:08 +0000
+++ src/wallpaper/wallpaper.c 2013-08-01 11:45:41 +0000
@@ -98,11 +98,35 @@
98 c = cairo_create (surface);98 c = cairo_create (surface);
99 for (monitor = 0; monitor < gdk_screen_get_n_monitors (screen); monitor++) {99 for (monitor = 0; monitor < gdk_screen_get_n_monitors (screen); monitor++) {
100 gdk_screen_get_monitor_geometry (screen, monitor, &monitor_geometry);100 gdk_screen_get_monitor_geometry (screen, monitor, &monitor_geometry);
101 GdkPixbuf *pixbuf = gdk_pixbuf_scale_simple (background_pixbuf,101 int img_w = gdk_pixbuf_get_width(background_pixbuf);
102 monitor_geometry.width, monitor_geometry.height,102 int img_h = gdk_pixbuf_get_height(background_pixbuf);
103 GDK_INTERP_BILINEAR);103 float monitor_aspect_ratio = (float) monitor_geometry.width / monitor_geometry.height;
104 float img_aspect_ratio = (float) img_w / img_h;
105 GdkPixbuf *subpixbuf = NULL;
106
107 /* Crop image to fit the aspect ratio of monitor */
108 if (monitor_aspect_ratio > img_aspect_ratio) {
109 /* cut areas in upper and bottom edge */
110 int cut_h = img_h - img_w / monitor_aspect_ratio;
111 subpixbuf = gdk_pixbuf_new_subpixbuf (background_pixbuf, 0, cut_h/2, img_w, img_h-cut_h);
112 } else if (monitor_aspect_ratio < img_aspect_ratio) {
113 /* cut areas in left and right edge */
114 int cut_w = img_w - img_h * monitor_aspect_ratio;
115 subpixbuf = gdk_pixbuf_new_subpixbuf (background_pixbuf, cut_w/2, 0, img_w-cut_w, img_h);
116 }
117 GdkPixbuf *pixbuf;
118 if (subpixbuf != NULL)
119 pixbuf = gdk_pixbuf_scale_simple (subpixbuf,
120 monitor_geometry.width, monitor_geometry.height,
121 GDK_INTERP_BILINEAR);
122 else
123 pixbuf = gdk_pixbuf_scale_simple (background_pixbuf,
124 monitor_geometry.width, monitor_geometry.height,
125 GDK_INTERP_BILINEAR);
104 gdk_cairo_set_source_pixbuf (c, pixbuf, monitor_geometry.x, monitor_geometry.y);126 gdk_cairo_set_source_pixbuf (c, pixbuf, monitor_geometry.x, monitor_geometry.y);
105 g_object_unref (pixbuf);127 g_object_unref (pixbuf);
128 if (subpixbuf)
129 g_object_unref (subpixbuf);
106 cairo_paint (c);130 cairo_paint (c);
107 }131 }
108 cairo_destroy (c);132 cairo_destroy (c);

Subscribers

People subscribed via source and target branches

to status/vote changes: