summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorUwe Stuehler <uwe@cvs.openbsd.org>2005-04-28 16:44:29 +0000
committerUwe Stuehler <uwe@cvs.openbsd.org>2005-04-28 16:44:29 +0000
commit50e5f6a49af9f4602b4118d8ce85cd0caa2a946f (patch)
treeb591f3303c6d36794a78a261ce9c2eeb5a93b00a /usr.sbin
parentd679abc1296eb398d5f0661fa81f4cbea24b6c99 (diff)
display a title above the message; suggested by deraadt@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ztsscale/message.xbm55
-rw-r--r--usr.sbin/ztsscale/ztsscale.c22
2 files changed, 70 insertions, 7 deletions
diff --git a/usr.sbin/ztsscale/message.xbm b/usr.sbin/ztsscale/message.xbm
index 5bb9a82f1a2..32f7361fa8f 100644
--- a/usr.sbin/ztsscale/message.xbm
+++ b/usr.sbin/ztsscale/message.xbm
@@ -1,5 +1,60 @@
/* This file is placed in the public domain. */
+#define title_width 342
+#define title_height 14
+static unsigned char title_bits[] = {
+ 0xff, 0x0f, 0x7c, 0xf0, 0xf1, 0x81, 0x6f, 0x7e, 0x1f, 0x00, 0x00, 0xbe,
+ 0x01, 0xbf, 0xfc, 0x0f, 0xfe, 0x8f, 0xff, 0xe7, 0xe1, 0x03, 0x00, 0xc0,
+ 0x2f, 0xfe, 0x80, 0x7f, 0x80, 0xff, 0xf8, 0x1f, 0xfc, 0x07, 0xfe, 0xc0,
+ 0xff, 0xc7, 0xff, 0x80, 0x0f, 0x1e, 0x3e, 0xff, 0x0f, 0xfe, 0xf1, 0xf1,
+ 0xe1, 0x7f, 0x7e, 0x1f, 0x00, 0x00, 0xff, 0x81, 0xff, 0xfc, 0x3f, 0xfe,
+ 0x8f, 0xff, 0xe7, 0xe1, 0x03, 0x00, 0xe0, 0x3f, 0xfe, 0x80, 0x7f, 0x80,
+ 0xff, 0xf8, 0x7f, 0xfc, 0x1f, 0xfe, 0xc0, 0xff, 0xc7, 0xff, 0xc0, 0x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 0x60, 0x38, 0x18, 0x18, 0x06, 0xc6, 0xe0, 0x01, 0x00, 0x1c, 0x00, 0xfe,
+ 0x0f, 0x0c, 0x06, 0x0c, 0xc0, 0xc0, 0x30, 0x38, 0xfe, 0x0f, 0x38, 0x00,
+ 0x0c, 0x30, 0x60, 0x0c, 0x1e, 0x60, 0x80, 0x83, 0xc3, 0x71, 0x78, 0x70,
+ 0x18, 0x0c, 0x00, 0xc0, 0x81, 0xe1, 0xc0, 0x61, 0x70, 0x18, 0x18, 0x06,
+ 0xc6, 0xe0, 0x01, 0x00, 0x38, 0x70, 0x06, 0x0c, 0x0c, 0x06, 0x0c, 0xc0,
+ 0xc0, 0x30, 0x30, 0x06, 0x0e, 0x38, 0x00, 0x0c, 0x70, 0x70, 0x0c, 0x1e,
+ 0xfe, 0x07, 0xff, 0x81, 0x7f, 0xf0, 0x7f, 0x7e, 0x1f, 0x00, 0xc0, 0xff,
+ 0xc1, 0xff, 0xfc, 0xe1, 0xff, 0x9f, 0xff, 0xe7, 0xc3, 0x01, 0x00, 0xf0,
+ 0xbf, 0x1f, 0xbf, 0xff, 0x87, 0xff, 0xf8, 0xff, 0xfc, 0xf0, 0x9f, 0x3f,
+ 0xff, 0xc1, 0xff, 0xe0, 0x3f, 0x3e, 0x1c, 0xfe, 0x07, 0xfe, 0x00, 0x1f,
+ 0xe0, 0x3f, 0x7e, 0x1f, 0x00, 0xc0, 0xff, 0x80, 0x7f, 0xfc, 0xe1, 0xff,
+ 0x9f, 0xff, 0xe7, 0xc3, 0x01, 0x00, 0xe0, 0x9f, 0x1f, 0xbf, 0xff, 0x87,
+ 0xff, 0xf8, 0x7f, 0xfc, 0xe0, 0x9f, 0x3f, 0xff, 0xc1, 0xff, 0xc0, 0x1f,
+ 0x3e, 0x1c };
+
#define message_width 280
#define message_height 12
static unsigned char message_bits[] = {
diff --git a/usr.sbin/ztsscale/ztsscale.c b/usr.sbin/ztsscale/ztsscale.c
index 182198dd284..c1c8961c0fb 100644
--- a/usr.sbin/ztsscale/ztsscale.c
+++ b/usr.sbin/ztsscale/ztsscale.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ztsscale.c,v 1.8 2005/04/28 07:02:40 deraadt Exp $ */
+/* $OpenBSD: ztsscale.c,v 1.9 2005/04/28 16:44:28 uwe Exp $ */
/*
* Copyright (c) 2005 Matthieu Herrb
@@ -34,6 +34,9 @@
#include "message.xbm"
+#define TITLE_Y 64
+#define MESSAGE_Y 128
+
#define WIDTH 640
#define HEIGHT 480
#define BLACK 0x0
@@ -50,7 +53,7 @@ int yc[] = { 25, 455, 240, 25, 455 };
struct ctlname topname[] = CTL_NAMES;
struct ctlname machdepname[] = CTL_MACHDEP_NAMES;
-void bitmap(u_short *, u_short, u_char[], int, int);
+void bitmap(u_short *, u_short, u_char[], int, int, int);
void cross(u_short *, int, int);
void wait_event(int, int *, int *);
void save_screen(void);
@@ -60,17 +63,17 @@ int main(int, char *[]);
__dead void usage(void);
void
-bitmap(u_short *fb, u_short pixel, u_char bits[], int width, int height)
+bitmap(u_short *fb, u_short pixel, u_char bits[], int width, int height,
+ int y)
{
int i, j;
- int x, y;
+ int x;
#define BITADDR(x, y) ((width + 7)/8*(y) + (x)/8)
#define BITMASK(x) (1 << ((x) % 8))
for (i = 0; i < height; i++) {
x = (WIDTH - width)/2;
- y = (HEIGHT/2 - height)/2;
for (j = 0; j < width; j++)
if (bits[BITADDR(j, i)] & BITMASK(j))
fb[ADDR(x + j, HEIGHT - y - i)] = pixel;
@@ -200,8 +203,10 @@ again:
signal(SIGINT, sighandler);
for (i = 0; i < 5; i++) {
memset(mapaddr, WHITE, WIDTH*HEIGHT*sizeof(u_short));
+ bitmap(mapaddr, BLACK, title_bits, title_width,
+ title_height, TITLE_Y);
bitmap(mapaddr, BLACK, message_bits, message_width,
- message_height);
+ message_height, MESSAGE_Y);
cross(mapaddr, xc[i], yc[i]);
/* printf("waiting for event\n"); */
wait_event(mfd, &x[i], &y[i]);
@@ -270,7 +275,10 @@ again:
err:
memset(mapaddr, WHITE, WIDTH*HEIGHT*sizeof(u_short));
- bitmap(mapaddr, RED, error_bits, error_width, error_height);
+ bitmap(mapaddr, BLACK, title_bits, title_width, title_height,
+ TITLE_Y);
+ bitmap(mapaddr, RED, error_bits, error_width, error_height,
+ MESSAGE_Y);
sleep(2);
goto again;
}