mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
androidcamera: Handle zoom comparison better, and avoid float precision issue
This commit is contained in:
parent
5975d396e0
commit
dd78e052ae
1 changed files with 2 additions and 2 deletions
|
@ -1280,12 +1280,12 @@ gst_ahc_src_set_zoom (GstPhotography * photo, gfloat zoom)
|
||||||
|
|
||||||
if (zoom_ratios && g_list_length (zoom_ratios) == (max_zoom + 1)) {
|
if (zoom_ratios && g_list_length (zoom_ratios) == (max_zoom + 1)) {
|
||||||
gint i;
|
gint i;
|
||||||
|
gint value = zoom * 100;
|
||||||
|
|
||||||
for (i = 0; i < max_zoom + 1; i++) {
|
for (i = 0; i < max_zoom + 1; i++) {
|
||||||
gint zoom_value = GPOINTER_TO_INT (g_list_nth_data (zoom_ratios, 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;
|
zoom_idx = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue