Merge lp://qastaging/~bratsche/xsplash/new-assets into lp://qastaging/xsplash

Proposed by Cody Russell
Status: Superseded
Proposed branch: lp://qastaging/~bratsche/xsplash/new-assets
Merge into: lp://qastaging/xsplash
Diff against target: None lines
To merge this branch: bzr merge lp://qastaging/~bratsche/xsplash/new-assets

This proposal supersedes a proposal from 2009-08-31.

This proposal has been superseded by a proposal from 2009-08-31.

To post a comment you must log in.
Revision history for this message
Cody Russell (bratsche) wrote : Posted in a previous version of this proposal

mt kicks ass.

59. By Cody Russell

Don't forget the '\' in Makefile.am, otherwise kenvandine becomes sad. :(

60. By Cody Russell

use smaller assets for now

61. By Cody Russell

fix -b command line

62. By Cody Russell

remove temp hack

63. By Cody Russell

Fix when fading from 0 to 1

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'images/Makefile.am'
2--- images/Makefile.am 2009-08-20 11:07:58 +0000
3+++ images/Makefile.am 2009-08-31 18:47:10 +0000
4@@ -2,6 +2,20 @@
5
6 imagesdir = $(datadir)/images/xsplash
7
8-images_DATA = xsplash-background.png xsplash-throbber.png
9+images_DATA = bg_800x600.jpg
10+ bg_1024x768.jpg
11+ bg_1280x1024.jpg
12+ bg_1440x900.jpg
13+ bg_1680x1050.jpg
14+ bg_1920x1200.jpg
15+ bg_2560x1600.jpg
16+ logo_small.png
17+ logo_medium.png
18+ logo_large.png
19+ logo_xtra_large.png
20+ throbber_small.png
21+ throbber_medium.png
22+ throbber_large.png
23+ throbber_xtra-large.png
24
25 EXTRA_DIST = $(images_DATA)
26
27=== added file 'images/bg_1024x768.jpg'
28Binary files images/bg_1024x768.jpg 1970-01-01 00:00:00 +0000 and images/bg_1024x768.jpg 2009-08-31 18:47:10 +0000 differ
29=== added file 'images/bg_1280x1024.jpg'
30Binary files images/bg_1280x1024.jpg 1970-01-01 00:00:00 +0000 and images/bg_1280x1024.jpg 2009-08-31 18:47:10 +0000 differ
31=== added file 'images/bg_1440x900.jpg'
32Binary files images/bg_1440x900.jpg 1970-01-01 00:00:00 +0000 and images/bg_1440x900.jpg 2009-08-31 18:47:10 +0000 differ
33=== added file 'images/bg_1680x1050.jpg'
34Binary files images/bg_1680x1050.jpg 1970-01-01 00:00:00 +0000 and images/bg_1680x1050.jpg 2009-08-31 18:47:10 +0000 differ
35=== added file 'images/bg_1920x1200.jpg'
36Binary files images/bg_1920x1200.jpg 1970-01-01 00:00:00 +0000 and images/bg_1920x1200.jpg 2009-08-31 18:47:10 +0000 differ
37=== added file 'images/bg_2560x1600.jpg'
38Binary files images/bg_2560x1600.jpg 1970-01-01 00:00:00 +0000 and images/bg_2560x1600.jpg 2009-08-31 18:47:10 +0000 differ
39=== added file 'images/bg_800x600.jpg'
40Binary files images/bg_800x600.jpg 1970-01-01 00:00:00 +0000 and images/bg_800x600.jpg 2009-08-31 18:47:10 +0000 differ
41=== added file 'images/logo_large.png'
42Binary files images/logo_large.png 1970-01-01 00:00:00 +0000 and images/logo_large.png 2009-08-31 18:47:10 +0000 differ
43=== added file 'images/logo_medium.png'
44Binary files images/logo_medium.png 1970-01-01 00:00:00 +0000 and images/logo_medium.png 2009-08-31 18:47:10 +0000 differ
45=== added file 'images/logo_small.png'
46Binary files images/logo_small.png 1970-01-01 00:00:00 +0000 and images/logo_small.png 2009-08-31 18:47:10 +0000 differ
47=== added file 'images/logo_xtra_large.png'
48Binary files images/logo_xtra_large.png 1970-01-01 00:00:00 +0000 and images/logo_xtra_large.png 2009-08-31 18:47:10 +0000 differ
49=== added file 'images/throbber_large.png'
50Binary files images/throbber_large.png 1970-01-01 00:00:00 +0000 and images/throbber_large.png 2009-08-31 18:47:10 +0000 differ
51=== added file 'images/throbber_medium.png'
52Binary files images/throbber_medium.png 1970-01-01 00:00:00 +0000 and images/throbber_medium.png 2009-08-31 18:47:10 +0000 differ
53=== added file 'images/throbber_small.png'
54Binary files images/throbber_small.png 1970-01-01 00:00:00 +0000 and images/throbber_small.png 2009-08-31 18:47:10 +0000 differ
55=== added file 'images/throbber_xtra-large.png'
56Binary files images/throbber_xtra-large.png 1970-01-01 00:00:00 +0000 and images/throbber_xtra-large.png 2009-08-31 18:47:10 +0000 differ
57=== removed file 'images/xsplash-background.png'
58Binary files images/xsplash-background.png 2009-08-06 14:42:39 +0000 and images/xsplash-background.png 1970-01-01 00:00:00 +0000 differ
59=== removed file 'images/xsplash-throbber.png'
60Binary files images/xsplash-throbber.png 2009-08-19 00:44:34 +0000 and images/xsplash-throbber.png 1970-01-01 00:00:00 +0000 differ
61=== modified file 'src/xsplash.c'
62--- src/xsplash.c 2009-08-26 15:29:53 +0000
63+++ src/xsplash.c 2009-08-31 18:58:28 +0000
64@@ -267,16 +267,120 @@
65 return gdk_pixbuf_scale_simple (src, new_width, new_height, GDK_INTERP_BILINEAR);
66 }
67
68+static gchar *
69+get_background_filename (gint width, gint height)
70+{
71+ gint widths[] = { 2560, 1920, 1680, 1440, 1280, 1024, 800 };
72+ gint heights[] = { 1600, 1200, 1050, 900, 1024, 768, 600 };
73+ gint i;
74+ gint last_good = 0;
75+ gchar *ret;
76+
77+ /* A custom background image was supplied on the command-line */
78+ if (background_image != NULL)
79+ {
80+ g_debug ("get_background_filename(): user provided background on the command line; using that");
81+
82+ return g_strdup (background_image);
83+ }
84+
85+ g_debug ("get_background_filename(): looking for appropriate resolution...");
86+ for (i = 0; i < (sizeof (widths) / sizeof (gint)); i++)
87+ {
88+ if (widths[i] > width && heights[i] && height)
89+ {
90+ g_debug (" ** %dx%d will work.", widths[i], heights[i]);
91+ last_good = i;
92+ }
93+ else
94+ {
95+ g_debug (" ** %dx%d is too small, using last good size.\n", widths[i], heights[i]);
96+ break;
97+ }
98+ }
99+
100+ g_debug (" ** Found a resolution: %dx%d", widths[last_good], heights[last_good]);
101+
102+ ret = g_strdup_printf (DATADIR "/images/xsplash/bg_%dx%d.jpg", widths[last_good], heights[last_good]);
103+
104+ g_debug (" ** filename: %s\n", ret);
105+
106+ return ret;
107+}
108+
109+static const gchar *
110+get_filename_size_modifier (gint width)
111+{
112+ if (width < 1280)
113+ return "small";
114+ else if (width < 1600)
115+ return "medium";
116+ else if (width < 2560)
117+ return "large";
118+ else
119+ return "xtra_large";
120+}
121+
122+static gchar *
123+get_throbber_filename (gint width)
124+{
125+ gchar *ret;
126+
127+ if (throbber_image != NULL)
128+ {
129+ g_debug ("get_throbber_filename(): user provided a throbber on the command line; using that\n");
130+
131+ return g_strdup (throbber_image);
132+ }
133+
134+ g_debug ("get_throbber_filename(): looking for the best throbber for screen width...");
135+
136+ ret = g_strdup_printf (DATADIR "/images/xsplash/throbber_%s.png",
137+ get_filename_size_modifier (width));
138+
139+ g_debug (" ** Chose `%s'", get_filename_size_modifier (width));
140+ g_debug (" ** throbber filename is: %s\n", ret);
141+
142+ return ret;
143+}
144+
145+static gchar *
146+get_logo_filename (gint width)
147+{
148+ gchar *ret;
149+
150+ if (logo_image != NULL)
151+ {
152+ g_debug ("get_logo_filename(): user provided a logo on the command line; using that\n");
153+
154+ return g_strdup (logo_image);
155+ }
156+
157+ g_debug ("get_logo_filename(): looking for the best logo for screen width...");
158+
159+ ret = g_strdup_printf (DATADIR "/images/xsplash/logo_%s.png",
160+ get_filename_size_modifier (width));
161+
162+ g_debug (" ** Chose `%s'", get_filename_size_modifier (width));
163+ g_debug (" ** logo filename is: %s\n", ret);
164+
165+ return ret;
166+}
167+
168 static GdkPixbuf *
169 get_pixbuf (gint width, gint height)
170 {
171 GdkPixbuf *pixbuf;
172 GdkPixbuf *scaled;
173+ gchar *background_filename;
174 gint x, y, w, h;
175
176- pixbuf = gdk_pixbuf_new_from_file (background_image, NULL);
177+ background_filename = get_background_filename (width, height);
178+
179+ pixbuf = gdk_pixbuf_new_from_file (background_filename, NULL);
180 scaled = scale_to_min (pixbuf,
181- width, height);
182+ width,
183+ height);
184
185 w = gdk_pixbuf_get_width (scaled);
186 h = gdk_pixbuf_get_height (scaled);
187@@ -286,6 +390,9 @@
188 x = ABS(x);
189 y = ABS(y);
190
191+ if (background_filename)
192+ g_free (background_filename);
193+
194 return gdk_pixbuf_new_subpixbuf (scaled,
195 x,
196 y,
197@@ -325,6 +432,8 @@
198 GdkPixbuf *logo;
199 GtkWidget *image;
200 GtkWidget *fixed;
201+ gchar *logo_filename;
202+ gchar *throbber_filename;
203
204 priv->dbusobject = NULL;
205 priv->system_bus = NULL;
206@@ -373,9 +482,12 @@
207 G_CALLBACK (key_press_event),
208 server);
209
210+ logo_filename = get_logo_filename (gdk_screen_get_width (priv->screen));
211+ throbber_filename = get_throbber_filename (gdk_screen_get_width (priv->screen));
212+
213 pixbuf = get_pixbuf (gdk_screen_get_width (priv->screen),
214 gdk_screen_get_height (priv->screen));
215- logo = gdk_pixbuf_new_from_file (logo_image, NULL);
216+ logo = gdk_pixbuf_new_from_file (logo_filename, NULL);
217
218 fixed = gtk_fixed_new ();
219
220@@ -387,9 +499,9 @@
221 gdk_pixbuf_get_width (pixbuf) / 2 - gdk_pixbuf_get_width (logo) / 2,
222 gdk_pixbuf_get_height (pixbuf) / 3 - gdk_pixbuf_get_height (logo) / 2);
223
224- if (throbber_image && throbber_frames)
225+ if (throbber_filename && throbber_frames)
226 {
227- priv->throbber_pixbuf = gdk_pixbuf_new_from_file (throbber_image, NULL);
228+ priv->throbber_pixbuf = gdk_pixbuf_new_from_file (throbber_filename, NULL);
229
230 if (priv->throbber_pixbuf != NULL)
231 {
232@@ -411,6 +523,12 @@
233 gtk_container_add (GTK_CONTAINER (priv->window), fixed);
234
235 gtk_widget_show_all (priv->window);
236+
237+ if (logo_filename)
238+ g_free (logo_filename);
239+
240+ if (throbber_filename)
241+ g_free (throbber_filename);
242 }
243
244 static void
245@@ -673,15 +791,6 @@
246 signal (SIGINT, sig_handler);
247 signal (SIGTERM, sig_handler);
248
249- if (background_image == NULL)
250- background_image = g_strdup ("/usr/share/backgrounds/warty-final-ubuntu.png");
251-
252- if (logo_image == NULL)
253- logo_image = g_strdup ("/usr/share/images/C/ubuntuheader.png");
254-
255- if (throbber_image == NULL)
256- throbber_image = g_strdup (DATADIR "/images/xsplash/xsplash-throbber.png");
257-
258 g_debug ("background_image = %s", background_image);
259 g_debug ("logo_image = %s", logo_image);
260 g_debug ("throbber_image = %s", throbber_image);

Subscribers

People subscribed via source and target branches