Merge lp://qastaging/~bratsche/xsplash/precompute-throbber into lp://qastaging/xsplash

Proposed by Cody Russell
Status: Merged
Merged at revision: not available
Proposed branch: lp://qastaging/~bratsche/xsplash/precompute-throbber
Merge into: lp://qastaging/xsplash
Diff against target: 81 lines (+30/-8)
1 file modified
src/xsplash.c (+30/-8)
To merge this branch: bzr merge lp://qastaging/~bratsche/xsplash/precompute-throbber
Reviewer Review Type Date Requested Status
Ted Gould (community) Needs Fixing
Review via email: mp+15564@code.qastaging.launchpad.net
To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote :

When cleaning up there is a hardcoded [0] when it should probably be [i]. Otherwise looks good.

review: Needs Fixing
94. By Cody Russell

Fix unref

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/xsplash.c'
2--- src/xsplash.c 2009-10-21 13:06:01 +0000
3+++ src/xsplash.c 2009-12-09 16:42:13 +0000
4@@ -62,6 +62,7 @@
5 GtkWidget *background;
6 GdkPixbuf *logo_pixbuf;
7 GdkPixbuf *throbber_pixbuf;
8+ GdkPixbuf **throbber_slices;
9
10 gchar *dbusobject;
11 DBusGConnection *system_bus;
12@@ -231,6 +232,7 @@
13 xsplash_server_dispose (GObject *object)
14 {
15 XsplashServerPrivate *priv = XSPLASH_SERVER_GET_PRIVATE (object);
16+ int i;
17
18 if (have_xcomposite && priv->cow)
19 {
20@@ -239,6 +241,16 @@
21 g_object_unref (priv->cow);
22 }
23
24+ if (priv->throbber_slices)
25+ {
26+ for (i = 0; i < throbber_frames; i++)
27+ {
28+ g_object_unref (priv->throbber_slices[i]);
29+ }
30+
31+ g_free (priv->throbber_slices);
32+ }
33+
34 if (priv->throbber_pixbuf)
35 g_object_unref (priv->throbber_pixbuf);
36
37@@ -565,7 +577,23 @@
38
39 if (throbber_filename && throbber_frames)
40 {
41+ int width, height;
42+ int i;
43+
44 priv->throbber_pixbuf = gdk_pixbuf_new_from_file (throbber_filename, NULL);
45+ width = gdk_pixbuf_get_width (priv->throbber_pixbuf);
46+ height = gdk_pixbuf_get_height (priv->throbber_pixbuf) / throbber_frames;
47+
48+ priv->throbber_slices = g_malloc (sizeof (GdkPixbuf *) * throbber_frames);
49+ for (i = 0; i < throbber_frames; i++)
50+ {
51+ GdkPixbuf *pixbuf = gdk_pixbuf_new_subpixbuf (priv->throbber_pixbuf,
52+ 0,
53+ height * i,
54+ width,
55+ height);
56+ priv->throbber_slices[i] = pixbuf;
57+ }
58
59 if (priv->throbber_pixbuf != NULL)
60 {
61@@ -708,18 +736,12 @@
62 XsplashServerPrivate *priv;
63 GdkPixbuf *pixbuf;
64 gint frame;
65- gint height, y_offset;
66
67 server = (XsplashServer *)user_data;
68 priv = XSPLASH_SERVER_GET_PRIVATE (server);
69+
70 frame = MIN (throbber_frames * progress, throbber_frames - 1);
71-
72- height = gdk_pixbuf_get_height (priv->throbber_pixbuf) / throbber_frames;
73- y_offset = height * (frame);
74-
75- pixbuf = gdk_pixbuf_new_subpixbuf (priv->throbber_pixbuf,
76- 0, y_offset,
77- gdk_pixbuf_get_width (priv->throbber_pixbuf), height);
78+ pixbuf = priv->throbber_slices[frame];
79
80 gtk_image_set_from_pixbuf (GTK_IMAGE (priv->throbber),
81 pixbuf);

Subscribers

People subscribed via source and target branches