From: Ray Strode Date: Thu, 12 Jun 2008 17:54:57 +0000 (-0400) Subject: Add new throbber_load function to preload frames X-Git-Tag: 0.3.2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ea6157c54f0dde1efa695f882b77ea5ad63de1e;p=thirdparty%2Fplymouth.git Add new throbber_load function to preload frames This will be important for determining the propery location of the throbber on screen --- diff --git a/src/splash-plugins/spinfinity/plugin.c b/src/splash-plugins/spinfinity/plugin.c index 7db3e8a2..91e04073 100644 --- a/src/splash-plugins/spinfinity/plugin.c +++ b/src/splash-plugins/spinfinity/plugin.c @@ -325,6 +325,10 @@ show_splash_screen (ply_boot_splash_plugin_t *plugin, if (!ply_image_load (plugin->box_image)) return false; + ply_trace ("loading throbber"); + if (!throbber_load (plugin->throbber)) + return false; + plugin->window = window; ply_trace ("setting graphics mode"); diff --git a/src/splash-plugins/spinfinity/throbber.c b/src/splash-plugins/spinfinity/throbber.c index d5a8e90c..998f229e 100644 --- a/src/splash-plugins/spinfinity/throbber.c +++ b/src/splash-plugins/spinfinity/throbber.c @@ -85,12 +85,12 @@ throbber_new (const char *image_dir, throbber->frames = ply_array_new (); throbber->frames_prefix = strdup (frames_prefix); throbber->image_dir = strdup (image_dir); - throbber->width = 82; - throbber->height = 47; + throbber->width = 0; + throbber->height = 0; throbber->frame_area.width = 0; throbber->frame_area.height = 0; - throbber->frame_area.x = 700; - throbber->frame_area.y = 700; + throbber->frame_area.x = 0; + throbber->frame_area.y = 0; return throbber; } @@ -261,6 +261,18 @@ out: return load_finished; } +bool +throbber_load (throbber_t *throbber) +{ + if (ply_array_get_size (throbber->frames) != 0) + throbber_remove_frames (throbber->frames); + + if (!throbber_add_frames (throbber)) + return false; + + return true; +} + bool throbber_start (throbber_t *throbber, ply_event_loop_t *loop, @@ -271,12 +283,6 @@ throbber_start (throbber_t *throbber, assert (throbber != NULL); assert (throbber->loop == NULL); - if (ply_array_get_size (throbber->frames) == 0) - { - if (!throbber_add_frames (throbber)) - return false; - } - throbber->loop = loop; throbber->window = window; throbber->frame_buffer = ply_window_get_frame_buffer (window);; diff --git a/src/splash-plugins/spinfinity/throbber.h b/src/splash-plugins/spinfinity/throbber.h index 191bfcb7..c1e7b1a5 100644 --- a/src/splash-plugins/spinfinity/throbber.h +++ b/src/splash-plugins/spinfinity/throbber.h @@ -37,6 +37,7 @@ throbber_t *throbber_new (const char *image_dir, const char *frames_prefix); void throbber_free (throbber_t *throbber); +bool throbber_load (throbber_t *throbber); bool throbber_start (throbber_t *throbber, ply_event_loop_t *loop, ply_window_t *window,