diff --git a/libfprint/drivers/aes1610.c b/libfprint/drivers/aes1610.c index e597772..374252e 100644 --- a/libfprint/drivers/aes1610.c +++ b/libfprint/drivers/aes1610.c @@ -591,8 +591,7 @@ static void capture_read_strip_cb(FpiUsbTransfer *transfer, FpDevice *device, aes_write_regv(dev, capture_stop, G_N_ELEMENTS(capture_stop), stub_capture_stop_cb, NULL); self->strips = g_slist_reverse(self->strips); fpi_do_movement_estimation(&assembling_ctx, self->strips); - img = fpi_assemble_frames(&assembling_ctx, self->strips, - self->strips_len); + img = fpi_assemble_frames(&assembling_ctx, self->strips); g_slist_free_full(self->strips, g_free); self->strips = NULL; diff --git a/libfprint/drivers/aes2501.c b/libfprint/drivers/aes2501.c index bb94d65..c321b8c 100644 --- a/libfprint/drivers/aes2501.c +++ b/libfprint/drivers/aes2501.c @@ -437,8 +437,7 @@ static void capture_read_strip_cb(FpiUsbTransfer *transfer, FpDevice *_dev, self->strips = g_slist_reverse(self->strips); fpi_do_movement_estimation(&assembling_ctx, self->strips); img = fpi_assemble_frames(&assembling_ctx, - self->strips, - self->strips_len); + self->strips); g_slist_free_full(self->strips, g_free); self->strips = NULL; self->strips_len = 0; diff --git a/libfprint/drivers/aes2550.c b/libfprint/drivers/aes2550.c index 6279754..b8fce05 100644 --- a/libfprint/drivers/aes2550.c +++ b/libfprint/drivers/aes2550.c @@ -227,8 +227,7 @@ static void capture_set_idle_reqs_cb(FpiUsbTransfer *transfer, FpImage *img; self->strips = g_slist_reverse(self->strips); - img = fpi_assemble_frames(&assembling_ctx, - self->strips, self->strips_len); + img = fpi_assemble_frames(&assembling_ctx, self->strips); g_slist_free_full(self->strips, g_free); self->strips = NULL; self->strips_len = 0; diff --git a/libfprint/drivers/aesx660.c b/libfprint/drivers/aesx660.c index 5ea4cae..b0cc402 100644 --- a/libfprint/drivers/aesx660.c +++ b/libfprint/drivers/aesx660.c @@ -312,7 +312,7 @@ static void capture_set_idle_cmd_cb(FpiUsbTransfer *transfer, FpDevice *device, FpImage *img; priv->strips = g_slist_reverse(priv->strips); - img = fpi_assemble_frames(cls->assembling_ctx, priv->strips, priv->strips_len); + img = fpi_assemble_frames(cls->assembling_ctx, priv->strips); g_slist_foreach(priv->strips, (GFunc) g_free, NULL); g_slist_free(priv->strips); priv->strips = NULL; diff --git a/libfprint/drivers/elan.c b/libfprint/drivers/elan.c index 3608897..9771bb5 100644 --- a/libfprint/drivers/elan.c +++ b/libfprint/drivers/elan.c @@ -288,14 +288,12 @@ static void elan_process_frame_thirds(unsigned short *raw_frame, static void elan_submit_image(FpImageDevice *dev) { FpiDeviceElan *self = FPI_DEVICE_ELAN(dev); - int num_frames; GSList *raw_frames; GSList *frames = NULL; FpImage *img; G_DEBUG_HERE(); - num_frames = self->num_frames - ELAN_SKIP_LAST_FRAMES; raw_frames = g_slist_nth(self->frames, ELAN_SKIP_LAST_FRAMES); assembling_ctx.frame_width = self->frame_width; @@ -303,7 +301,7 @@ static void elan_submit_image(FpImageDevice *dev) assembling_ctx.image_width = self->frame_width * 3 / 2; g_slist_foreach(raw_frames, (GFunc) self->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); fpi_image_device_image_captured(dev, img); } diff --git a/libfprint/fpi-assembling.c b/libfprint/fpi-assembling.c index 116d01d..6df8fff 100644 --- a/libfprint/fpi-assembling.c +++ b/libfprint/fpi-assembling.c @@ -269,48 +269,37 @@ 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. */ FpImage * fpi_assemble_frames (struct fpi_frame_asmbl_ctx *ctx, - GSList *stripes, size_t num_stripes) + GSList *stripes) { - GSList *stripe; + GSList *l; FpImage *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); + g_return_val_if_fail (stripes != NULL, NULL); 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 + for (l = stripes; l != NULL; l = l->next) { - fpi_frame = stripe->data; + 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); @@ -331,14 +320,12 @@ 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 + for (l = stripes; l != NULL; l = l->next) { - fpi_frame = stripe->data; + fpi_frame = l->data; if(reverse) { @@ -353,11 +340,7 @@ 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 33adcfd..77e3c55 100644 --- a/libfprint/fpi-assembling.h +++ b/libfprint/fpi-assembling.h @@ -68,8 +68,7 @@ void fpi_do_movement_estimation (struct fpi_frame_asmbl_ctx *ctx, GSList *stripes); FpImage *fpi_assemble_frames (struct fpi_frame_asmbl_ctx *ctx, - GSList *stripes, - size_t num_stripes); + GSList *stripes); /** * fpi_line_asmbl_ctx: