/* If filename was provided, try to load that. */
if (argc >= 1)
{
- /* Try to load new one. */
- grub_video_bitmap_load (&bitmap, args[0]);
- if (grub_errno != GRUB_ERR_NONE)
- return grub_errno;
-
- /* Determine if the bitmap should be scaled to fit the screen. */
- if (!state[BACKGROUND_CMD_ARGINDEX_MODE].set
- || grub_strcmp (state[BACKGROUND_CMD_ARGINDEX_MODE].arg,
- "stretch") == 0)
+ /* Try to load new one. */
+ grub_video_bitmap_load (&bitmap, args[0]);
+ if (grub_errno != GRUB_ERR_NONE)
+ return grub_errno;
+
+ /* Determine if the bitmap should be scaled to fit the screen. */
+ if (!state[BACKGROUND_CMD_ARGINDEX_MODE].set
+ || grub_strcmp (state[BACKGROUND_CMD_ARGINDEX_MODE].arg,
+ "stretch") == 0)
+ {
+ if (window.width != grub_video_bitmap_get_width (bitmap)
+ || window.height != grub_video_bitmap_get_height (bitmap))
+ {
+ struct grub_video_bitmap *scaled_bitmap;
+ grub_video_bitmap_create_scaled (&scaled_bitmap,
+ window.width,
+ window.height,
+ bitmap,
+ GRUB_VIDEO_BITMAP_SCALE_METHOD_BEST);
+ if (grub_errno == GRUB_ERR_NONE)
+ {
+ /* Replace the original bitmap with the scaled one. */
+ grub_video_bitmap_destroy (bitmap);
+ bitmap = scaled_bitmap;
+ }
+ }
+ }
+
+ /* If bitmap was loaded correctly, display it. */
+ if (bitmap)
{
- if (window.width != grub_video_bitmap_get_width (bitmap)
- || window.height != grub_video_bitmap_get_height (bitmap))
- {
- struct grub_video_bitmap *scaled_bitmap;
- grub_video_bitmap_create_scaled (&scaled_bitmap,
- window.width,
- window.height,
- bitmap,
- GRUB_VIDEO_BITMAP_SCALE_METHOD_BEST);
- if (grub_errno == GRUB_ERR_NONE)
- {
- /* Replace the original bitmap with the scaled one. */
- grub_video_bitmap_destroy (bitmap);
- bitmap = scaled_bitmap;
- }
- }
- }
-
- /* If bitmap was loaded correctly, display it. */
- if (bitmap)
- {
- /* Determine bitmap dimensions. */
- bitmap_width = grub_video_bitmap_get_width (bitmap);
- bitmap_height = grub_video_bitmap_get_height (bitmap);
+ /* Determine bitmap dimensions. */
+ bitmap_width = grub_video_bitmap_get_width (bitmap);
+ bitmap_height = grub_video_bitmap_get_height (bitmap);
- /* Mark whole screen as dirty. */
- dirty_region_add (0, 0, window.width, window.height);
- }
+ /* Mark whole screen as dirty. */
+ dirty_region_add (0, 0, window.width, window.height);
+ }
}
/* All was ok. */