Re-indent CFontzPacket_flush to match file's indent style. Strip trailing spaces.
This commit is contained in:
@@ -471,94 +471,98 @@ CFontzPacket_cellheight (Driver *drvthis)
|
||||
MODULE_EXPORT void
|
||||
CFontzPacket_flush (Driver *drvthis)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
int modified = 0;
|
||||
int i,j;
|
||||
PrivateData *p = drvthis->private_data;
|
||||
int modified = 0;
|
||||
int i, j;
|
||||
|
||||
if (p->model == 633) {
|
||||
/*
|
||||
* For CF633 we don't use delta update yet.
|
||||
* Older HW/FW types only support updates of full or partial line starting from pos 0.
|
||||
*/
|
||||
unsigned char *xp = p->framebuf;
|
||||
unsigned char *xq = p->backingstore;
|
||||
if (p->model == 633) {
|
||||
/*
|
||||
* For CF633 we don't use delta update yet. Older HW/FW types
|
||||
* only support updates of full or partial line starting from
|
||||
* pos 0.
|
||||
*/
|
||||
unsigned char *xp = p->framebuf;
|
||||
unsigned char *xq = p->backingstore;
|
||||
|
||||
for (i = 0; i < p->width; i++) {
|
||||
if (*xp++ != *xq++) {
|
||||
send_bytes_message(p->fd, CF633_Set_LCD_Contents_Line_One, 16, p->framebuf);
|
||||
memcpy(p->backingstore, p->framebuf, p->width);
|
||||
modified++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < p->width; i++) {
|
||||
if (*xp++ != *xq++) {
|
||||
send_bytes_message(p->fd, CF633_Set_LCD_Contents_Line_One, 16, p->framebuf);
|
||||
memcpy(p->backingstore, p->framebuf, p->width);
|
||||
modified++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
xp = p->framebuf + p->width;
|
||||
xq = p->backingstore + p->width;
|
||||
xp = p->framebuf + p->width;
|
||||
xq = p->backingstore + p->width;
|
||||
|
||||
for (i = 0; i < p->width; i++) {
|
||||
if (*xp++ != *xq++) {
|
||||
send_bytes_message(p->fd, CF633_Set_LCD_Contents_Line_Two, 16, p->framebuf + p->width);
|
||||
memcpy(p->backingstore + p->width, p->framebuf + p->width, p->width);
|
||||
modified++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else { /* (p->model != 633) */
|
||||
/*
|
||||
* CF631 / CF635 protocol is more flexible and we can do real delta update.
|
||||
*/
|
||||
for (i = 0; i < p->width; i++) {
|
||||
if (*xp++ != *xq++) {
|
||||
send_bytes_message(p->fd, CF633_Set_LCD_Contents_Line_Two, 16, p->framebuf + p->width);
|
||||
memcpy(p->backingstore + p->width, p->framebuf + p->width, p->width);
|
||||
modified++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* CF631 / CF635 protocol is more flexible and we can do real
|
||||
* delta update.
|
||||
*/
|
||||
|
||||
for (i = 0; i < p->height; i++) {
|
||||
/* Strategy:
|
||||
* - not more than one update command per line
|
||||
* - leave out leading and trailing parts that are identical
|
||||
*/
|
||||
for (i = 0; i < p->height; i++) {
|
||||
/*-
|
||||
* Strategy:
|
||||
* - not more than one update command per line
|
||||
* - leave out leading and trailing parts that
|
||||
* are identical
|
||||
*/
|
||||
|
||||
// set pointers to start of the line in frame buffer & backing store
|
||||
unsigned char *sp = p->framebuf + (i * p->width);
|
||||
unsigned char *sq = p->backingstore + (i * p->width);
|
||||
/* set pointers to start of the line in frame buffer & backing store */
|
||||
unsigned char *sp = p->framebuf + (i * p->width);
|
||||
unsigned char *sq = p->backingstore + (i * p->width);
|
||||
|
||||
// set pointers to end of the line in frame buffer & backing store
|
||||
unsigned char *ep = sp + (p->width - 1);
|
||||
unsigned char *eq = sq + (p->width - 1);
|
||||
int length = 0;
|
||||
/* set pointers to end of the line in frame buffer & backing store */
|
||||
unsigned char *ep = sp + (p->width - 1);
|
||||
unsigned char *eq = sq + (p->width - 1);
|
||||
int length = 0;
|
||||
|
||||
debug(RPT_DEBUG, "Framebuf: '%.*s'", p->width, sp);
|
||||
debug(RPT_DEBUG, "Backingstore: '%.*s'", p->width, sq);
|
||||
debug(RPT_DEBUG, "Framebuf: '%.*s'", p->width, sp);
|
||||
debug(RPT_DEBUG, "Backingstore: '%.*s'", p->width, sq);
|
||||
|
||||
// skip over leading identical portions of the line
|
||||
for (j = 0; (sp <= ep) && (*sp == *sq); sp++, sq++, j++)
|
||||
;
|
||||
/* skip over leading identical portions of the line */
|
||||
for (j = 0; (sp <= ep) && (*sp == *sq); sp++, sq++, j++)
|
||||
;
|
||||
|
||||
// skip over trailing identical portions of the line
|
||||
for (length = p->width - j; (length > 0) && (*ep == *eq); ep--, eq--, length--)
|
||||
;
|
||||
/* skip over trailing identical portions of the line */
|
||||
for (length = p->width - j; (length > 0) && (*ep == *eq); ep--, eq--, length--)
|
||||
;
|
||||
|
||||
/* there are differences, ... */
|
||||
if (length > 0) {
|
||||
unsigned char out[length + 3];
|
||||
/* there are differences, ... */
|
||||
if (length > 0) {
|
||||
unsigned char out[length + 3];
|
||||
|
||||
/* ... send then to the LCD */
|
||||
out[0] = j; // column
|
||||
out[1] = i; // line
|
||||
/* ... send then to the LCD */
|
||||
out[0] = j; /* column */
|
||||
out[1] = i; /* line */
|
||||
|
||||
debug(RPT_DEBUG, "%s: l=%d c=%d count=%d string='%.*s'",
|
||||
__FUNCTION__, out[0], out[1], length, length, sp);
|
||||
debug(RPT_DEBUG, "%s: l=%d c=%d count=%d string='%.*s'",
|
||||
__FUNCTION__, out[0], out[1], length, length, sp);
|
||||
|
||||
memcpy(&out[2], sp, length);
|
||||
send_bytes_message(p->fd, CF633_Send_Data_to_LCD, length + 2, out);
|
||||
modified++;
|
||||
}
|
||||
} // i < p->height
|
||||
memcpy(&out[2], sp, length);
|
||||
send_bytes_message(p->fd, CF633_Send_Data_to_LCD, length + 2, out);
|
||||
modified++;
|
||||
}
|
||||
} /* i < p->height */
|
||||
|
||||
if (modified)
|
||||
memcpy(p->backingstore, p->framebuf, p->width * p->height);
|
||||
}
|
||||
if (modified)
|
||||
memcpy(p->backingstore, p->framebuf, p->width * p->height);
|
||||
}
|
||||
|
||||
/* send something to the LCD to allow keys to be received */
|
||||
if (!modified)
|
||||
send_bytes_message(p->fd,CF633_Ping_Command, 0, NULL);
|
||||
/* send something to the LCD to allow keys to be received */
|
||||
if (!modified)
|
||||
send_bytes_message(p->fd, CF633_Ping_Command, 0, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user