+ Remove dependency on lcd.* (use internal structure instead)

+ Remove dependency on drv_base_* (mostly drv_base_close)
This commit is contained in:
ddouthitt
2001-09-25 01:01:55 +00:00
parent cf6ce9f1a4
commit 12deda27a4
2 changed files with 30 additions and 24 deletions
+10 -7
View File
@@ -136,7 +136,10 @@ curses_drv_close ()
refresh (); refresh ();
endwin (); endwin ();
drv_base_close (); if (curses_drv->framebuf != NULL)
free (curses_drv->framebuf);
curses_drv->framebuf = NULL;
} }
@@ -227,13 +230,13 @@ curses_drv_vbar (int x, int len)
char map[] = "_.,,ooO8"; char map[] = "_.,,ooO8";
int y; int y;
for (y = lcd.hgt; y > 0 && len > 0; y--) { for (y = curses_drv->hgt; y > 0 && len > 0; y--) {
if (len >= lcd.cellhgt) if (len >= curses_drv->cellhgt)
curses_drv_chr (x, y, '8'); curses_drv_chr (x, y, '8');
else else
curses_drv_chr (x, y, map[len - 1]); curses_drv_chr (x, y, map[len - 1]);
len -= lcd.cellhgt; len -= curses_drv->cellhgt;
} }
// move(4-len/lcd.cellhgt, x-1); // move(4-len/lcd.cellhgt, x-1);
@@ -247,13 +250,13 @@ curses_drv_vbar (int x, int len)
void void
curses_drv_hbar (int x, int y, int len) curses_drv_hbar (int x, int y, int len)
{ {
for (; x <= lcd.wid && len > 0; x++) { for (; x <= curses_drv->wid && len > 0; x++) {
if (len >= lcd.cellwid) if (len >= curses_drv->cellwid)
curses_drv_chr (x, y, '='); curses_drv_chr (x, y, '=');
else else
curses_drv_chr (x, y, '-'); curses_drv_chr (x, y, '-');
len -= lcd.cellwid; len -= curses_drv->cellwid;
} }
// move(y-1, x-1); // move(y-1, x-1);
+20 -17
View File
@@ -74,7 +74,10 @@ text_init (lcd_logical_driver * driver, char *args)
void void
text_close () text_close ()
{ {
drv_base_close (); if (lcd.framebuf != NULL)
free (lcd.framebuf);
lcd.framebuf = NULL;
} }
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
@@ -83,7 +86,7 @@ text_close ()
void void
text_clear () text_clear ()
{ {
memset (lcd.framebuf, ' ', lcd.wid * lcd.hgt); memset (text->framebuf, ' ', text->wid * text->hgt);
} }
@@ -93,7 +96,7 @@ text_clear ()
void void
text_flush () text_flush ()
{ {
text_draw_frame (lcd.framebuf); text_draw_frame (text->framebuf);
} }
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
@@ -109,7 +112,7 @@ text_string (int x, int y, char string[])
y -= 1; y -= 1;
for (i = 0; string[i]; i++) { for (i = 0; string[i]; i++) {
lcd.framebuf[(y * lcd.wid) + x + i] = string[i]; text->framebuf[(y * text->wid) + x + i] = string[i];
} }
} }
@@ -123,7 +126,7 @@ text_chr (int x, int y, char c)
y--; y--;
x--; x--;
lcd.framebuf[(y * lcd.wid) + x] = c; text->framebuf[(y * text->wid) + x] = c;
} }
int int
@@ -185,10 +188,10 @@ void
text_vbar (int x, int len) text_vbar (int x, int len)
{ {
int y; int y;
for (y = lcd.hgt; y > 0 && len > 0; y--) { for (y = text->hgt; y > 0 && len > 0; y--) {
text_chr (x, y, '|'); text_chr (x, y, '|');
len -= lcd.cellhgt; len -= text->cellhgt;
} }
} }
@@ -199,10 +202,10 @@ text_vbar (int x, int len)
void void
text_hbar (int x, int y, int len) text_hbar (int x, int y, int len)
{ {
for (; x <= lcd.wid && len > 0; x++) { for (; x <= text->wid && len > 0; x++) {
text_chr (x, y, '-'); text_chr (x, y, '-');
len -= lcd.cellwid; len -= text->cellwid;
} }
} }
@@ -226,25 +229,25 @@ text_draw_frame (char *dat)
// printf("Frame (%ix%i): \n%s\n", lcd.wid, lcd.hgt, dat); // printf("Frame (%ix%i): \n%s\n", lcd.wid, lcd.hgt, dat);
for (i = 0; i < lcd.wid; i++) { for (i = 0; i < text->wid; i++) {
out[i] = '-'; out[i] = '-';
} }
out[lcd.wid] = 0; out[text->wid] = 0;
printf ("+%s+\n", out); printf ("+%s+\n", out);
for (i = 0; i < lcd.hgt; i++) { for (i = 0; i < text->hgt; i++) {
for (j = 0; j < lcd.wid; j++) { for (j = 0; j < text->wid; j++) {
out[j] = dat[j + (i * lcd.wid)]; out[j] = dat[j + (i * text->wid)];
} }
out[lcd.wid] = 0; out[text->wid] = 0;
printf ("|%s|\n", out); printf ("|%s|\n", out);
} }
for (i = 0; i < lcd.wid; i++) { for (i = 0; i < text->wid; i++) {
out[i] = '-'; out[i] = '-';
} }
out[lcd.wid] = 0; out[text->wid] = 0;
printf ("+%s+\n", out); printf ("+%s+\n", out);
} }