summaryrefslogtreecommitdiffstats
path: root/src/splash-plugins
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2007-10-21 21:28:05 -0400
committerRay Strode <rstrode@redhat.com>2007-10-21 21:28:05 -0400
commitd7e22a4654f730d7a54b7e923a4ed4e361ee08e3 (patch)
treefa4d1c5f0ae252d0e781ccef5e78a91e4c76833a /src/splash-plugins
parenta234fea7ad4bbe64535367ccbb50e2b9093218f4 (diff)
downloadplymouth-d7e22a4654f730d7a54b7e923a4ed4e361ee08e3.tar.gz
plymouth-d7e22a4654f730d7a54b7e923a4ed4e361ee08e3.tar.xz
plymouth-d7e22a4654f730d7a54b7e923a4ed4e361ee08e3.zip
Don't add new stars on top of old stars, or under the logo
Diffstat (limited to 'src/splash-plugins')
-rw-r--r--src/splash-plugins/fedora-fade-in/fedora-fade-in.c55
1 files changed, 43 insertions, 12 deletions
diff --git a/src/splash-plugins/fedora-fade-in/fedora-fade-in.c b/src/splash-plugins/fedora-fade-in/fedora-fade-in.c
index 06515dc..924e064 100644
--- a/src/splash-plugins/fedora-fade-in/fedora-fade-in.c
+++ b/src/splash-plugins/fedora-fade-in/fedora-fade-in.c
@@ -226,15 +226,6 @@ animate_at_time (ply_boot_splash_plugin_t *plugin,
star = (star_t *) ply_list_node_get_data (node);
next_node = ply_list_get_next_node (plugin->stars, node);
- if (((star->x >= logo_area.x)
- && (star->x + star_area.width <= logo_area.x + logo_area.width))
- && ((star->y >= logo_area.y)
- && (star->y + star_area.height <= logo_area.y + logo_area.height)))
- {
- node = next_node;
- continue;
- }
-
star_area.x = star->x;
star_area.y = star->y;
@@ -407,16 +398,56 @@ show_splash_screen (ply_boot_splash_plugin_t *plugin)
static void
add_star (ply_boot_splash_plugin_t *plugin)
{
- ply_frame_buffer_area_t area;
+ ply_frame_buffer_area_t area, logo_area;
star_t *star;
int x, y;
+ int width, height;
+ ply_list_node_t *node;
assert (plugin != NULL);
+ ply_frame_buffer_get_size (plugin->frame_buffer, &logo_area);
+ width = ply_image_get_width (plugin->logo_image);
+ height = ply_image_get_height (plugin->logo_image);
+ logo_area.x = (logo_area.width / 2) - (width / 2);
+ logo_area.y = (logo_area.height / 2) - (height / 2);
+ logo_area.width = width;
+ logo_area.height = height;
+
ply_frame_buffer_get_size (plugin->frame_buffer, &area);
+ width = ply_image_get_width (plugin->star_image);
+ height = ply_image_get_height (plugin->star_image);
+
+ node = NULL;
+ do
+ {
+ x = rand () % area.width;
+ y = rand () % area.height;
+
+ if (((x + width >= logo_area.x)
+ && (x <= logo_area.x + logo_area.width))
+ && ((y + height >= logo_area.y)
+ && (y <= logo_area.y + logo_area.height)))
+ continue;
+
+ node = ply_list_get_first_node (plugin->stars);
+ while (node != NULL)
+ {
+ ply_list_node_t *next_node;
+
+ star = (star_t *) ply_list_node_get_data (node);
+ next_node = ply_list_get_next_node (plugin->stars, node);
+
+ if (((x + width >= star->x)
+ && (x <= star->x + width))
+ && ((y + height >= star->y)
+ && (y <= star->y + height)))
+ break;
+
+ node = next_node;
+ }
- x = rand () % area.width;
- y = rand () % area.height;
+ } while (node != NULL);
star = star_new (x, y, (double) ((rand () % 50) + 1));
ply_list_append_data (plugin->stars, star);