From 23c8b7ec69c2add760a186ec2c1602b3e4662197 Mon Sep 17 00:00:00 2001 From: Stéphane Aulery Date: Thu, 30 Oct 2014 17:11:03 +0100 Subject: Fix scrolling when the -T and -a options are activated together to read a pdf and we zoom in on a page. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Scrolling was blocked after zooming in on a page when using the -T and -a options together (Debian bug #512387). Signed-off-by: Stéphane Aulery Signed-off-by: Gerd Hoffmann --- fbi.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/fbi.c b/fbi.c index 13940d6..d7c5cb0 100644 --- a/fbi.c +++ b/fbi.c @@ -768,6 +768,13 @@ static float auto_scale(struct ida_image *img) return scale; } +static int calculate_text_steps(int height, int yres) +{ + int pages = ceil((float)height / yres); + int text_steps = ceil((float)height / pages); + return text_steps; +} + /* ---------------------------------------------------------------------- */ static void effect_blend(struct flist *f, struct flist *t) @@ -1069,6 +1076,10 @@ static void scale_fix_top_left(struct flist *f, float old, float new) height = img->i.height * new; f->left = cx * width - fb_var.xres/2; f->top = cy * height - fb_var.yres/2; + + if (textreading) { + f->text_steps = calculate_text_steps(height, fb_var.yres); + } } /* ---------------------------------------------------------------------- */ @@ -1378,8 +1389,7 @@ static void flist_img_load(struct flist *f, int prefetch) if (img->i.height > fb_var.yres) { f->top = (img->i.height - fb_var.yres) / 2; if (textreading) { - int pages = ceil((float)img->i.height / fb_var.yres); - f->text_steps = ceil((float)img->i.height / pages); + f->text_steps = calculate_text_steps(img->i.height, fb_var.yres); f->top = 0; } } -- cgit