Casey 2024-10-03 22:25:58 +03:00
parent 36c19b23dc
commit d0cf362c1b
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
1 changed files with 6 additions and 6 deletions

View File

@ -49,7 +49,7 @@ int main(int argc, char **argv) {
assert(false && "Failed to read size: unsupported version");
}
union color *canvas = malloc(width * height * 8 * 11 * sizeof(union color));
union color *canvas = malloc(width * height * 6 * 9 * sizeof(union color));
// XXX: may change in future when we introduce variable-size palettes
@ -73,16 +73,16 @@ int main(int argc, char **argv) {
unsigned char color = fgetc(fp_in);
union color background = colors[color & 0xF];
union color foreground = colors[color >> 4];
for (int oy = 0; oy < 11; oy++) {
for (int ox = 0; ox < 8; ox++) {
union color pix = ((0x80 >> ox) & cc_font_atlas[sym][oy]) ? foreground : background;
canvas[ox + (x + (y * 11 + oy) * width) * 8] = pix;
for (int oy = 0; oy < 9; oy++) {
for (int ox = 0; ox < 6; ox++) {
union color pix = ((0x80 >> (ox + 1)) & cc_font_atlas[sym][oy + 1]) ? foreground : background;
canvas[ox + (x + (y * 9 + oy) * width) * 6] = pix;
}
}
}
}
stbi_write_png(argv[2], width * 8, height * 11, 4, canvas, 0);
stbi_write_png(argv[2], width * 6, height * 9, 4, canvas, 0);
free(colors);
free(canvas);