Beispiel #1
0
static void
draw_logo (view_t                   *view,
           ply_pixel_buffer_t       *pixel_buffer)
{
  ply_boot_splash_plugin_t *plugin;
  uint32_t *logo_data;
  unsigned long screen_width, screen_height;
  long width, height;

  plugin = view->plugin;

  screen_width = ply_pixel_display_get_width (view->display);
  screen_height = ply_pixel_display_get_height (view->display);

  width = ply_image_get_width (plugin->logo_image);
  height = ply_image_get_height (plugin->logo_image);
  logo_data = ply_image_get_data (plugin->logo_image);
  view->logo_area.x = (screen_width / 2) - (width / 2);
  view->logo_area.y = (screen_height / 2) - (height / 2);
  view->logo_area.width = width;
  view->logo_area.height = height;

  ply_pixel_buffer_fill_with_argb32_data (pixel_buffer,
                                          &view->logo_area, 0, 0,
                                          logo_data);
}
Beispiel #2
0
static void
view_animate_at_time (view_t *view,
                      double  time)
{
        ply_boot_splash_plugin_t *plugin;
        ply_list_node_t *node;
        double logo_opacity;
        long logo_x, logo_y;
        long logo_width, logo_height;
        unsigned long screen_width, screen_height;
        unsigned long star_width, star_height;

        plugin = view->plugin;

        logo_width = ply_image_get_width (plugin->logo_image);
        logo_height = ply_image_get_height (plugin->logo_image);

        screen_width = ply_pixel_display_get_width (view->display);
        screen_height = ply_pixel_display_get_height (view->display);

        logo_x = (screen_width / 2) - (logo_width / 2);
        logo_y = (screen_height / 2) - (logo_height / 2);

        star_width = ply_image_get_width (plugin->star_image);
        star_height = ply_image_get_height (plugin->star_image);

        node = ply_list_get_first_node (view->stars);
        while (node != NULL) {
                ply_list_node_t *next_node;
                star_t *star;

                star = (star_t *) ply_list_node_get_data (node);
                next_node = ply_list_get_next_node (view->stars, node);

                star->opacity = .5 * sin (((plugin->now - star->start_time) / star->speed) * (2 * M_PI)) + .5;
                star->opacity = CLAMP (star->opacity, 0, 1.0);

                ply_pixel_display_draw_area (view->display,
                                             star->x, star->y,
                                             star_width, star_height);
                node = next_node;
        }

        logo_opacity = .5 * sin ((time / 5) * (2 * M_PI)) + .8;
        logo_opacity = CLAMP (logo_opacity, 0, 1.0);

        if (plugin->mode == PLY_BOOT_SPLASH_MODE_SHUTDOWN)
                logo_opacity = 1.0;

        if (fabs (logo_opacity - view->logo_opacity) <= DBL_MIN)
                return;

        view->logo_opacity = logo_opacity;

        ply_pixel_display_draw_area (view->display,
                                     logo_x, logo_y,
                                     logo_width, logo_height);
}
Beispiel #3
0
static void
draw_normal_view (view_t             *view,
                  ply_pixel_buffer_t *pixel_buffer,
                  int                 x,
                  int                 y,
                  int                 width,
                  int                 height)
{
        ply_boot_splash_plugin_t *plugin;
        ply_list_node_t *node;
        ply_rectangle_t logo_area;
        ply_rectangle_t star_area;
        uint32_t *logo_data, *star_data;
        unsigned long screen_width, screen_height;

        plugin = view->plugin;

        if (!plugin->is_animating)
                return;

        logo_area.width = ply_image_get_width (plugin->logo_image);
        logo_area.height = ply_image_get_height (plugin->logo_image);
        logo_data = ply_image_get_data (plugin->logo_image);

        screen_width = ply_pixel_display_get_width (view->display);
        screen_height = ply_pixel_display_get_height (view->display);

        logo_area.x = (screen_width / 2) - (logo_area.width / 2);
        logo_area.y = (screen_height / 2) - (logo_area.height / 2);

        star_data = ply_image_get_data (plugin->star_image);
        star_area.width = ply_image_get_width (plugin->star_image);
        star_area.height = ply_image_get_height (plugin->star_image);

        node = ply_list_get_first_node (view->stars);
        while (node != NULL) {
                ply_list_node_t *next_node;
                star_t *star;

                star = (star_t *) ply_list_node_get_data (node);
                next_node = ply_list_get_next_node (view->stars, node);

                star_area.x = star->x;
                star_area.y = star->y;
                ply_pixel_buffer_fill_with_argb32_data_at_opacity (pixel_buffer,
                                                                   &star_area,
                                                                   star_data,
                                                                   star->opacity);
                node = next_node;
        }

        ply_pixel_buffer_fill_with_argb32_data_at_opacity (pixel_buffer,
                                                           &logo_area,
                                                           logo_data,
                                                           view->logo_opacity);
}
Beispiel #4
0
static void
view_redraw (view_t *view)
{
  unsigned long screen_width, screen_height;

  screen_width = ply_pixel_display_get_width (view->display);
  screen_height = ply_pixel_display_get_height (view->display);

  ply_pixel_display_draw_area (view->display, 0, 0,
                               screen_width, screen_height);
}
Beispiel #5
0
static void
view_show_prompt (view_t     *view,
                  const char *prompt)
{
  ply_boot_splash_plugin_t *plugin;
  int x, y;
  int entry_width, entry_height;

  assert (view != NULL);

  plugin = view->plugin;

  if (ply_entry_is_hidden (view->entry))
    {
      unsigned long screen_width, screen_height;

      screen_width = ply_pixel_display_get_width (view->display);
      screen_height = ply_pixel_display_get_height (view->display);

      view->box_area.width = ply_image_get_width (plugin->box_image);
      view->box_area.height = ply_image_get_height (plugin->box_image);
      view->box_area.x = screen_width / 2.0 - view->box_area.width / 2.0;
      view->box_area.y = screen_height / 2.0 - view->box_area.height / 2.0;

      view->lock_area.width = ply_image_get_width (plugin->lock_image);
      view->lock_area.height = ply_image_get_height (plugin->lock_image);

      entry_width = ply_entry_get_width (view->entry);
      entry_height = ply_entry_get_height (view->entry);

      x = screen_width / 2.0 - (view->lock_area.width + entry_width) / 2.0 + view->lock_area.width;
      y = screen_height / 2.0 - entry_height / 2.0;

      view->lock_area.x = screen_width / 2.0 - (view->lock_area.width + entry_width) / 2.0;
      view->lock_area.y = screen_height / 2.0 - view->lock_area.height / 2.0;

      ply_entry_show (view->entry, plugin->loop, view->display, x, y);
    }

  if (prompt != NULL)
    {
      int label_width, label_height;

      ply_label_set_text (view->label, prompt);
      label_width = ply_label_get_width (view->label);
      label_height = ply_label_get_height (view->label);

      x = view->box_area.x + view->lock_area.width / 2;
      y = view->box_area.y + view->box_area.height;

      ply_label_show (view->label, view->display, x, y);
    }
}
Beispiel #6
0
static void
view_start_animation (view_t *view)
{
        unsigned long screen_width, screen_height;

        assert (view != NULL);

        screen_width = ply_pixel_display_get_width (view->display);
        screen_height = ply_pixel_display_get_height (view->display);

        ply_pixel_display_draw_area (view->display, 0, 0,
                                     screen_width, screen_height);
}
static void
ply_progress_bar_update_area (ply_progress_bar_t *progress_bar,
                              long                x,
                              long                y)
{
  unsigned long display_width;

  progress_bar->area.x = x;
  progress_bar->area.y = y;
  progress_bar->area.height = BAR_HEIGHT;

  display_width = ply_pixel_display_get_width (progress_bar->display);
  progress_bar->area.width = (long) (display_width * progress_bar->percent_done);
}
Beispiel #8
0
static void
view_start_animation (view_t *view)
{
        ply_boot_splash_plugin_t *plugin;

        unsigned long screen_width, screen_height;
        long width, height;
        long x,y;
        int number_of_frames;
        int yoffset = 0;

        assert (view != NULL);

        plugin = view->plugin;

        assert (plugin != NULL);
        assert (plugin->loop != NULL);

        screen_width = ply_pixel_display_get_width (view->display);
        screen_height = ply_pixel_display_get_height (view->display);

        ply_pixel_display_draw_area (view->display, 0, 0,
                                     screen_width, screen_height);

        if (plugin->mode == PLY_BOOT_SPLASH_MODE_SHUTDOWN && 
                plugin->shutdown_font != NULL && plugin->shutdown_text != NULL) {
                ply_label_set_text (view->shutdown_label, plugin->shutdown_text);
                ply_label_set_font (view->shutdown_label, plugin->shutdown_font);
                ply_label_set_color(view->shutdown_label,
                        ((plugin->shutdown_color >> 16) & 0xff) / 255.0f,
                        ((plugin->shutdown_color >> 8) & 0xff) / 255.0f,
                        (plugin->shutdown_color & 0xff) / 255.0f,
                        1.0f);
                int label_width = screen_width;
                ply_label_set_width (view->shutdown_label, label_width);
                ply_label_set_alignment (view->shutdown_label, PLY_LABEL_ALIGN_CENTER);

                x = 0;
                y = screen_height / 2;
                ply_label_show (view->shutdown_label, view->display, x, y);
                yoffset = ply_label_get_height(view->shutdown_label) * 2;
        }
Beispiel #9
0
void
ply_seat_refresh_displays (ply_seat_t *seat)
{
        ply_list_node_t *node;

        node = ply_list_get_first_node (seat->pixel_displays);
        while (node != NULL) {
                ply_pixel_display_t *display;
                ply_list_node_t *next_node;
                unsigned long width, height;

                display = ply_list_node_get_data (node);
                next_node = ply_list_get_next_node (seat->pixel_displays, node);

                width = ply_pixel_display_get_width (display);
                height = ply_pixel_display_get_height (display);

                ply_pixel_display_draw_area (display, 0, 0, width, height);
                node = next_node;
        }

        node = ply_list_get_first_node (seat->text_displays);
        while (node != NULL) {
                ply_text_display_t *display;
                ply_list_node_t *next_node;
                int number_of_columns, number_of_rows;

                display = ply_list_node_get_data (node);
                next_node = ply_list_get_next_node (seat->text_displays, node);

                number_of_columns = ply_text_display_get_number_of_columns (display);
                number_of_rows = ply_text_display_get_number_of_rows (display);

                ply_text_display_draw_area (display, 0, 0,
                                            number_of_columns,
                                            number_of_rows);
                node = next_node;
        }
}
Beispiel #10
0
static void
view_start_animation (view_t *view)
{
        ply_boot_splash_plugin_t *plugin;

        unsigned long screen_width, screen_height;
        long width, height;

        assert (view != NULL);

        plugin = view->plugin;

        assert (plugin != NULL);
        assert (plugin->loop != NULL);

        screen_width = ply_pixel_display_get_width (view->display);
        screen_height = ply_pixel_display_get_height (view->display);

        ply_pixel_display_draw_area (view->display, 0, 0,
                                     screen_width, screen_height);

        if (plugin->mode == PLY_BOOT_SPLASH_MODE_SHUTDOWN)
                return;

        plugin->is_idle = false;

        width = ply_throbber_get_width (view->throbber);
        height = ply_throbber_get_height (view->throbber);
        ply_throbber_start (view->throbber,
                            plugin->loop,
                            view->display,
                            screen_width / 2.0 - width / 2.0,
                            view->logo_area.y + view->logo_area.height + height / 2);
        ply_progress_bar_show (view->progress_bar,
                               view->display,
                               0, screen_height - ply_progress_bar_get_height (view->progress_bar));
        view_redraw (view);
}
Beispiel #11
0
static void
view_start_end_animation (view_t         *view,
                          ply_trigger_t  *trigger)
{
  ply_boot_splash_plugin_t *plugin;

  long x, y;
  long width, height;
  unsigned long screen_width, screen_height;

  plugin = view->plugin;

  screen_width = ply_pixel_display_get_width (view->display);
  screen_height = ply_pixel_display_get_height (view->display);
  width = ply_animation_get_width (view->end_animation);
  height = ply_animation_get_height (view->end_animation);
  x = plugin->animation_horizontal_alignment * screen_width - width / 2.0;
  y = plugin->animation_vertical_alignment * screen_height - height / 2.0;

  ply_animation_start (view->end_animation,
                       view->display,
                       trigger, x, y);
}
Beispiel #12
0
static void
view_start_progress_animation (view_t *view)
{
  ply_boot_splash_plugin_t *plugin;

  long x, y;
  long width, height;
  unsigned long screen_width, screen_height;

  assert (view != NULL);

  plugin = view->plugin;

  plugin->is_idle = false;

  screen_width = ply_pixel_display_get_width (view->display);
  screen_height = ply_pixel_display_get_height (view->display);

  ply_pixel_display_draw_area (view->display, 0, 0,
                               screen_width, screen_height);

  if (plugin->mode == PLY_BOOT_SPLASH_MODE_SHUTDOWN)
    {
      view_start_end_animation (view, NULL);
      return;
    }

  width = ply_progress_animation_get_width (view->progress_animation);
  height = ply_progress_animation_get_height (view->progress_animation);
  x = plugin->animation_horizontal_alignment * screen_width - width / 2.0;
  y = plugin->animation_vertical_alignment * screen_height - height / 2.0;
  ply_progress_animation_show (view->progress_animation,
                               view->display, x, y);

  ply_pixel_display_draw_area (view->display, x, y, width, height);
}
Beispiel #13
0
static void
view_add_star (view_t *view)
{
        ply_boot_splash_plugin_t *plugin;
        ply_rectangle_t logo_area;
        star_t *star;
        unsigned int x, y;
        unsigned int width, height;
        unsigned long screen_width, screen_height;
        ply_list_node_t *node;

        assert (view != NULL);

        plugin = view->plugin;

        screen_width = ply_pixel_display_get_width (view->display);
        screen_height = ply_pixel_display_get_height (view->display);
        width = ply_image_get_width (plugin->logo_image);
        height = ply_image_get_height (plugin->logo_image);
        logo_area.x = (screen_width / 2) - (width / 2);
        logo_area.y = (screen_height / 2) - (height / 2);
        logo_area.width = width;
        logo_area.height = height;

        width = ply_image_get_width (plugin->star_image);
        height = ply_image_get_height (plugin->star_image);

        node = NULL;
        do {
                x = rand () % screen_width;
                y = rand () % screen_height;

                if ((x <= logo_area.x + logo_area.width)
                    && (x >= logo_area.x)
                    && (y >= logo_area.y)
                    && (y <= logo_area.y + logo_area.height))
                        continue;

                if ((x + width >= logo_area.x)
                    && (x + width <= logo_area.x + logo_area.width)
                    && (y + height >= logo_area.y)
                    && (y + height <= logo_area.y + logo_area.height))
                        continue;

                node = ply_list_get_first_node (view->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 (view->stars, node);

                        if ((x <= star->x + width)
                            && (x >= star->x)
                            && (y >= star->y)
                            && (y <= star->y + height))
                                break;

                        if ((x + width >= star->x)
                            && (x + width <= star->x + width)
                            && (y + height >= star->y)
                            && (y + height <= star->y + height))
                                break;

                        node = next_node;
                }
        } while (node != NULL);

        star = star_new (x, y, (double) ((rand () % 50) + 1));
        ply_list_append_data (view->stars, star);
}