Fixed miscellaneous bugs relating to optimization of MatrixOrbital driver.

Now only displays that which has changed...
This commit is contained in:
ddouthitt
2001-10-01 21:54:02 +00:00
parent 487242f925
commit 9d8b1f45a3
+13 -3
View File
@@ -953,6 +953,8 @@ MtxOrb_num (int x, int num)
// TODO: This could be higly optimised if data where to be pre-computed. // TODO: This could be higly optimised if data where to be pre-computed.
#define MAX_CUSTOM_CHARS 7
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Sets a custom character from 0-7... // Sets a custom character from 0-7...
// //
@@ -967,7 +969,7 @@ MtxOrb_set_char (int n, char *dat)
int row, col; int row, col;
int letter; int letter;
if (n < 0 || n > 7) if (n < 0 || n > MAX_CUSTOM_CHARS)
return; return;
if (!dat) if (!dat)
return; return;
@@ -978,10 +980,14 @@ MtxOrb_set_char (int n, char *dat)
for (row = 0; row < MtxOrb->cellhgt; row++) { for (row = 0; row < MtxOrb->cellhgt; row++) {
letter = 0; letter = 0;
for (col = 0; col < MtxOrb->cellwid; col++) { for (col = 0; col < MtxOrb->cellwid; col++) {
// shift to make room for new scan line data
letter <<= 1; letter <<= 1;
// Now read a single bit of data -- one entry in dat[] --
// and add it to the binary data in "letter"
letter |= (dat[(row * MtxOrb->cellwid) + col] > 0); letter |= (dat[(row * MtxOrb->cellwid) + col] > 0);
} }
write (fd, &letter, 1); write (fd, &letter, 1); // write one character for each row
} }
} }
@@ -1066,9 +1072,13 @@ MtxOrb_draw_frame (char *dat)
for (i = 1; i <= MtxOrb->hgt; i++) { for (i = 1; i <= MtxOrb->hgt; i++) {
for (j = 1; j <= MtxOrb->wid; j++) { for (j = 1; j <= MtxOrb->wid; j++) {
if ((*p) == (*q)) if ((*p == *q) && (*p > 8))
mv = 1; mv = 1;
else { else {
// Draw characters that have changed, as well
// as custom characters. We know not if a custom
// character has changed.
if (mv == 1) { if (mv == 1) {
snprintf(out, sizeof(out), "\x0FEG%c%c", j, i); snprintf(out, sizeof(out), "\x0FEG%c%c", j, i);
write (fd, out, 4); write (fd, out, 4);