summaryrefslogtreecommitdiffstats
path: root/sys/dev/syscons/rain
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2001-11-06 02:38:09 +0000
committerdes <des@FreeBSD.org>2001-11-06 02:38:09 +0000
commit96acf650889b440b17e9f410d4839b6e0044fcc6 (patch)
treef3d3562c23b42e2f9c9ecc18f321064aafe1ebfb /sys/dev/syscons/rain
parent9e8fe7fac8739d75eb00b55fe3d45e5e3266850d (diff)
downloadFreeBSD-src-96acf650889b440b17e9f410d4839b6e0044fcc6.zip
FreeBSD-src-96acf650889b440b17e9f410d4839b6e0044fcc6.tar.gz
Drive-by stylification + reintroduce set_border().
Diffstat (limited to 'sys/dev/syscons/rain')
-rw-r--r--sys/dev/syscons/rain/rain_saver.c121
1 files changed, 61 insertions, 60 deletions
diff --git a/sys/dev/syscons/rain/rain_saver.c b/sys/dev/syscons/rain/rain_saver.c
index 0f312cd..76b4f3c 100644
--- a/sys/dev/syscons/rain/rain_saver.c
+++ b/sys/dev/syscons/rain/rain_saver.c
@@ -40,90 +40,91 @@
#include <dev/fb/splashreg.h>
#include <dev/syscons/syscons.h>
-static u_char *vid;
+#define SAVER_NAME "rain_saver"
+#define SCRW 320
+#define SCRH 200
+#define MAX 63
-#define SCRW 320
-#define SCRH 200
-#define MAX 63
-
-static u_char rain_pal[768];
-static int blanked;
+static u_char *vid;
+static u_char rain_pal[768];
+static int blanked;
static void
rain_update(video_adapter_t *adp)
{
- int i, t;
-
- t = rain_pal[(MAX*3+2)];
- for (i = (MAX*3+2); i > 5; i -= 3)
- rain_pal[i] = rain_pal[i-3];
- rain_pal[5] = t;
- load_palette(adp, rain_pal);
+ int i, t;
+
+ t = rain_pal[(MAX*3+2)];
+ for (i = (MAX*3+2); i > 5; i -= 3)
+ rain_pal[i] = rain_pal[i-3];
+ rain_pal[5] = t;
+ load_palette(adp, rain_pal);
}
static int
rain_saver(video_adapter_t *adp, int blank)
{
- int i, j, k, pl;
-
- if (blank) {
- /* switch to graphics mode */
- if (blanked <= 0) {
- pl = splhigh();
- set_video_mode(adp, M_VGA_CG320);
- load_palette(adp, rain_pal);
-#if 0 /* XXX conflict */
- set_border(adp, 0);
-#endif
- blanked++;
- vid = (u_char *)adp->va_window;
- splx(pl);
- bzero(vid, SCRW*SCRH);
- for (i = 0; i < SCRW; i += 2)
- vid[i] = 1 + (random() % MAX);
- for (j = 1, k = SCRW; j < SCRH; j++)
- for (i = 0; i < SCRW; i += 2, k += 2)
- vid[k] = (vid[k-SCRW] < MAX) ? 1 + vid[k-SCRW] : 1;
- }
-
- /* update display */
- rain_update(adp);
+ int i, j, k, pl;
- } else {
- blanked = 0;
- }
- return 0;
+ if (blank) {
+ /* switch to graphics mode */
+ if (blanked <= 0) {
+ pl = splhigh();
+ set_video_mode(adp, M_VGA_CG320);
+ load_palette(adp, rain_pal);
+ set_border(adp, 0);
+ blanked++;
+ vid = (u_char *)adp->va_window;
+ splx(pl);
+ bzero(vid, SCRW*SCRH);
+ for (i = 0; i < SCRW; i += 2)
+ vid[i] = 1 + (random() % MAX);
+ for (j = 1, k = SCRW; j < SCRH; j++)
+ for (i = 0; i < SCRW; i += 2, k += 2)
+ vid[k] = (vid[k-SCRW] < MAX) ? 1 + vid[k-SCRW] : 1;
+ }
+
+ /* update display */
+ rain_update(adp);
+ } else {
+ blanked = 0;
+ }
+ return (0);
}
static int
rain_init(video_adapter_t *adp)
{
- video_info_t info;
- int i;
-
- /* check that the console is capable of running in 320x200x256 */
- if (get_mode_info(adp, M_VGA_CG320, &info)) {
- log(LOG_NOTICE, "rain_saver: the console does not support M_VGA_CG320\n");
- return ENODEV;
- }
-
- /* intialize the palette */
- for (i = 3; i < (MAX+1)*3; i += 3)
- rain_pal[i+2] = rain_pal[i-1] + 4;
-
- blanked = 0;
-
- return 0;
+ video_info_t info;
+ int i;
+
+ /* check that the console is capable of running in 320x200x256 */
+ if (get_mode_info(adp, M_VGA_CG320, &info)) {
+ log(LOG_NOTICE,
+ "%s: the console does not support M_VGA_CG320\n",
+ SAVER_NAME);
+ return (ENODEV);
+ }
+
+ /* intialize the palette */
+ for (i = 3; i < (MAX+1)*3; i += 3)
+ rain_pal[i+2] = rain_pal[i-1] + 4;
+
+ return (0);
}
static int
rain_term(video_adapter_t *adp)
{
- return 0;
+ return (0);
}
static scrn_saver_t rain_module = {
- "rain_saver", rain_init, rain_term, rain_saver, NULL,
+ SAVER_NAME,
+ rain_init,
+ rain_term,
+ rain_saver,
+ NULL
};
SAVER_MODULE(rain_saver, rain_module);
OpenPOWER on IntegriCloud