grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patch] background_image: image centering and scaling


From: Vesa Jääskeläinen
Subject: Re: [patch] background_image: image centering and scaling
Date: Fri, 29 Aug 2008 17:56:21 +0300
User-agent: Thunderbird 2.0.0.16 (Windows/20080708)

Olaf Mandel wrote:
> Hello,
> 
> on (some) computers with LCD monitors, the image is not automatically
> scaled to full screen if the video mode is set to a lower resolution. So
> the user has to set the gfxmode variable to the correct value in this
> case. But then the background image provided by their distribution needs
> to be rescaled by the user to fit the new screen resolution of grub.
> 
> It would be much preferable (IMO) to have grub2 rescale an existing
> image automatically on loading. This seems to be the cleaner, more
> sustainable solution: no extra files in the file system, works nicely
> even if the user changes the screen resolution manually, ...
> 
> This patch adds two new functions to video/bitmap.c:
> grub_video_bitmap_scale() and grub_video_bitmap_scale_keepaspect(). They
> are called from term/gfxterm.c after reading in the bitmap in
> grub_gfxterm_background_image_cmd(). At the moment, the scaling
> algorithm used is very simple, no interpolation is used. But this should
> be a good starting point to expand into smooth scaling later.
> 
> Additionally, this patch adds the ability to place the bitmap at any
> position of the screen, not only in the top/left corner. This is done by
> extending redraw_screen_rect() to also clear the areas to the left and
> top of the image.
> 
> These changes can be controlled at by editing term/gfxterm.c: the three
> preprocessor variables BITMAP_CENTERED, BITMAP_SCALED and
> BITMAP_KEEPASPECTRATIO default to 1, but setting them to 0 restores the
> old behavior.
> 
> This patch fixes one minor bug in grub_gfxterm_background_image_cmd():
> the stored height of the bitmap was its width. This caused the screen to
> not be cleared correctly in some cases.
> 
> TODO:
> * Use a better scaling algorithm (linear or bi-linear interpolation).
> * Change the scaling algorithm to work in-place. At the moment, a new
> memory location is acquired, and the old one is freed after copying
> (change malloc -> realloc).

Hi Olaf,

Thanks for your effort, but there is already code that does this,
altought not committed yet. Colin D Bennett has worked under GSoC 2008
program to create graphical menu code which includes better scaler and
another enhancements also relating to graphical terminal. So
unfortunately your code cannot be used as is.

You can have a sneak peak of the feature at address:
http://grub.gibibit.com/

However, please wait that we have had enough time to integrate that
completely before continuing to enhance it. (Should you do that)

Next time, try to discuss it first before implementing ;)

I will however look at if there are some ideas that you have provided
what is still missing from new graphical menu implementation that should
be there.

Thanks,
Vesa Jääskeläinen




reply via email to

[Prev in Thread] Current Thread [Next in Thread]