maybe fix a bug in trinitron

This commit is contained in:
tTh 2024-03-27 08:36:18 +01:00
parent 65c0212108
commit 4ecce5bdc0

View File

@ -127,6 +127,9 @@ static int pixel_trinitron(FloatImg *pimg, int pos[4], float *fvals)
int x, y, pline, off;
int ym;
// fprintf(stderr, ">>> %s ( %p %d,%d,%d,%d )\n", __func__, pimg,
// pos[0], pos[1], pos[2], pos[3]);
fimg_clear_rectangle(pimg, pos);
ym = pos[1]+pos[3]-1;
@ -137,6 +140,7 @@ for (y=pos[1]; y<ym; y++) {
pline = y*pimg->width;
for (x=0; x<5; x++) {
off = pline + (x+pos[0]);
/* wtf i'm doing here ? */
if ( (pos[1]==y) || (ym-1==y) ) {
pimg->R[off] = fvals[0] * FDIM;
@ -179,21 +183,22 @@ fprintf(stderr, ">>> %s ( %p %d )\n", __func__, pimg, notused);
* And this mistake is all around the code /o\
*
*/
#define STP 8 /* stepd for x & y axex */
#define STP 15 /* stepd for x & y axex */
coo[2] = coo[3] = STP;
for (y=0; y < pimg->height; y+=STP) {
for (y=0; y < pimg->height-STP; y+=STP) {
coo[1] = y;
for (x=0; x < pimg->width; x+=STP) {
for (x=0; x < pimg->width-STP; x+=STP) {
coo[0] = x;
foo = stat_zone(pimg, coo, vals);
if (foo) abort();
/* next step : plot the datas */
// XXX fprintf(stderr, "%s %6d %6d\n", __func__, x, y);
pixel_trinitron(pimg, coo, vals);
}
}
#undef STP
// fprintf(stderr, " end trinitron\n"); // XXX
return 0;
}
/* -------------------------------------------------------------- */