From 9c6afe1b95f47de2a9b2dd85b8f4171cc2ea0c93 Mon Sep 17 00:00:00 2001 From: Rolf Bensch Date: Wed, 4 Apr 2012 14:35:20 +0200 Subject: [PATCH] cropping y and h to scanable area in TPU mode for CS8800F and CS9000F --- ChangeLog | 4 ++++ backend/pixma_mp810.c | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f50b1b875..1509e8df6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2012-04-04 Rolf Bensch + * backend/pixma_mp810.c: cropping y and h to scanable area in TPU mode, + for CS8800F and CS9000F. + 2012-03-29 Stéphane Voltz * backend/genesys_gl124.c backend/genesys_devices.c: use feed earlier at high resolution. Tune LiDE 110/210 geometry. diff --git a/backend/pixma_mp810.c b/backend/pixma_mp810.c index 7e8a69440..7fd0e755d 100644 --- a/backend/pixma_mp810.c +++ b/backend/pixma_mp810.c @@ -1571,21 +1571,35 @@ mp810_check_param (pixma_t * s, pixma_scan_param_t * sp) if (sp->source == PIXMA_SOURCE_TPU && !sp->tpu_offset_added) { unsigned fixed_offset_y; /* TPU offsets for CanoScan 8800F, or other CCD at 300dpi. */ + unsigned max_y; /* max TPU height for CS9000F at 75 dpi */ /* CanoScan 8800F and others adding an offset depending on resolution */ + /* CS9000F and others maximum TPU height */ switch (s->cfg->pid) { case CS8800F_PID: fixed_offset_y = 140; + max_y = MIN (740, s->cfg->height); break; case CS9000F_PID: fixed_offset_y = 146; + max_y = MIN (740, s->cfg->height); break; default: fixed_offset_y = 0; + max_y = s->cfg->height; break; } - + + /* cropping y and h to scanable area */ + max_y *= (sp->ydpi) / 75; + sp->y = MIN(sp->y, max_y); + sp->h = MIN(sp->h, max_y - sp->y); + /* PDBG (pixma_dbg (4, "*mp810_check_param***** Cropping: y=%u, h=%u *****\n", + sp->y, sp->h)); */ + if (!sp->h) + return SANE_STATUS_INVAL; /* no lines */ + /* Convert the offsets from 300dpi to actual resolution */ fixed_offset_y = fixed_offset_y*(sp->xdpi)/300;