diff --git a/libfprint/drivers/aes1610.c b/libfprint/drivers/aes1610.c index 5a29080..7e4d945 100644 --- a/libfprint/drivers/aes1610.c +++ b/libfprint/drivers/aes1610.c @@ -612,7 +612,7 @@ static void capture_read_strip_cb(struct libusb_transfer *transfer) aes_write_regv(dev, capture_stop, G_N_ELEMENTS(capture_stop), stub_capture_stop_cb, NULL); aesdev->strips = g_slist_reverse(aesdev->strips); fpi_do_movement_estimation(&assembling_ctx, aesdev->strips); - img = fpi_assemble_frames(&assembling_ctx, aesdev->strips, aesdev->strips_len); + img = fpi_assemble_frames(&assembling_ctx, aesdev->strips); img->flags |= FP_IMG_PARTIAL; g_slist_free_full(aesdev->strips, g_free); aesdev->strips = NULL; diff --git a/libfprint/drivers/aes2501.c b/libfprint/drivers/aes2501.c index ef705e7..9df2bcd 100644 --- a/libfprint/drivers/aes2501.c +++ b/libfprint/drivers/aes2501.c @@ -483,8 +483,7 @@ static void capture_read_strip_cb(struct libusb_transfer *transfer, aesdev->strips = g_slist_reverse(aesdev->strips); fpi_do_movement_estimation(&assembling_ctx, aesdev->strips); - img = fpi_assemble_frames(&assembling_ctx, - aesdev->strips, aesdev->strips_len); + img = fpi_assemble_frames(&assembling_ctx, aesdev->strips); img->flags |= FP_IMG_PARTIAL; g_slist_free_full(aesdev->strips, g_free); aesdev->strips = NULL; diff --git a/libfprint/drivers/aes2550.c b/libfprint/drivers/aes2550.c index 72a8613..b17f295 100644 --- a/libfprint/drivers/aes2550.c +++ b/libfprint/drivers/aes2550.c @@ -244,8 +244,7 @@ static void capture_set_idle_reqs_cb(struct libusb_transfer *transfer) struct fp_img *img; aesdev->strips = g_slist_reverse(aesdev->strips); - img = fpi_assemble_frames(&assembling_ctx, - aesdev->strips, aesdev->strips_len); + img = fpi_assemble_frames(&assembling_ctx, aesdev->strips); img->flags |= FP_IMG_PARTIAL; g_slist_free_full(aesdev->strips, g_free); aesdev->strips = NULL; diff --git a/libfprint/drivers/aesx660.c b/libfprint/drivers/aesx660.c index 47da51f..2990d3d 100644 --- a/libfprint/drivers/aesx660.c +++ b/libfprint/drivers/aesx660.c @@ -305,7 +305,7 @@ static void capture_set_idle_cmd_cb(struct libusb_transfer *transfer) struct fp_img *img; aesdev->strips = g_slist_reverse(aesdev->strips); - img = fpi_assemble_frames(aesdev->assembling_ctx, aesdev->strips, aesdev->strips_len); + img = fpi_assemble_frames(aesdev->assembling_ctx, aesdev->strips); img->flags |= aesdev->extra_img_flags; g_slist_foreach(aesdev->strips, (GFunc) g_free, NULL); g_slist_free(aesdev->strips); diff --git a/libfprint/drivers/elan.c b/libfprint/drivers/elan.c index 8bc7e50..65209fb 100644 --- a/libfprint/drivers/elan.c +++ b/libfprint/drivers/elan.c @@ -308,7 +308,7 @@ static void elan_submit_image(struct fp_img_dev *dev) assembling_ctx.image_width = elandev->frame_width * 3 / 2; g_slist_foreach(raw_frames, (GFunc) elandev->process_frame, &frames); fpi_do_movement_estimation(&assembling_ctx, frames); - img = fpi_assemble_frames(&assembling_ctx, frames, num_frames); + img = fpi_assemble_frames(&assembling_ctx, frames); img->flags |= FP_IMG_PARTIAL; fpi_imgdev_image_captured(dev, img); diff --git a/libfprint/fpi-assembling.c b/libfprint/fpi-assembling.c index cb911a8..1bc3bef 100644 --- a/libfprint/fpi-assembling.c +++ b/libfprint/fpi-assembling.c @@ -248,45 +248,34 @@ static inline void aes_blit_stripe(struct fpi_frame_asmbl_ctx *ctx, * fpi_assemble_frames: * @ctx: #fpi_frame_asmbl_ctx - frame assembling context * @stripes: linked list of #fpi_frame - * @num_stripes: number of items in @stripes to process * * fpi_assemble_frames() assembles individual frames into a single image. * It expects @delta_x and @delta_y of #fpi_frame to be populated. * - * Note that @num_stripes might be shorter than the length of the list, - * if some stripes should be skipped. - * * Returns: a newly allocated #fp_img. */ struct fp_img *fpi_assemble_frames(struct fpi_frame_asmbl_ctx *ctx, - GSList *stripes, size_t num_stripes) + GSList *stripes) { - GSList *stripe; + GSList *l; struct fp_img *img; int height = 0; - int i, y, x; + int y, x; gboolean reverse = FALSE; struct fpi_frame *fpi_frame; //FIXME g_return_if_fail - BUG_ON(num_stripes == 0); BUG_ON(ctx->image_width < ctx->frame_width); - /* Calculate height */ - i = 0; - stripe = stripes; - /* No offset for 1st image */ - fpi_frame = stripe->data; + fpi_frame = stripes->data; fpi_frame->delta_x = 0; fpi_frame->delta_y = 0; - do { - fpi_frame = stripe->data; + for (l = stripes; l != NULL; l = l->next) { + fpi_frame = l->data; height += fpi_frame->delta_y; - i++; - stripe = g_slist_next(stripe); - } while (i < num_stripes); + } fp_dbg("height is %d", height); @@ -306,13 +295,11 @@ struct fp_img *fpi_assemble_frames(struct fpi_frame_asmbl_ctx *ctx, img->height = height; /* Assemble stripes */ - i = 0; - stripe = stripes; y = reverse ? (height - ctx->frame_height) : 0; x = (ctx->image_width - ctx->frame_width) / 2; - do { - fpi_frame = stripe->data; + for (l = stripes; l != NULL; l = l->next) { + fpi_frame = l->data; if(reverse) { y += fpi_frame->delta_y; @@ -325,10 +312,7 @@ struct fp_img *fpi_assemble_frames(struct fpi_frame_asmbl_ctx *ctx, y += fpi_frame->delta_y; x += fpi_frame->delta_x; } - - stripe = g_slist_next(stripe); - i++; - } while (i < num_stripes); + } return img; } diff --git a/libfprint/fpi-assembling.h b/libfprint/fpi-assembling.h index 1425e7a..5f86815 100644 --- a/libfprint/fpi-assembling.h +++ b/libfprint/fpi-assembling.h @@ -66,7 +66,7 @@ void fpi_do_movement_estimation(struct fpi_frame_asmbl_ctx *ctx, GSList *stripes); struct fp_img *fpi_assemble_frames(struct fpi_frame_asmbl_ctx *ctx, - GSList *stripes, size_t num_stripes); + GSList *stripes); /** * fpi_line_asmbl_ctx: