aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-12-22 15:52:41 -0800
committerH. Peter Anvin <hpa@zytor.com>2009-12-22 15:52:41 -0800
commit46202699d83202808e67358739d1889982c825ae (patch)
tree944ec78034346e359ddf3e75adac15f2743c8fd4
parent6c7159d13c948afcc067635d0cc0c6aae39a04bf (diff)
downloadsyslinux.git-46202699d83202808e67358739d1889982c825ae.tar.gz
syslinux.git-46202699d83202808e67358739d1889982c825ae.tar.xz
syslinux.git-46202699d83202808e67358739d1889982c825ae.zip
vesamenu: unbreak the default background
Unbreak the default background image; it would clobber all of memory. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--com32/lib/sys/vesa/background.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/com32/lib/sys/vesa/background.c b/com32/lib/sys/vesa/background.c
index 256c8247..2e573846 100644
--- a/com32/lib/sys/vesa/background.c
+++ b/com32/lib/sys/vesa/background.c
@@ -217,18 +217,25 @@ err:
int vesacon_default_background(void)
{
int x, y, dx, dy, dy2;
- uint8_t *bgptr = (uint8_t *) & __vesacon_background;
+ int z;
+ unsigned int shft;
+ uint8_t *bgptr = (uint8_t *)__vesacon_background;
uint8_t k;
if (__vesacon_pixel_format == PXF_NONE)
return 0; /* Not in graphics mode */
- for (y = 0, dy = -__vesa_info.mi.v_res / 2;
+ z = max(__vesa_info.mi.v_res, __vesa_info.mi.h_res) >> 1;
+ z = ((z*z) >> 11) - 1;
+ asm("bsrl %1,%0" : "=r" (shft) : "rm" (z));
+ shft++;
+
+ for (y = 0, dy = -(__vesa_info.mi.v_res >> 1);
y < __vesa_info.mi.v_res; y++, dy++) {
dy2 = dy * dy;
- for (x = 0, dx = -__vesa_info.mi.h_res / 2;
+ for (x = 0, dx = -(__vesa_info.mi.h_res >> 1);
x < __vesa_info.mi.h_res; x++, dx++) {
- k = __vesacon_linear_to_srgb[500 + ((dx * dx + dy2) >> 6)];
+ k = __vesacon_linear_to_srgb[500 + ((dx*dx + dy2) >> shft)];
bgptr[0] = k; /* Blue */
bgptr[1] = k; /* Green */
bgptr[2] = k; /* Red */