1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-11-23 20:59:42 +02:00

tstimg.c (tstimg): adjust size and position of parameters according to yres

This commit is contained in:
Werner Almesberger 2011-05-01 23:19:57 -03:00
parent 4450a30456
commit 319d8a044b

View File

@ -463,6 +463,7 @@ void tstimg(void **f, int xres, int yres)
{ {
char buf[40]; char buf[40];
double line_freq_hz; double line_freq_hz;
int y, n;
grid(f, xres, yres); grid(f, xres, yres);
sides(f, xres, yres); sides(f, xres, yres);
@ -472,25 +473,36 @@ void tstimg(void **f, int xres, int yres)
ctext(f, xres, xres/2, yres/2-GRID*0.75, buf, 10, WHITE, 3); ctext(f, xres, xres/2, yres/2-GRID*0.75, buf, 10, WHITE, 3);
ctext(f, xres, xres/2, yres*(CBAR_Y0+CBAR_Y1)/2, buf, 2, 0, 0); ctext(f, xres, xres/2, yres*(CBAR_Y0+CBAR_Y1)/2, buf, 2, 0, 0);
y = yres/8;
n = 5;
if (yres < 768)
y = yres/16;
if (yres < 600)
n = 4;
sprintf(buf, "PIXEL %5.2f MHZ", 336.0/(mode->clkdiv+1)); sprintf(buf, "PIXEL %5.2f MHZ", 336.0/(mode->clkdiv+1));
text(f, xres, xres/8, yres/8, buf, 5, WHITE, 1); text(f, xres, xres/8, y, buf, n, WHITE, 1);
y += 6*n;
line_freq_hz = 112000000.0/(mode->line_cycles); line_freq_hz = 112000000.0/(mode->line_cycles);
sprintf(buf, "LINE %5.2f KHZ", line_freq_hz/1000); sprintf(buf, "LINE %5.2f KHZ", line_freq_hz/1000);
text(f, xres, xres/8, yres/8+5*6, buf, 5, WHITE, 1); text(f, xres, xres/8, y, buf, n, WHITE, 1);
y += 6*n;
sprintf(buf, "FRAME %5.2f HZ", sprintf(buf, "FRAME %5.2f HZ",
line_freq_hz/(mode->vsync_lines+ mode->vfront_lines+mode->yres+ line_freq_hz/(mode->vsync_lines+ mode->vfront_lines+mode->yres+
mode->vback_lines)); mode->vback_lines));
text(f, xres, xres/8, yres/8+5*12, buf, 5, WHITE, 1); text(f, xres, xres/8, y, buf, n, WHITE, 1);
y += 6*n;
sprintf(buf, "VERT %d+%d+%d+%d LINES", sprintf(buf, "VERT %d+%d+%d+%d LINES",
mode->vsync_lines, mode->vfront_lines, mode->yres, mode->vsync_lines, mode->vfront_lines, mode->yres,
mode->vback_lines); mode->vback_lines);
text(f, xres, xres/8, yres/8+5*18, buf, 5, WHITE, 1); text(f, xres, xres/8, y, buf, n, WHITE, 1);
y += 6*n;
sprintf(buf, "HOR %4.2f+...+%4.2f = %5.2f US", sprintf(buf, "HOR %4.2f+...+%4.2f = %5.2f US",
CYCLES(mode->hsync_cycles), CYCLES(mode->hback_cycles), CYCLES(mode->hsync_cycles), CYCLES(mode->hback_cycles),
CYCLES(mode->line_cycles)); CYCLES(mode->line_cycles));
text(f, xres, xres/8, yres/8+5*24, buf, 5, WHITE, 1); text(f, xres, xres/8, y, buf, n, WHITE, 1);
} }