patch-2.1.110 linux/drivers/video/fbcon-cfb8.c
Next file: linux/drivers/video/fbcon-ilbm.c
Previous file: linux/drivers/video/fbcon-cfb4.c
Back to the patch index
Back to the overall index
- Lines: 210
- Date:
Sat Jul 18 13:55:46 1998
- Orig file:
v2.1.109/linux/drivers/video/fbcon-cfb8.c
- Orig date:
Thu Jul 16 18:09:27 1998
diff -u --recursive --new-file v2.1.109/linux/drivers/video/fbcon-cfb8.c linux/drivers/video/fbcon-cfb8.c
@@ -51,23 +51,30 @@
int bytes = p->next_line, linesize = bytes * p->fontheight, rows;
u8 *src,*dst;
- if (sx == 0 && dx == 0 && width * 8 == bytes)
+ if (sx == 0 && dx == 0 && width * p->fontwidth == bytes) {
mymemmove(p->screen_base + dy * linesize,
p->screen_base + sy * linesize,
height * linesize);
- else if (dy < sy || (dy == sy && dx < sx)) {
- src = p->screen_base + sy * linesize + sx * 8;
- dst = p->screen_base + dy * linesize + dx * 8;
+ return;
+ }
+ if (p->fontwidthlog) {
+ sx <<= p->fontwidthlog; dx <<= p->fontwidthlog; width <<= p->fontwidthlog;
+ } else {
+ sx *= p->fontwidth; dx *= p->fontwidth; width *= p->fontwidth;
+ }
+ if (dy < sy || (dy == sy && dx < sx)) {
+ src = p->screen_base + sy * linesize + sx;
+ dst = p->screen_base + dy * linesize + dx;
for (rows = height * p->fontheight ; rows-- ;) {
- mymemmove(dst, src, width * 8);
+ mymemmove(dst, src, width);
src += bytes;
dst += bytes;
}
} else {
- src = p->screen_base + (sy+height) * linesize + sx * 8 - bytes;
- dst = p->screen_base + (dy+height) * linesize + dx * 8 - bytes;
+ src = p->screen_base + (sy+height) * linesize + sx - bytes;
+ dst = p->screen_base + (dy+height) * linesize + dx - bytes;
for (rows = height * p->fontheight ; rows-- ;) {
- mymemmove(dst, src, width * 8);
+ mymemmove(dst, src, width);
src -= bytes;
dst -= bytes;
}
@@ -77,32 +84,20 @@
void fbcon_cfb8_clear(struct vc_data *conp, struct display *p, int sy, int sx,
int height, int width)
{
- u8 *dest0,*dest;
- int bytes=p->next_line,lines=height * p->fontheight, rows, i;
- u32 bgx;
+ u8 *dest;
+ int bytes=p->next_line,lines=height * p->fontheight, rows;
+ u8 bgx;
- dest = p->screen_base + sy * p->fontheight * bytes + sx * 8;
+ dest = p->screen_base + sy * p->fontheight * bytes + sx * p->fontwidth;
bgx=attr_bgcol_ec(p,conp);
- bgx |= (bgx << 8);
- bgx |= (bgx << 16);
- if (sx == 0 && width * 8 == bytes)
- for (i = 0 ; i < lines * width ; i++) {
- ((u32 *)dest)[0]=bgx;
- ((u32 *)dest)[1]=bgx;
- dest+=8;
- }
+ if (sx == 0 && p->fontwidth == 8 && width * 8 == bytes)
+ memset(dest, bgx, lines * width * p->fontwidth);
else {
- dest0=dest;
- for (rows = lines; rows-- ; dest0 += bytes) {
- dest=dest0;
- for (i = 0 ; i < width ; i++) {
- ((u32 *)dest)[0]=bgx;
- ((u32 *)dest)[1]=bgx;
- dest+=8;
- }
- }
+ width *= p->fontwidth;
+ for (rows = lines; rows-- ; dest += bytes)
+ memset(dest, bgx, width);
}
}
@@ -114,7 +109,10 @@
u32 eorx,fgx,bgx;
dest = p->screen_base + yy * p->fontheight * bytes + xx * 8;
- cdat = p->fontdata + (c & 0xff) * p->fontheight;
+ if (p->fontwidth <= 8)
+ cdat = p->fontdata + (c & 0xff) * p->fontheight;
+ else
+ cdat = p->fontdata + ((c & 0xff) * p->fontheight << 1);
fgx=attr_fgcol(p,c);
bgx=attr_bgcol(p,c);
@@ -124,9 +122,28 @@
bgx |= (bgx << 16);
eorx = fgx ^ bgx;
- for (rows = p->fontheight ; rows-- ; dest += bytes) {
- ((u32 *)dest)[0]= (nibbletab_cfb8[*cdat >> 4] & eorx) ^ bgx;
- ((u32 *)dest)[1]= (nibbletab_cfb8[*cdat++ & 0xf] & eorx) ^ bgx;
+ switch (p->fontwidth) {
+ case 4:
+ for (rows = p->fontheight ; rows-- ; dest += bytes)
+ ((u32 *)dest)[0]= (nibbletab_cfb8[*cdat++ >> 4] & eorx) ^ bgx;
+ break;
+ case 8:
+ for (rows = p->fontheight ; rows-- ; dest += bytes) {
+ ((u32 *)dest)[0]= (nibbletab_cfb8[*cdat >> 4] & eorx) ^ bgx;
+ ((u32 *)dest)[1]= (nibbletab_cfb8[*cdat++ & 0xf] & eorx) ^ bgx;
+ }
+ break;
+ case 12:
+ case 16:
+ for (rows = p->fontheight ; rows-- ; dest += bytes) {
+ ((u32 *)dest)[0]= (nibbletab_cfb8[*(u16 *)cdat >> 12] & eorx) ^ bgx;
+ ((u32 *)dest)[1]= (nibbletab_cfb8[(*(u16 *)cdat >> 8) & 0xf] & eorx) ^ bgx;
+ ((u32 *)dest)[2]= (nibbletab_cfb8[(*(u16 *)cdat >> 4) & 0xf] & eorx) ^ bgx;
+ if (p->fontwidth == 16)
+ ((u32 *)dest)[3]= (nibbletab_cfb8[*cdat & 0xf] & eorx) ^ bgx;
+ cdat += 2;
+ }
+ break;
}
}
@@ -145,15 +162,46 @@
bgx |= (bgx << 8);
bgx |= (bgx << 16);
eorx = fgx ^ bgx;
- while (count--) {
- c = *s++;
- cdat = p->fontdata + c * p->fontheight;
-
- for (rows = p->fontheight, dest = dest0; rows-- ; dest += bytes) {
- ((u32 *)dest)[0]= (nibbletab_cfb8[*cdat >> 4] & eorx) ^ bgx;
- ((u32 *)dest)[1]= (nibbletab_cfb8[*cdat++ & 0xf] & eorx) ^ bgx;
- }
- dest0+=8;
+ switch (p->fontwidth) {
+ case 4:
+ while (count--) {
+ c = *s++;
+ cdat = p->fontdata + c * p->fontheight;
+
+ for (rows = p->fontheight, dest = dest0; rows-- ; dest += bytes)
+ ((u32 *)dest)[0]= (nibbletab_cfb8[*cdat++ >> 4] & eorx) ^ bgx;
+ dest0+=4;
+ }
+ break;
+ case 8:
+ while (count--) {
+ c = *s++;
+ cdat = p->fontdata + c * p->fontheight;
+
+ for (rows = p->fontheight, dest = dest0; rows-- ; dest += bytes) {
+ ((u32 *)dest)[0]= (nibbletab_cfb8[*cdat >> 4] & eorx) ^ bgx;
+ ((u32 *)dest)[1]= (nibbletab_cfb8[*cdat++ & 0xf] & eorx) ^ bgx;
+ }
+ dest0+=8;
+ }
+ break;
+ case 12:
+ case 16:
+ while (count--) {
+ c = *s++;
+ cdat = p->fontdata + (c * p->fontheight << 1);
+
+ for (rows = p->fontheight, dest = dest0; rows-- ; dest += bytes) {
+ ((u32 *)dest)[0]= (nibbletab_cfb8[*(u16 *)cdat >> 12] & eorx) ^ bgx;
+ ((u32 *)dest)[1]= (nibbletab_cfb8[(*(u16 *)cdat >> 8) & 0xf] & eorx) ^ bgx;
+ ((u32 *)dest)[2]= (nibbletab_cfb8[(*(u16 *)cdat >> 4) & 0xf] & eorx) ^ bgx;
+ if (p->fontwidth == 16)
+ ((u32 *)dest)[3]= (nibbletab_cfb8[*cdat & 0xf] & eorx) ^ bgx;
+ cdat += 2;
+ }
+ dest0+=p->fontwidth;
+ }
+ break;
}
}
@@ -162,10 +210,15 @@
u8 *dest;
int bytes=p->next_line, rows;
- dest = p->screen_base + yy * p->fontheight * bytes + xx * 8;
+ dest = p->screen_base + yy * p->fontheight * bytes + xx * p->fontwidth;
for (rows = p->fontheight ; rows-- ; dest += bytes) {
- ((u32 *)dest)[0] ^= 0x0f0f0f0f;
- ((u32 *)dest)[1] ^= 0x0f0f0f0f;
+ switch (p->fontwidth) {
+ case 16: ((u32 *)dest)[3] ^= 0x0f0f0f0f; /* FALL THROUGH */
+ case 12: ((u32 *)dest)[2] ^= 0x0f0f0f0f; /* FALL THROUGH */
+ case 8: ((u32 *)dest)[1] ^= 0x0f0f0f0f; /* FALL THROUGH */
+ case 4: ((u32 *)dest)[0] ^= 0x0f0f0f0f; /* FALL THROUGH */
+ default: break;
+ }
}
}
@@ -176,7 +229,8 @@
struct display_switch fbcon_cfb8 = {
fbcon_cfb8_setup, fbcon_cfb8_bmove, fbcon_cfb8_clear, fbcon_cfb8_putc,
- fbcon_cfb8_putcs, fbcon_cfb8_revc, NULL
+ fbcon_cfb8_putcs, fbcon_cfb8_revc, NULL, NULL,
+ FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16)
};
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov