more clean

This commit is contained in:
tTh
2023-09-28 23:50:23 +02:00
parent 21de0960e8
commit 2594cabf94
15 changed files with 68 additions and 47 deletions

View File

@@ -35,7 +35,7 @@ int Image_load_fnt8x8(char *nomfnt, uint8_t *ou, int flags)
{
int fd, foo;
#if DEBUG_LEVEL > -1
#if DEBUG_LEVEL > 1
fprintf(stderr, ">>> %s ( '%s' %p %d )\n", __func__, nomfnt, ou, flags);
#endif
@@ -47,7 +47,9 @@ if (0 != flags)
/* patch du 24 septembre 2015 */
if (NULL == nomfnt) {
nomfnt = "libimage.fonte";
fprintf(stderr, "%s : using default font '%s'\n", __func__, nomfnt);
#if DEBUG_LEVEL
fprintf(stderr, " using default font '%s'\n", nomfnt);
#endif
}
/* on pourrait aussi mettre la fonte par ddefaut dans l'environ */
@@ -56,6 +58,10 @@ if ( (fd=Image_must_open(nomfnt, O_RDONLY, 0)) < 0 ) {
exit(5);
}
/*
* Maybe add a check on the size of the file ?
*/
foo = read(fd, priv_fonte, T_FONTE);
if ( foo != T_FONTE ) {
fprintf(stderr, "%s: read only %d bytes from font file\n", __func__, foo);
@@ -67,6 +73,8 @@ close(fd);
fprintf(stderr, "%s : font '%s' loaded\n", __func__, nomfnt);
#endif
font_is_loaded = 1;
return OLL_KORRECT;
}
/*::------------------------------------------------------------------::*/
@@ -154,6 +162,7 @@ int foo;
fprintf(stderr, "THE FUNCTION '%s' IS OBSOLETE\n", __func__);
if (0 != flags)
fprintf(stderr, "in %s, 'flags' (%d) must be 0\n", __func__, flags);
foo = Image_trace_chaine_1(im, txt, x, y, "libimage.fonte", paper, ink);
return foo;
@@ -171,9 +180,14 @@ int posx, posy, t_texte, foo;
int octet;
uint8_t *ptrtxt;
RGBA blanc = { 255, 255, 255, 255, 0, 0 };
RGBA noir = { 0, 0, 0, 64, 0, 0 };
RGBA noir = { 0, 0, 0, 64, 0, 0 };
if (nomfonte==NULL) {
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p '%s' %d %d '%s' %p %p\n", __func__,
im, txt, x, y, nomfonte, paper, ink);
#endif
if (NULL == nomfonte) {
#if DEBUG_LEVEL > 1
fprintf(stderr, "trace chaine 1: using loaded font\n");
#endif
@@ -188,7 +202,7 @@ else {
if (NULL==paper) paper = &blanc;
if (NULL==ink) ink = &noir;
#if DEBUG_LEVEL > 1
#if DEBUG_LEVEL
Image_print_rgba("encre", ink, 0);
Image_print_rgba("papier", paper, 0);
#endif