aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin Borner2020-07-26 12:55:57 +0200
committerMarvin Borner2020-07-26 12:56:18 +0200
commit141ee54c3fc9a2f4f0b6c7158b9f1ccb22af3626 (patch)
treed28fdd0a1aaef7872da4a8ae3afc4eec50beb4fd
parente946d9c56cf6f66dc277241f64614e5e05ca4ea0 (diff)
Seems to work quite well
-rw-r--r--src/features/psf.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/features/psf.c b/src/features/psf.c
index d830426..3294431 100644
--- a/src/features/psf.c
+++ b/src/features/psf.c
@@ -27,30 +27,24 @@ void psf_test(char *chars, int height, int width, int char_size)
{
char ch = 'a';
int x = 0;
- int y = 400;
+ int y = 0;
const u32 c[3] = { 0xff, 0x00, 0x00 };
printf("%d %d %d\n", height, width, char_size);
int pos = x * vbe_bpl + y * vbe_pitch;
char *draw = (char *)&fb[pos];
- u16 row = 0;
+ u32 stride = char_size / height;
for (int cy = 0; cy < height; cy++) {
- row = chars[ch * char_size + cy * (char_size / height)];
-
for (int cx = 0; cx < width; cx++) {
- if (row & (1 << (width - 1))) {
+ u8 bits = chars[ch * char_size + cy * stride + cx / 8];
+ u8 bit = bits >> (7 - cx % 8) & 1;
+ if (bit) {
draw[vbe_bpl * cx] = (char)c[2];
draw[vbe_bpl * cx + 1] = (char)c[1];
draw[vbe_bpl * cx + 2] = (char)c[0];
}
- /* } else { */
- /* draw[vbe_bpl * cx] = (char)c[2]; */
- /* draw[vbe_bpl * cx + 1] = (char)terminal_background[1]; */
- /* draw[vbe_bpl * cx + 2] = (char)terminal_background[0]; */
- /* } */
- row <<= 1;
}
draw += vbe_pitch;
}