From bb19232b416a5ae60a4dbaf1cb155587c52dba8b Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Fri, 1 May 2009 23:39:27 -0400 Subject: [PATCH] [two-step] Add support for a "corner image" This is so the OLPC theme can have a "Powered by blah" logo in the corner of the screen. --- src/plugins/splash/two-step/plugin.c | 38 ++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/plugins/splash/two-step/plugin.c b/src/plugins/splash/two-step/plugin.c index bc52873a..0d32d58e 100644 --- a/src/plugins/splash/two-step/plugin.c +++ b/src/plugins/splash/two-step/plugin.c @@ -81,6 +81,7 @@ struct _ply_boot_splash_plugin ply_frame_buffer_area_t box_area, lock_area; ply_image_t *lock_image; ply_image_t *box_image; + ply_image_t *corner_image; ply_window_t *window; ply_entry_t *entry; @@ -128,6 +129,10 @@ create_plugin (ply_key_file_t *key_file) plugin->box_image = ply_image_new (image_path); free (image_path); + asprintf (&image_path, "%s/corner-image.png", image_dir); + plugin->corner_image = ply_image_new (image_path); + free (image_path); + plugin->entry = ply_entry_new (image_dir); plugin->label = ply_label_new (); plugin->animation_dir = image_dir; @@ -185,6 +190,10 @@ destroy_plugin (ply_boot_splash_plugin_t *plugin) ply_image_free (plugin->box_image); ply_image_free (plugin->lock_image); + + if (plugin->corner_image != NULL) + ply_image_free (plugin->corner_image); + ply_entry_free (plugin->entry); ply_animation_free (plugin->animation); ply_progress_animation_free (plugin->progress_animation); @@ -256,6 +265,8 @@ start_animation (ply_boot_splash_plugin_t *plugin) plugin->animation_vertical_alignment * area.height - height / 2.0); plugin->is_animating = true; + + ply_window_draw_area (plugin->window, 0, 0, area.width, area.height); } static void @@ -353,6 +364,22 @@ on_draw (ply_boot_splash_plugin_t *plugin, else { ply_progress_animation_draw (plugin->progress_animation); + + if (plugin->corner_image != NULL) + { + ply_frame_buffer_area_t screen_area; + ply_frame_buffer_area_t image_area; + + ply_frame_buffer_get_size (plugin->frame_buffer, &screen_area); + + image_area.width = ply_image_get_width (plugin->corner_image); + image_area.height = ply_image_get_height (plugin->corner_image); + image_area.x = screen_area.width - image_area.width - 20; + image_area.y = screen_area.height - image_area.height - 20; + + ply_frame_buffer_fill_with_argb32_data (plugin->frame_buffer, &image_area, 0, 0, ply_image_get_data (plugin->corner_image)); + + } } ply_frame_buffer_unpause_updates (plugin->frame_buffer); } @@ -453,6 +480,17 @@ show_splash_screen (ply_boot_splash_plugin_t *plugin, if (!ply_image_load (plugin->box_image)) return false; + if (plugin->corner_image != NULL) + { + ply_trace ("loading corner image"); + + if (!ply_image_load (plugin->corner_image)) + { + ply_image_free (plugin->corner_image); + plugin->corner_image = NULL; + } + } + ply_trace ("loading entry"); if (!ply_entry_load (plugin->entry)) return false; -- 2.47.3