From dd78e052aebe031549b429931f0fc4f783ab02d4 Mon Sep 17 00:00:00 2001 From: Youness Alaoui Date: Fri, 9 Nov 2012 12:23:37 -0500 Subject: [PATCH] androidcamera: Handle zoom comparison better, and avoid float precision issue --- sys/androidcamera/gstahcsrc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/androidcamera/gstahcsrc.c b/sys/androidcamera/gstahcsrc.c index 9cf3ad2ce2..e39d4d4864 100644 --- a/sys/androidcamera/gstahcsrc.c +++ b/sys/androidcamera/gstahcsrc.c @@ -1280,12 +1280,12 @@ gst_ahc_src_set_zoom (GstPhotography * photo, gfloat zoom) if (zoom_ratios && g_list_length (zoom_ratios) == (max_zoom + 1)) { gint i; + gint value = zoom * 100; for (i = 0; i < max_zoom + 1; i++) { gint zoom_value = GPOINTER_TO_INT (g_list_nth_data (zoom_ratios, i)); - gfloat value = (gfloat) zoom_value / 100.0; - if (value == zoom) + if (value == zoom_value) zoom_idx = i; } }