shootgun debug session #539
This commit is contained in:
16
Tools/essayage.sh
Executable file
16
Tools/essayage.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
make genplot2
|
||||
|
||||
cat > a.scratch << __EOT__
|
||||
0 0 0
|
||||
320 0 2
|
||||
320 240 2
|
||||
0 240 2
|
||||
0 0 2
|
||||
320 240 7
|
||||
__EOT__
|
||||
|
||||
./genplot2 -v -s 640x480 a.scratch foo.tga
|
||||
@@ -20,6 +20,7 @@
|
||||
static Image_Desc *image;
|
||||
static RGB_map map;
|
||||
static int curX, curY;
|
||||
static int verbeux;
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int initgr(int largeur, int hauteur)
|
||||
{
|
||||
@@ -30,7 +31,7 @@ if (NULL==(image=Image_alloc(largeur, hauteur, 3))) {
|
||||
exit(3);
|
||||
}
|
||||
|
||||
printf("Genplot2: initgr %d %d\n", largeur, hauteur);
|
||||
if (verbeux) fprintf(stderr, "Genplot2: initgr %d %d\n", largeur, hauteur);
|
||||
for (foo=0; foo<8; foo++) {
|
||||
#if DEBUG_LEVEL
|
||||
printf("\tPal(%d) = ", foo);
|
||||
@@ -58,7 +59,7 @@ fprintf(stderr, "\tMOVE %5d %5d\n", x, y);
|
||||
curX = x; curY = y;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int draw(int x, int y, int color)
|
||||
{
|
||||
RGBA rgba;
|
||||
@@ -76,7 +77,16 @@ if (idx != color) {
|
||||
rgba.r = map.red[color];
|
||||
rgba.g = map.green[color];
|
||||
rgba.b = map.blue[color];
|
||||
Image_draw_line(image, curX, curY, x, y, &rgba);
|
||||
|
||||
/* new Mon 19 Dec 2022 12:53:32 PM CET
|
||||
check for special cases: eg horizontal lines
|
||||
*/
|
||||
if (y == curY) {
|
||||
Image_H_line(image, curX, x, y, &rgba);
|
||||
}
|
||||
else {
|
||||
Image_draw_line(image, curX, curY, x, y, &rgba);
|
||||
}
|
||||
curX = x; curY = y;
|
||||
return 0;
|
||||
}
|
||||
@@ -84,7 +94,7 @@ return 0;
|
||||
int endgr(char *filename)
|
||||
{
|
||||
|
||||
fprintf(stderr, "genplot2 is saving to '%s'\n", filename);
|
||||
if (verbeux) fprintf(stderr, "genplot2 is saving to '%s'\n", filename);
|
||||
Image_TGA_save(filename, image, 0);
|
||||
|
||||
return 0;
|
||||
@@ -125,6 +135,7 @@ while ((opt = getopt(argc, argv, "hs:v")) != -1) {
|
||||
foo = parse_size_param(optarg, &outw, &outh);
|
||||
break;
|
||||
case 'v':
|
||||
verbeux = 1;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "invalid opt %d\n", opt);
|
||||
@@ -138,8 +149,11 @@ else filename = argv[optind];
|
||||
if (argc<=optind+1) image = "image.tga";
|
||||
else image = argv[optind+1];
|
||||
|
||||
fprintf(stderr, "argc %d optind %d file '%s' image '%s'\n",
|
||||
if (verbeux) {
|
||||
fprintf(stderr, "argc %d optind %d file '%s' image '%s'\n",
|
||||
argc, optind, filename, image);
|
||||
fprintf(stderr, " picsize : %d %d\n", outw, outh);
|
||||
}
|
||||
/*----------- giving to the yuser some useless informations --- */
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "*** Genplot2 v 1.0.9 (dwtfywl) 1995,2010,2022 TontonTh \n");
|
||||
|
||||
Reference in New Issue
Block a user