mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-17 10:26:15 +00:00
Drive-by stylification + reintroduce set_border().
This commit is contained in:
parent
b1511f4fb5
commit
ff95e02306
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=86120
@ -40,122 +40,127 @@
|
||||
#include <dev/fb/splashreg.h>
|
||||
#include <dev/syscons/syscons.h>
|
||||
|
||||
static u_char *vid;
|
||||
static int banksize, scrmode, bpsl, scrw, scrh;
|
||||
static int blanked;
|
||||
#define SAVER_NAME "logo_saver"
|
||||
|
||||
extern unsigned int logo_w;
|
||||
extern unsigned int logo_h;
|
||||
extern unsigned char logo_pal[];
|
||||
extern unsigned char logo_img[];
|
||||
extern unsigned int logo_img_size;
|
||||
extern unsigned int logo_w;
|
||||
extern unsigned int logo_h;
|
||||
extern unsigned char logo_pal[];
|
||||
extern unsigned char logo_img[];
|
||||
extern unsigned int logo_img_size;
|
||||
|
||||
static u_char *vid;
|
||||
static int banksize, scrmode, bpsl, scrw, scrh;
|
||||
static int blanked;
|
||||
|
||||
static void
|
||||
logo_blit(video_adapter_t *adp, int x, int y)
|
||||
{
|
||||
int d, l, o, p;
|
||||
|
||||
for (o = 0, p = y * bpsl + x; p > banksize; p -= banksize)
|
||||
o += banksize;
|
||||
set_origin(adp, o);
|
||||
|
||||
for (d = 0; d < logo_img_size; d += logo_w) {
|
||||
if (p + logo_w < banksize) {
|
||||
bcopy(logo_img + d, vid + p, logo_w);
|
||||
p += bpsl;
|
||||
} else if (p < banksize) {
|
||||
l = banksize - p;
|
||||
bcopy(logo_img + d, vid + p, l);
|
||||
set_origin(adp, (o += banksize));
|
||||
bcopy(logo_img + d + l, vid, logo_w - l);
|
||||
p += bpsl - banksize;
|
||||
} else {
|
||||
p -= banksize;
|
||||
set_origin(adp, (o += banksize));
|
||||
bcopy(logo_img + d, vid + p, logo_w);
|
||||
p += bpsl;
|
||||
int d, l, o, p;
|
||||
|
||||
for (o = 0, p = y * bpsl + x; p > banksize; p -= banksize)
|
||||
o += banksize;
|
||||
set_origin(adp, o);
|
||||
|
||||
for (d = 0; d < logo_img_size; d += logo_w) {
|
||||
if (p + logo_w < banksize) {
|
||||
bcopy(logo_img + d, vid + p, logo_w);
|
||||
p += bpsl;
|
||||
} else if (p < banksize) {
|
||||
l = banksize - p;
|
||||
bcopy(logo_img + d, vid + p, l);
|
||||
set_origin(adp, (o += banksize));
|
||||
bcopy(logo_img + d + l, vid, logo_w - l);
|
||||
p += bpsl - banksize;
|
||||
} else {
|
||||
p -= banksize;
|
||||
set_origin(adp, (o += banksize));
|
||||
bcopy(logo_img + d, vid + p, logo_w);
|
||||
p += bpsl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
logo_update(video_adapter_t *adp)
|
||||
{
|
||||
static int xpos = 0, ypos = 0;
|
||||
static int xinc = 1, yinc = 1;
|
||||
|
||||
/* Turn when you hit the edge */
|
||||
if ((xpos + logo_w + xinc > scrw) || (xpos + xinc < 0))
|
||||
xinc = -xinc;
|
||||
if ((ypos + logo_h + yinc > scrh) || (ypos + yinc < 0))
|
||||
yinc = -yinc;
|
||||
xpos += xinc;
|
||||
ypos += yinc;
|
||||
static int xpos = 0, ypos = 0;
|
||||
static int xinc = 1, yinc = 1;
|
||||
|
||||
/* XXX Relies on margin around logo to erase trail */
|
||||
logo_blit(adp, xpos, ypos);
|
||||
/* Turn when you hit the edge */
|
||||
if ((xpos + logo_w + xinc > scrw) || (xpos + xinc < 0))
|
||||
xinc = -xinc;
|
||||
if ((ypos + logo_h + yinc > scrh) || (ypos + yinc < 0))
|
||||
yinc = -yinc;
|
||||
xpos += xinc;
|
||||
ypos += yinc;
|
||||
|
||||
/* XXX Relies on margin around logo to erase trail */
|
||||
logo_blit(adp, xpos, ypos);
|
||||
}
|
||||
|
||||
static int
|
||||
logo_saver(video_adapter_t *adp, int blank)
|
||||
{
|
||||
int i, pl;
|
||||
|
||||
if (blank) {
|
||||
/* switch to graphics mode */
|
||||
if (blanked <= 0) {
|
||||
pl = splhigh();
|
||||
set_video_mode(adp, scrmode);
|
||||
load_palette(adp, logo_pal);
|
||||
#if 0 /* XXX conflict */
|
||||
set_border(adp, 0);
|
||||
#endif
|
||||
blanked++;
|
||||
vid = (u_char *)adp->va_window;
|
||||
banksize = adp->va_window_size;
|
||||
bpsl = adp->va_line_width;
|
||||
splx(pl);
|
||||
for (i = 0; i < bpsl*scrh; i += banksize) {
|
||||
set_origin(adp, i);
|
||||
bzero(vid, banksize);
|
||||
}
|
||||
int i, pl;
|
||||
|
||||
if (blank) {
|
||||
/* switch to graphics mode */
|
||||
if (blanked <= 0) {
|
||||
pl = splhigh();
|
||||
set_video_mode(adp, scrmode);
|
||||
load_palette(adp, logo_pal);
|
||||
set_border(adp, 0);
|
||||
blanked++;
|
||||
vid = (u_char *)adp->va_window;
|
||||
banksize = adp->va_window_size;
|
||||
bpsl = adp->va_line_width;
|
||||
splx(pl);
|
||||
for (i = 0; i < bpsl * scrh; i += banksize) {
|
||||
set_origin(adp, i);
|
||||
bzero(vid, banksize);
|
||||
}
|
||||
}
|
||||
logo_update(adp);
|
||||
} else {
|
||||
blanked = 0;
|
||||
}
|
||||
logo_update(adp);
|
||||
} else {
|
||||
blanked = 0;
|
||||
}
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
logo_init(video_adapter_t *adp)
|
||||
{
|
||||
video_info_t info;
|
||||
|
||||
if (!get_mode_info(adp, M_VESA_CG800x600, &info)) {
|
||||
scrmode = M_VESA_CG800x600;
|
||||
} else if (!get_mode_info(adp, M_VGA_CG320, &info)) {
|
||||
scrmode = M_VGA_CG320;
|
||||
} else {
|
||||
log(LOG_NOTICE, "logo_saver: no suitable graphics mode\n");
|
||||
return ENODEV;
|
||||
}
|
||||
|
||||
scrw = info.vi_width;
|
||||
scrh = info.vi_height;
|
||||
blanked = 0;
|
||||
|
||||
return 0;
|
||||
video_info_t info;
|
||||
|
||||
if (!get_mode_info(adp, M_VESA_CG800x600, &info)) {
|
||||
scrmode = M_VESA_CG800x600;
|
||||
} else if (!get_mode_info(adp, M_VGA_CG320, &info)) {
|
||||
scrmode = M_VGA_CG320;
|
||||
} else {
|
||||
log(LOG_NOTICE,
|
||||
"%s: the console does not support M_VGA_CG320\n",
|
||||
SAVER_NAME);
|
||||
return (ENODEV);
|
||||
}
|
||||
|
||||
scrw = info.vi_width;
|
||||
scrh = info.vi_height;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
logo_term(video_adapter_t *adp)
|
||||
{
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
static scrn_saver_t logo_module = {
|
||||
"logo_saver", logo_init, logo_term, logo_saver, NULL,
|
||||
SAVER_NAME,
|
||||
logo_init,
|
||||
logo_term,
|
||||
logo_saver,
|
||||
NULL
|
||||
};
|
||||
|
||||
SAVER_MODULE(logo_saver, logo_module);
|
||||
|
@ -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);
|
||||
|
@ -40,98 +40,99 @@
|
||||
#include <dev/fb/splashreg.h>
|
||||
#include <dev/syscons/syscons.h>
|
||||
|
||||
static u_char *vid;
|
||||
static int blanked;
|
||||
#define SAVER_NAME "warp_saver"
|
||||
#define SCRW 320
|
||||
#define SCRH 200
|
||||
#define SPP 15
|
||||
#define STARS (SPP * (1 + 2 + 4 + 8))
|
||||
|
||||
#define SCRW 320
|
||||
#define SCRH 200
|
||||
#define SPP 15
|
||||
#define STARS (SPP*(1+2+4+8))
|
||||
|
||||
static int star[STARS];
|
||||
static u_char warp_pal[768] = {
|
||||
0x00, 0x00, 0x00,
|
||||
0x66, 0x66, 0x66,
|
||||
0x99, 0x99, 0x99,
|
||||
0xcc, 0xcc, 0xcc,
|
||||
0xff, 0xff, 0xff
|
||||
/* the rest is zero-filled by the compiler */
|
||||
static u_char *vid;
|
||||
static int blanked;
|
||||
static int star[STARS];
|
||||
static u_char warp_pal[768] = {
|
||||
0x00, 0x00, 0x00,
|
||||
0x66, 0x66, 0x66,
|
||||
0x99, 0x99, 0x99,
|
||||
0xcc, 0xcc, 0xcc,
|
||||
0xff, 0xff, 0xff
|
||||
/* the rest is zero-filled by the compiler */
|
||||
};
|
||||
|
||||
static void
|
||||
warp_update(void)
|
||||
{
|
||||
int i, j, k, n;
|
||||
|
||||
for (i = 1, k = 0, n = SPP*8; i < 5; i++, n /= 2)
|
||||
for (j = 0; j < n; j++, k++) {
|
||||
vid[star[k]] = 0;
|
||||
star[k] += i;
|
||||
if (star[k] > SCRW*SCRH)
|
||||
star[k] -= SCRW*SCRH;
|
||||
vid[star[k]] = i;
|
||||
int i, j, k, n;
|
||||
|
||||
for (i = 1, k = 0, n = SPP*8; i < 5; i++, n /= 2) {
|
||||
for (j = 0; j < n; j++, k++) {
|
||||
vid[star[k]] = 0;
|
||||
star[k] += i;
|
||||
if (star[k] > SCRW*SCRH)
|
||||
star[k] -= SCRW*SCRH;
|
||||
vid[star[k]] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
warp_saver(video_adapter_t *adp, int blank)
|
||||
{
|
||||
int pl;
|
||||
|
||||
if (blank) {
|
||||
/* switch to graphics mode */
|
||||
if (blanked <= 0) {
|
||||
pl = splhigh();
|
||||
set_video_mode(adp, M_VGA_CG320);
|
||||
load_palette(adp, warp_pal);
|
||||
#if 0 /* XXX conflict */
|
||||
set_border(adp, 0);
|
||||
#endif
|
||||
blanked++;
|
||||
vid = (u_char *)adp->va_window;
|
||||
splx(pl);
|
||||
bzero(vid, SCRW*SCRH);
|
||||
}
|
||||
|
||||
/* update display */
|
||||
warp_update();
|
||||
int 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, warp_pal);
|
||||
set_border(adp, 0);
|
||||
blanked++;
|
||||
vid = (u_char *)adp->va_window;
|
||||
splx(pl);
|
||||
bzero(vid, SCRW*SCRH);
|
||||
}
|
||||
|
||||
/* update display */
|
||||
warp_update();
|
||||
} else {
|
||||
blanked = 0;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
warp_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, "warp_saver: the console does not support M_VGA_CG320\n");
|
||||
return ENODEV;
|
||||
}
|
||||
|
||||
/* randomize the star field */
|
||||
for (i = 0; i < STARS; i++) {
|
||||
star[i] = random() % (SCRW*SCRH);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/* randomize the star field */
|
||||
for (i = 0; i < STARS; i++)
|
||||
star[i] = random() % (SCRW*SCRH);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
warp_term(video_adapter_t *adp)
|
||||
{
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
static scrn_saver_t warp_module = {
|
||||
"warp_saver", warp_init, warp_term, warp_saver, NULL,
|
||||
SAVER_NAME,
|
||||
warp_init,
|
||||
warp_term,
|
||||
warp_saver,
|
||||
NULL
|
||||
};
|
||||
|
||||
SAVER_MODULE(warp_saver, warp_module);
|
||||
|
Loading…
Reference in New Issue
Block a user