another big clean

This commit is contained in:
tTh
2022-09-21 00:06:11 +02:00
parent 1175eece63
commit a4e3d073f5
17 changed files with 261 additions and 438 deletions

View File

@@ -25,6 +25,7 @@
#define T_FONTE 2048
static uint8_t priv_fonte[T_FONTE];
static int font_is_loaded;
/*::------------------------------------------------------------------::*/
/*
@@ -57,7 +58,7 @@ if ( (fd=Image_must_open(nomfnt, O_RDONLY, 0)) < 0 ) {
foo = read(fd, priv_fonte, T_FONTE);
if ( foo != T_FONTE ) {
fprintf(stderr, "%s: error when reading font datas\n", __func__);
fprintf(stderr, "%s: read only %d bytes from font file\n", __func__, foo);
exit(5);
}
close(fd);
@@ -220,8 +221,7 @@ return 0;
* Don't forget to load a font, eg :
* Image_load_fnt8x8("8x8thin", NULL, 0);
*/
int
Image_trace_big_char_0(Image_Desc *im, int x, int y, int code, int kx, int ky)
int Image_trace_big_char_0(Image_Desc *im, int x, int y, int code, int kx, int ky)
{
int foo, bar;
uint8_t octet;
@@ -236,19 +236,22 @@ fprintf(stderr, "%s ( %p %4d %4d %s %d %d )\n", __func__, im,
x, y, buff, kx, ky);
#endif
if ( (code < 0) || (code > 255))
{
if ( (code < 0) || (code > 255)) {
fprintf(stderr, "in %s, code (%d) is invalid\n", __func__, code);
return BAD_PARAMETER;
}
Image_load_fnt8x8("8x8thin", NULL, 0);
/* Image_load_fnt8x8("8x8thin", NULL, 0); */
paper.r = paper.g = paper.b = 0;
ink.r = ink.g = ink.b = 255;
ink.r = ink.g = ink.b = 255;
rect.w = kx, rect.h = ky;
/*
* NEED BOUNDARY CHECK !
*/
for (foo=0; foo<8; foo++) /* 8 scan lines */
{
octet = priv_fonte[(code*8)+foo];
@@ -259,9 +262,6 @@ for (foo=0; foo<8; foo++) /* 8 scan lines */
rect.x = ((8-bar)*kx) + x;
if (octet & 1)
{
#if DEBUG_LEVEL > 1
Image_plotRGB(im, x+8-bar, y+foo, 255, 255, 255);
#endif
Image_paint_rect(im, &rect, 255, 198, 0);
Image_draw_rect(im, &rect, 0, 0, 80);
}