Make the +2 right shift happen on image handoff.

Rather than when reading the rows. Doing it there seems a lot
more sensible and does not get in the way of minimizing the
impact of lost USB packets.

http://lists.reactivated.net/pipermail/fprint/2009-December/001404.html
This commit is contained in:
Alexia Death 2009-12-25 00:04:55 +02:00 committed by Bastien Nocera
parent 8cd31f6ad8
commit c575afba9a

View file

@ -168,8 +168,12 @@ static void handoff_img(struct fp_img_dev *dev)
fp_dbg("%d rows", sdev->num_rows); fp_dbg("%d rows", sdev->num_rows);
img->height = sdev->num_rows; img->height = sdev->num_rows;
/* The scans from this device are rolled right by two colums
* It feels a lot smarter to correct here than mess with it at
* read time*/
do { do {
memcpy(img->data + offset, elem->data, IMG_WIDTH); memcpy(img->data + offset, elem->data + 2, IMG_WIDTH - 2);
memcpy(img->data + offset + IMG_WIDTH - 2, elem->data, 2);
g_free(elem->data); g_free(elem->data);
offset += IMG_WIDTH; offset += IMG_WIDTH;
} while ((elem = g_slist_next(elem)) != NULL); } while ((elem = g_slist_next(elem)) != NULL);
@ -255,8 +259,7 @@ static void start_new_row(struct sonly_dev *sdev, unsigned char *data, int size)
{ {
if (!sdev->rowbuf) if (!sdev->rowbuf)
sdev->rowbuf = g_malloc(IMG_WIDTH); sdev->rowbuf = g_malloc(IMG_WIDTH);
memcpy(sdev->rowbuf + IMG_WIDTH - 2, data, 2); memcpy(sdev->rowbuf, data, size);
memcpy(sdev->rowbuf, data + 2, size - 2);
sdev->rowbuf_offset = size; sdev->rowbuf_offset = size;
} }