garbage collecting again

This commit is contained in:
tth
2022-07-07 12:52:00 +02:00
parent 6455be4d5b
commit 95beee167d
43 changed files with 343 additions and 341 deletions
+11 -15
View File
@@ -12,7 +12,7 @@
#include "../tthimage.h"
#define VERSION_STRING "5 octobre 2015"
#define VERSION_STRING "7 juiller 2022"
/*::------------------------------------------------------------------::*/
/*:: private variables */
@@ -45,7 +45,7 @@ int taille;
uint8_t *pbits;
#if DEBUG_LEVEL
fprintf(stderr, "%s ( %d %d )\n", __func__, w, h);
fprintf(stderr, ">>> %s ( %d %d )\n", __func__, w, h);
#endif
/* is there a sanity check on the dimensions ? */
@@ -90,7 +90,7 @@ int Image_free_that_BP(A_BitPlane *bp, int k)
{
#if DEBUG_LEVEL
fprintf(stderr, "%s ( %p %d )\n", __func__, bp, k);
fprintf(stderr, ">>> %s ( %p %d )\n", __func__, bp, k);
#endif
if (bp->magic != MAGIC_BIT_PLANE) {
@@ -117,7 +117,7 @@ return FUNC_IS_ALPHA;
int Image_BP_setname(A_BitPlane *bp, const char *name)
{
#if DEBUG_LEVEL
fprintf(stderr, "%s ( %p '%s' )\n", __func__, bp, name);
fprintf(stderr, ">>> %s ( %p '%s' )\n", __func__, bp, name);
#endif
if (MAGIC_BIT_PLANE != bp->magic) {
@@ -186,10 +186,9 @@ offbit = x % 8;
fprintf(stderr, " offbyte %d, offbit %d\n", offbyte, offbit);
fprintf(stderr, " avant 0x%02x\n", bp->plane[offbyte]);
#endif
if (bit)
bp->plane[offbyte] |= (1 << offbit);
else
bp->plane[offbyte] &= ~(1 << offbit);
if (bit) bp->plane[offbyte] |= (1 << offbit);
else bp->plane[offbyte] &= ~(1 << offbit);
#if DEBUG_LEVEL > 1
fprintf(stderr, " apres 0x%02x\n", bp->plane[offbyte]);
@@ -243,7 +242,7 @@ fprintf(stderr, "%s ( %p '%s' 0x%03x )\n", __func__, bp, fname, k);
if (NULL==(fp=fopen(fname, "w")))
{
fprintf(stderr, "fucked in %s\n", __func__);
fprintf(stderr, "fucked in %s on file '%s'\n", __func__, fname);
return FULL_NUCKED;
}
@@ -252,17 +251,14 @@ fprintf(fp, "# written by libtthimage v %s\n# bitplane module '%s'\n",
IMAGE_VERSION_STRING, VERSION_STRING);
chariot = 0;
for (y=0; y<bp->height; y++)
{
for (x=0; x<bp->width; x++)
{
for (y=0; y<bp->height; y++) {
for (x=0; x<bp->width; x++) {
Image_BP_pget(bp, x, y, &v);
if (v) fputc('1', fp);
else fputc('0', fp);
if (chariot++ < 74)
fputc(' ', fp);
else
{
else {
fputc('\n', fp); chariot=0;
}
}