[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] background_color command
From: |
Vladimir 'φ-coder/phcoder' Serbinenko |
Subject: |
Re: [PATCH] background_color command |
Date: |
Sat, 18 Dec 2010 20:46:46 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101211 Icedove/3.0.11 |
On 12/10/2010 06:53 PM, Colin Watson wrote:
>
> module = {
> + name = video_colors;
> + common = video/colors.c;
> + enable = videomodules;
> +};
>
Both main users of video (gfxmenu and gfxterm) use color routines. So I
feel like video/colors.c can go into video.mod
>
> + /* Create a filled bitmap so that we get suitable text blending. */
> + grub_video_bitmap_create (&bitmap, window.width, window.height,
> + GRUB_VIDEO_BLIT_FORMAT_RGB_888);
> + if (grub_errno != GRUB_ERR_NONE)
> + return grub_errno;
>
You should check the return value and not grub_errno.
> +
>
It would be more optimal if in this case the image would be saved simply
as the color rather than a filled array and use grub_video_fill_rect
when this image is supposed to be blitted. also it would be neat to be
able to specify the bgcolor around non-stretched image.
> + data = bitmap->data;
> + for (i = 0; i < window.height * window.width; i++)
> + {
> + *data++ = color.red;
> + *data++ = color.green;
> + *data++ = color.blue;
> + }
> +
>
grub_video_fill_rect is the function for such kind of operations.
> + bitmap_width = window.width;
> + bitmap_height = window.height;
> +
> + /* Set the border color. */
> + virtual_screen.bg_color_display = grub_video_map_rgba_color (color);
> +
> + /* Mark whole screen as dirty. */
> + dirty_region_add (0, 0, window.width, window.height);
> +
> + /* All was ok. */
> + grub_errno = GRUB_ERR_NONE;
>
You shouldn't discard grub_errno manually unless there is an error you
want to ignore.
> + return grub_errno;
>
I'd rather use return GRUB_ERR_NONE;
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
signature.asc
Description: OpenPGP digital signature