diff options
author | yokota <yokota@FreeBSD.org> | 1999-03-29 15:13:53 +0000 |
---|---|---|
committer | yokota <yokota@FreeBSD.org> | 1999-03-29 15:13:53 +0000 |
commit | 3bb5e2e4c7e303504731533c16ce967828763b01 (patch) | |
tree | e4e8664862ac82af9f828a6d1141236b297ed671 /sys/modules/splash | |
parent | 3600be6523af1ff0bf135c44b14e764ab17e5341 (diff) | |
download | FreeBSD-src-3bb5e2e4c7e303504731533c16ce967828763b01.zip FreeBSD-src-3bb5e2e4c7e303504731533c16ce967828763b01.tar.gz |
Make the splash screen alternate "fade out" and "fade in" action at
regular intervals, when the module is used as a screen saver.
Submitted by: asami
Diffstat (limited to 'sys/modules/splash')
-rw-r--r-- | sys/modules/splash/bmp/splash_bmp.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/sys/modules/splash/bmp/splash_bmp.c b/sys/modules/splash/bmp/splash_bmp.c index 71e2578..3b0e500 100644 --- a/sys/modules/splash/bmp/splash_bmp.c +++ b/sys/modules/splash/bmp/splash_bmp.c @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: splash_bmp.c,v 1.5 1999/01/26 10:00:02 yokota Exp $ + * $Id: splash_bmp.c,v 1.6 1999/02/05 11:52:13 yokota Exp $ */ #include <sys/param.h> @@ -37,7 +37,8 @@ #include <dev/fb/fbreg.h> #include <dev/fb/splashreg.h> -#define FADE_TIMEOUT 300 /* sec */ +#define FADE_TIMEOUT 15 /* sec */ +#define FADE_LEVELS 10 static int splash_mode = -1; static int splash_on = FALSE; @@ -98,6 +99,8 @@ bmp_splash(video_adapter_t *adp, int on) { static u_char pal[256*3]; static long time_stamp; + u_char tpal[256*3]; + static int fading = TRUE, brightness = FADE_LEVELS; struct timeval tv; int i; @@ -122,11 +125,23 @@ bmp_splash(video_adapter_t *adp, int on) if (time_stamp == 0) time_stamp = tv.tv_sec; if (tv.tv_sec > time_stamp + FADE_TIMEOUT) { + if (fading) + if (brightness == 0) { + fading = FALSE; + brightness++; + } + else brightness--; + else + if (brightness == FADE_LEVELS) { + fading = TRUE; + brightness--; + } + else brightness++; for (i = 0; i < sizeof(pal); ++i) { - if (pal[i] > 40) - pal[i] -= 4; + tpal[i] = pal[i] * brightness / FADE_LEVELS; } - (*vidsw[adp->va_index]->load_palette)(adp, pal); + (*vidsw[adp->va_index]->load_palette)(adp, tpal); + time_stamp = tv.tv_sec; } } return 0; |