From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: grub-devel@gnu.org
Subject: Re: [PATCH] background_color command
Date: Sat, 18 Dec 2010 20:46:46 +0100 [thread overview]
Message-ID: <4D0D0FA6.6000703@gmail.com> (raw)
In-Reply-To: <20101210175342.GA686@riva.ucam.org>
[-- Attachment #1: Type: text/plain, Size: 1769 bytes --]
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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]
next prev parent reply other threads:[~2010-12-18 19:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-10 12:39 [PATCH] background_color command Colin Watson
2010-12-10 17:53 ` Colin Watson
2010-12-13 14:00 ` Colin Watson
2010-12-18 19:46 ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2010-12-23 12:21 ` Colin Watson
2010-12-25 11:26 ` Vladimir 'φ-coder/phcoder' Serbinenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D0D0FA6.6000703@gmail.com \
--to=phcoder@gmail.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).