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
=== modified file 'src/xsplash.c'
--- src/xsplash.c 2009-10-21 13:06:01 +0000
+++ src/xsplash.c 2009-12-09 16:42:13 +0000
@@ -62,6 +62,7 @@
62 GtkWidget *background;62 GtkWidget *background;
63 GdkPixbuf *logo_pixbuf;63 GdkPixbuf *logo_pixbuf;
64 GdkPixbuf *throbber_pixbuf;64 GdkPixbuf *throbber_pixbuf;
65 GdkPixbuf **throbber_slices;
6566
66 gchar *dbusobject;67 gchar *dbusobject;
67 DBusGConnection *system_bus;68 DBusGConnection *system_bus;
@@ -231,6 +232,7 @@
231xsplash_server_dispose (GObject *object)232xsplash_server_dispose (GObject *object)
232{233{
233 XsplashServerPrivate *priv = XSPLASH_SERVER_GET_PRIVATE (object);234 XsplashServerPrivate *priv = XSPLASH_SERVER_GET_PRIVATE (object);
235 int i;
234236
235 if (have_xcomposite && priv->cow)237 if (have_xcomposite && priv->cow)
236 {238 {
@@ -239,6 +241,16 @@
239 g_object_unref (priv->cow);241 g_object_unref (priv->cow);
240 }242 }
241243
244 if (priv->throbber_slices)
245 {
246 for (i = 0; i < throbber_frames; i++)
247 {
248 g_object_unref (priv->throbber_slices[i]);
249 }
250
251 g_free (priv->throbber_slices);
252 }
253
242 if (priv->throbber_pixbuf)254 if (priv->throbber_pixbuf)
243 g_object_unref (priv->throbber_pixbuf);255 g_object_unref (priv->throbber_pixbuf);
244256
@@ -565,7 +577,23 @@
565577
566 if (throbber_filename && throbber_frames)578 if (throbber_filename && throbber_frames)
567 {579 {
580 int width, height;
581 int i;
582
568 priv->throbber_pixbuf = gdk_pixbuf_new_from_file (throbber_filename, NULL);583 priv->throbber_pixbuf = gdk_pixbuf_new_from_file (throbber_filename, NULL);
584 width = gdk_pixbuf_get_width (priv->throbber_pixbuf);
585 height = gdk_pixbuf_get_height (priv->throbber_pixbuf) / throbber_frames;
586
587 priv->throbber_slices = g_malloc (sizeof (GdkPixbuf *) * throbber_frames);
588 for (i = 0; i < throbber_frames; i++)
589 {
590 GdkPixbuf *pixbuf = gdk_pixbuf_new_subpixbuf (priv->throbber_pixbuf,
591 0,
592 height * i,
593 width,
594 height);
595 priv->throbber_slices[i] = pixbuf;
596 }
569597
570 if (priv->throbber_pixbuf != NULL)598 if (priv->throbber_pixbuf != NULL)
571 {599 {
@@ -708,18 +736,12 @@
708 XsplashServerPrivate *priv;736 XsplashServerPrivate *priv;
709 GdkPixbuf *pixbuf;737 GdkPixbuf *pixbuf;
710 gint frame;738 gint frame;
711 gint height, y_offset;
712739
713 server = (XsplashServer *)user_data;740 server = (XsplashServer *)user_data;
714 priv = XSPLASH_SERVER_GET_PRIVATE (server);741 priv = XSPLASH_SERVER_GET_PRIVATE (server);
742
715 frame = MIN (throbber_frames * progress, throbber_frames - 1);743 frame = MIN (throbber_frames * progress, throbber_frames - 1);
716744 pixbuf = priv->throbber_slices[frame];
717 height = gdk_pixbuf_get_height (priv->throbber_pixbuf) / throbber_frames;
718 y_offset = height * (frame);
719
720 pixbuf = gdk_pixbuf_new_subpixbuf (priv->throbber_pixbuf,
721 0, y_offset,
722 gdk_pixbuf_get_width (priv->throbber_pixbuf), height);
723745
724 gtk_image_set_from_pixbuf (GTK_IMAGE (priv->throbber),746 gtk_image_set_from_pixbuf (GTK_IMAGE (priv->throbber),
725 pixbuf);747 pixbuf);

Subscribers

People subscribed via source and target branches