From 319d8a044b9395b5248b21e637927c48b66e3191 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Sun, 1 May 2011 23:19:57 -0300 Subject: [PATCH] tstimg.c (tstimg): adjust size and position of parameters according to yres --- ubb-vga/tstimg.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/ubb-vga/tstimg.c b/ubb-vga/tstimg.c index 66a4318..539a478 100644 --- a/ubb-vga/tstimg.c +++ b/ubb-vga/tstimg.c @@ -463,6 +463,7 @@ void tstimg(void **f, int xres, int yres) { char buf[40]; double line_freq_hz; + int y, n; grid(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*(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)); - 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); 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", line_freq_hz/(mode->vsync_lines+ mode->vfront_lines+mode->yres+ 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", mode->vsync_lines, mode->vfront_lines, mode->yres, 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", CYCLES(mode->hsync_cycles), CYCLES(mode->hback_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); }