From 2df9b3b171dc81bbbf0b679c03fefaa39ab26510 Mon Sep 17 00:00:00 2001 From: Ali Gholami Rudi Date: Mon, 28 Jan 2013 20:28:07 +0330 Subject: [PATCH] fbvis: limit scrolling height when fullscreen --- fbvis.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/fbvis.c b/fbvis.c index dfee633..e746426 100644 --- a/fbvis.c +++ b/fbvis.c @@ -31,27 +31,6 @@ static int count; static struct termios termios; static int fullscreen; -static void drawfs(void) -{ - char row[1 << 14]; - int fsrows = rows * fb_cols() / cols; - int rs = head; - int bpp = FBM_BPP(fb_mode()); - int i, j; - for (i = 0; i < fb_rows(); i++) { - int r = (rs + i) * rows / fsrows; - if (r >= rows) - memset(row, 0, fb_cols() * bpp); - for (j = 0; j < fb_cols() && r < rows; j++) { - int c = j * cols / fb_cols(); - unsigned char *src = (void *) (buf + (r * cols + c) * ch); - unsigned int *dst = (void *) (row + j * bpp); - *dst = FB_VAL(src[0], src[1], src[2]); - } - fb_set(i, 0, row, fb_cols()); - } -} - static void draw(void) { char row[1 << 14]; @@ -73,6 +52,27 @@ static void draw(void) } } +static void drawfs(void) +{ + char row[1 << 14]; + int fsrows = rows * fb_cols() / cols; + int rs = head * MAX(0, fsrows - fb_rows()) / MAX(1, rows - fb_rows()); + int bpp = FBM_BPP(fb_mode()); + int i, j; + for (i = 0; i < fb_rows(); i++) { + int r = (rs + i) * rows / fsrows; + if (r >= rows) + memset(row, 0, fb_cols() * bpp); + for (j = 0; j < fb_cols() && r < rows; j++) { + int c = j * cols / fb_cols(); + unsigned char *src = (void *) (buf + (r * cols + c) * ch); + unsigned int *dst = (void *) (row + j * bpp); + *dst = FB_VAL(src[0], src[1], src[2]); + } + fb_set(i, 0, row, fb_cols()); + } +} + static int readkey(void) { unsigned char b; -- 2.11.4.GIT