aboutsummaryrefslogtreecommitdiffstats
path: root/fbi.c
diff options
context:
space:
mode:
authorStéphane Aulery <saulery@free.fr>2014-10-30 17:11:03 +0100
committerGerd Hoffmann <kraxel@redhat.com>2014-11-03 12:08:43 +0100
commit23c8b7ec69c2add760a186ec2c1602b3e4662197 (patch)
tree3619fd6e63df3bcd5129ee78d61637c8abe753ed /fbi.c
parent2d58656d29d55f11854255b10ce8e86f49d46cec (diff)
downloadfbida-23c8b7ec69c2add760a186ec2c1602b3e4662197.tar.gz
Fix scrolling when the -T and -a options are activated together to read a pdf and we zoom in on a page.
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 <saulery@free.fr> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'fbi.c')
-rw-r--r--fbi.c14
1 files 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;
}
}