Unallocated framebuffer fix.

This commit is contained in:
robijn
2001-11-23 15:15:05 +00:00
parent 97457f45bd
commit efcbed6026
4 changed files with 82 additions and 56 deletions
+6
View File
@@ -175,6 +175,12 @@ CFontz_init (lcd_logical_driver * driver, char *args)
// Do it... // Do it...
tcsetattr (fd, TCSANOW, &portset); tcsetattr (fd, TCSANOW, &portset);
// Make sure the frame buffer is there...
if (!CFontz->framebuf)
CFontz->framebuf = (unsigned char *)
malloc (CFontz->wid * CFontz->hgt);
memset (CFontz->framebuf, ' ', CFontz->wid * CFontz->hgt);
// Set display-specific stuff.. // Set display-specific stuff..
if (reboot) { if (reboot) {
CFontz_reboot (); CFontz_reboot ();
-1
View File
@@ -387,7 +387,6 @@ MtxOrb_init (lcd_logical_driver * driver, char *args)
malloc (MtxOrb->wid * MtxOrb->hgt); malloc (MtxOrb->wid * MtxOrb->hgt);
memset (MtxOrb->framebuf, ' ', MtxOrb->wid * MtxOrb->hgt); memset (MtxOrb->framebuf, ' ', MtxOrb->wid * MtxOrb->hgt);
// Allocate and clear the buffer for incremental updates // Allocate and clear the buffer for incremental updates
lcd_contents = (unsigned char *) malloc (MtxOrb->wid * MtxOrb->hgt); lcd_contents = (unsigned char *) malloc (MtxOrb->wid * MtxOrb->hgt);
if (!lcd_contents) { return -1; } if (!lcd_contents) { return -1; }
+14 -2
View File
@@ -185,6 +185,12 @@ int LB216_init(lcd_logical_driver *driver, char *args)
tcsetattr(fd, TCSANOW, &portset); tcsetattr(fd, TCSANOW, &portset);
// Make sure the frame buffer is there...
if (!LB216->framebuf)
LB216->framebuf = (unsigned char *)
malloc (LB216->wid * LB216->hgt);
memset (LB216->framebuf, ' ', LB216->wid * LB216->hgt);
// Set display-specific stuff.. // Set display-specific stuff..
if(reboot) if(reboot)
{ {
@@ -268,8 +274,14 @@ void LB216_chr(int x, int y, char c)
//if(c < 32 && c >= 0) c += 128; //if(c < 32 && c >= 0) c += 128;
// LB216->framebuf[(y*LB216->wid) + x] = c; // LB216->framebuf[(y*LB216->wid) + x] = c;
char chr[1];
snprintf (chr, sizeof(chr), "%c", c); // char chr[1];
// snprintf (chr, sizeof(chr), "%c", c);
// Above two lines are incorrect (Joris)
char chr[2];
chr[0] = c;
chr[1] = 0;
LB216_string (x, y, chr); LB216_string (x, y, chr);
} }
+9
View File
@@ -38,6 +38,15 @@ text_init (lcd_logical_driver * driver, char *args)
{ {
text = driver; text = driver;
// Make sure the frame buffer is there...
if (!text->framebuf)
text->framebuf = (unsigned char *)
malloc (text->wid * text->hgt);
memset (text->framebuf, ' ', text->wid * text->hgt);
// Set the functions the driver supports
text->wid = LCD_DEFAULT_WIDTH; text->wid = LCD_DEFAULT_WIDTH;
text->hgt = LCD_DEFAULT_HEIGHT; text->hgt = LCD_DEFAULT_HEIGHT;
text->cellwid = LCD_DEFAULT_CELL_WIDTH; text->cellwid = LCD_DEFAULT_CELL_WIDTH;