From 30bf0e1f5a912ea44d19e314fbc747bb15e40606 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Wed, 30 Aug 2006 16:34:21 -0700 Subject: [PATCH] Better test of alpha blending (holy crap, it works!) --- com32/lib/sys/vesa/background.c | 17 +++++------------ com32/samples/vesa.c | 1 + 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/com32/lib/sys/vesa/background.c b/com32/lib/sys/vesa/background.c index c40b138..d9aa14c 100644 --- a/com32/lib/sys/vesa/background.c +++ b/com32/lib/sys/vesa/background.c @@ -31,19 +31,11 @@ #include "vesa.h" #include "video.h" +/* FIX THIS: we need to redraw any text on the screen... */ static void draw_background(void) { - uint32_t *outp = (uint32_t *)__vesa_info.mi.lfb_ptr; - uint32_t *inp = (uint32_t *)__vesacon_background; - size_t n = sizeof __vesacon_background; - uint32_t v; - - while (n--) { - v = *inp++; - *outp++ = (__vesacon_alpha_tbl[(uint8_t)(v >> 16)][0] << 16)| - (__vesacon_alpha_tbl[(uint8_t)(v >> 8)][0] << 8)| - (__vesacon_alpha_tbl[(uint8_t)v][0]); - } + memcpy(__vesa_info.mi.lfb_ptr, __vesacon_background, + sizeof __vesacon_background); } int vesacon_load_background(const char *filename) @@ -159,8 +151,9 @@ int vesacon_load_background(const char *filename) int __vesacon_init_background(void) { - memset(__vesacon_background, 0, sizeof __vesacon_background); + memset(__vesacon_background, 0x80, sizeof __vesacon_background); /* The VESA BIOS has already cleared the screen */ + draw_background(); return 0; } diff --git a/com32/samples/vesa.c b/com32/samples/vesa.c index faeb3b0..6d148ae 100644 --- a/com32/samples/vesa.c +++ b/com32/samples/vesa.c @@ -12,6 +12,7 @@ int main(void) char attr_buf[16]; __vesacon_init(); + vesacon_load_background("stacy.png"); row = col = 0; -- 2.7.4