tidy calc_shifting()

merge-requests/1/head
Rolf Bensch 2013-12-16 19:27:02 +01:00
rodzic 0893dc530f
commit de393271bc
1 zmienionych plików z 11 dodań i 27 usunięć

Wyświetl plik

@ -630,46 +630,30 @@ calc_shifting (pixma_t * s)
/* If stripes shift needed (CCD devices), how many pixels shift */ /* If stripes shift needed (CCD devices), how many pixels shift */
mp->stripe_shift = 0; mp->stripe_shift = 0;
switch (s->cfg->pid)
{
case MP800_PID:
case MP800R_PID:
if (s->param->xdpi == 2400)
{
if (is_scanning_from_tpu(s))
mp->stripe_shift = 6;
else
mp->stripe_shift = 3;
}
break;
case MP830_PID:
if (s->param->xdpi == 2400)
{
if (is_scanning_from_tpu(s))
mp->stripe_shift = 6;
else
mp->stripe_shift = 3;
}
break;
default: /* Default, and all CIS devices */
break;
}
/* If color plane shift (CCD devices), how many pixels shift */ /* If color plane shift (CCD devices), how many pixels shift */
mp->color_shift = mp->shift[0] = mp->shift[1] = mp->shift[2] = 0; mp->color_shift = mp->shift[0] = mp->shift[1] = mp->shift[2] = 0;
if (s->param->ydpi > 75)
{
switch (s->cfg->pid) switch (s->cfg->pid)
{ {
case MP800_PID: case MP800_PID:
case MP800R_PID: case MP800R_PID:
case MP830_PID: case MP830_PID:
if (s->param->xdpi == 2400)
{
if (is_scanning_from_tpu(s))
mp->stripe_shift = 6;
else
mp->stripe_shift = 3;
}
if (s->param->ydpi > 75)
{
mp->color_shift = s->param->ydpi / ((s->param->ydpi < 1200) ? 150 : 75); mp->color_shift = s->param->ydpi / ((s->param->ydpi < 1200) ? 150 : 75);
if (is_scanning_from_tpu (s)) if (is_scanning_from_tpu (s))
mp->color_shift = s->param->ydpi / 75; mp->color_shift = s->param->ydpi / 75;
/* If you're trying to decipher this color-shifting code,
the following line is where the magic is revealed. */
mp->shift[1] = mp->color_shift * get_cis_ccd_line_size (s); mp->shift[1] = mp->color_shift * get_cis_ccd_line_size (s);
if (is_scanning_from_adf (s)) if (is_scanning_from_adf (s))
{ /* ADF */ { /* ADF */
@ -681,12 +665,12 @@ calc_shifting (pixma_t * s)
mp->shift[0] = 2 * mp->shift[1]; mp->shift[0] = 2 * mp->shift[1];
mp->shift[2] = 0; mp->shift[2] = 0;
} }
}
break; break;
default: default: /* Default, and all CIS devices */
break; break;
} }
}
return (2 * mp->color_shift + mp->stripe_shift); return (2 * mp->color_shift + mp->stripe_shift);
} }