diff --git a/cpi2png.c b/cpi2png.c index 4afd5cf..a321d82 100644 --- a/cpi2png.c +++ b/cpi2png.c @@ -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);