evas: resolve float compare warnings

Summary: Depends on D11792

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11793
This commit is contained in:
Mike Blumenkrantz 2020-05-12 09:20:42 +02:00 committed by Xavi Artigas
parent 6196311ad7
commit 235ba0e407
7 changed files with 34 additions and 30 deletions

View File

@ -815,7 +815,7 @@ _evas_event_source_mouse_move_events(Evas_Object *eo_obj, Evas *eo_e,
ev->action = EFL_POINTER_ACTION_IN;
evas_object_event_callback_call(eo_child, child, EVAS_CALLBACK_MOUSE_IN, evt,
event_id2, EFL_EVENT_POINTER_IN);
if ((cur_pt.x != prev_pt.x) || (cur_pt.y != prev_pt.y))
if (!EINA_DBL_EQ(cur_pt.x, prev_pt.x) || !EINA_DBL_EQ(cur_pt.y, prev_pt.y))
{
ev->action = EFL_POINTER_ACTION_MOVE;
evas_object_event_callback_call(eo_child, child, EVAS_CALLBACK_MOUSE_MOVE, evt,
@ -1368,7 +1368,7 @@ _evas_event_source_mouse_in_events(Evas_Object *eo_obj, Evas *eo_e,
ev->action = EFL_POINTER_ACTION_IN;
evas_object_event_callback_call(eo_child, child, EVAS_CALLBACK_MOUSE_IN, evt,
event_id, EFL_EVENT_POINTER_IN);
if ((cur_pt.x != prev_pt.x) || (cur_pt.y != prev_pt.y))
if (!EINA_DBL_EQ(cur_pt.x, prev_pt.x) || !EINA_DBL_EQ(cur_pt.y, prev_pt.y))
{
ev->action = EFL_POINTER_ACTION_MOVE;
evas_object_event_callback_call(eo_child, child, EVAS_CALLBACK_MOUSE_MOVE, evt,
@ -2350,7 +2350,7 @@ _canvas_event_feed_mouse_move_internal(Evas_Public_Data *e, Efl_Input_Pointer_Da
_evas_walk(e);
/* update moved touch point */
if ((prev_pt.x != cur_pt.x) || (prev_pt.y != cur_pt.y))
if (!EINA_DBL_EQ(cur_pt.x, prev_pt.x) || !EINA_DBL_EQ(cur_pt.y, prev_pt.y))
_evas_touch_point_update(eo_e, 0, pdata->seat->x, pdata->seat->y, EVAS_TOUCH_POINT_MOVE);
/* if our mouse button is grabbed to any objects */
if (pdata->seat->mouse_grabbed > 0)
@ -2387,7 +2387,7 @@ _canvas_event_feed_mouse_move_internal(Evas_Public_Data *e, Efl_Input_Pointer_Da
ev->cur = cur_pt;
ev->prev = prev_pt;
if ((prev_pt.x != cur_pt.x) || (prev_pt.y != cur_pt.y))
if (!EINA_DBL_EQ(cur_pt.x, prev_pt.x) || !EINA_DBL_EQ(cur_pt.y, prev_pt.y))
{
_evas_event_havemap_adjust_f(obj, &ev->cur, &ev->prev, obj_pdata->mouse_grabbed);
@ -2485,7 +2485,7 @@ _canvas_event_feed_mouse_move_internal(Evas_Public_Data *e, Efl_Input_Pointer_Da
_evas_event_object_pointer_allow_precise(eo_obj, obj, ev->cur.x, ev->cur.y, ins) &&
(obj_pdata->mouse_grabbed || !evas_object_is_source_invisible(eo_obj, obj)))
{
if ((prev_pt.x != cur_pt.x) || (prev_pt.y != cur_pt.y))
if (!EINA_DBL_EQ(cur_pt.x, prev_pt.x) || !EINA_DBL_EQ(cur_pt.y, prev_pt.y))
{
ev->action = EFL_POINTER_ACTION_MOVE;
evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_MOUSE_MOVE, evt,
@ -2540,7 +2540,7 @@ _canvas_event_feed_mouse_move_internal(Evas_Public_Data *e, Efl_Input_Pointer_Da
ev->action = EFL_POINTER_ACTION_IN;
evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_MOUSE_IN, evt,
event_id, EFL_EVENT_POINTER_IN);
if ((prev_pt.x != cur_pt.x) || (prev_pt.y != cur_pt.y))
if (!EINA_DBL_EQ(cur_pt.x, prev_pt.x) || !EINA_DBL_EQ(cur_pt.y, prev_pt.y))
{
ev->action = EFL_POINTER_ACTION_MOVE;
evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_MOUSE_MOVE, evt,
@ -2633,7 +2633,7 @@ nogrep:
_evas_event_object_pointer_allow_precise(eo_obj, obj, ev->cur.x, ev->cur.y, newin) &&
(obj_pdata->mouse_grabbed || !evas_object_is_source_invisible(eo_obj, obj)))
{
if ((prev_pt.x != cur_pt.x) || (prev_pt.y != cur_pt.y))
if (!EINA_DBL_EQ(cur_pt.x, prev_pt.x) || !EINA_DBL_EQ(cur_pt.y, prev_pt.y))
{
ev->action = EFL_POINTER_ACTION_MOVE;
evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_MOUSE_MOVE, evt,
@ -2687,7 +2687,7 @@ nogrep:
ev->action = EFL_POINTER_ACTION_IN;
evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_MOUSE_IN, evt,
event_id, EFL_EVENT_POINTER_IN);
if ((prev_pt.x != cur_pt.x) || (prev_pt.y != cur_pt.y))
if (!EINA_DBL_EQ(cur_pt.x, prev_pt.x) || !EINA_DBL_EQ(cur_pt.y, prev_pt.y))
{
ev->action = EFL_POINTER_ACTION_MOVE;
evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_MOUSE_MOVE, evt,
@ -2831,8 +2831,8 @@ _canvas_event_feed_mouse_in_internal(Evas *eo_e, Efl_Input_Pointer_Data *ev)
efl_ref(eo_obj);
evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_MOUSE_IN, evt,
event_id, EFL_EVENT_POINTER_IN);
if ((pdata->seat->x != ev->prev.x) &&
(pdata->seat->y != ev->prev.y))
if (!EINA_DBL_EQ(pdata->seat->x, ev->prev.x) &&
!EINA_DBL_EQ(pdata->seat->y, ev->prev.y))
{
ev->action = EFL_POINTER_ACTION_MOVE;
evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_MOUSE_MOVE, evt,

View File

@ -3608,11 +3608,11 @@ _format_string_get(const Eo *eo_obj, Evas_Object_Textblock_Format *fmt)
halign_value_str = "locale";
break;
case EVAS_TEXTBLOCK_ALIGN_AUTO_NONE:
if (fmt->halign == 0.5)
if (EINA_DBL_EQ(fmt->halign, 0.5))
halign_value_str = "center";
else if (fmt->halign == 0.0)
else if (EINA_DBL_EQ(fmt->halign, 0.0))
halign_value_str = "left";
else if (fmt->halign == 1.0)
else if (EINA_DBL_EQ(fmt->halign, 1.0))
halign_value_str = "right";
break;
@ -3626,13 +3626,13 @@ _format_string_get(const Eo *eo_obj, Evas_Object_Textblock_Format *fmt)
char *valign_value_str = NULL;
if (fmt->valign == 0.5)
if (EINA_DBL_EQ(fmt->valign, 0.5))
valign_value_str = "center";
else if (fmt->valign == 0.0)
else if (EINA_DBL_EQ(fmt->valign, 0.0))
valign_value_str = "top";
else if (fmt->valign == 1.0)
else if (EINA_DBL_EQ(fmt->valign, 1.0))
valign_value_str = "bottom";
else if (fmt->valign == -1.0)
else if (EINA_DBL_EQ(fmt->valign, -1.0))
valign_value_str = "baseline";
if (valign_value_str != NULL)
@ -4891,7 +4891,7 @@ loop_advance:
}
/* Check current line's height is acceptable or not */
if ((fmt->ellipsis == 1.0) &&
if (EINA_DBL_EQ(fmt->ellipsis, 1.0) &&
(c->h > 0) && (c->y + c->ln->h > c->h))
{
/* No text is shown when the object height is smaller than actual font size's height.
@ -16630,6 +16630,10 @@ _efl_canvas_textblock_efl_text_font_properties_font_bitmap_scalable_get(const Eo
if (_FMT(x) == v) return; \
_FMT(x) = v; \
_canvas_text_format_changed(obj, o);
#define _FMT_SETD(x, v) \
if (EINA_DBL_EQ(_FMT(x), v)) return; \
_FMT(x) = v; \
_canvas_text_format_changed(obj, o);
/* Helper: updates format field of extended format information, and informs if changed. */
#define _FMT_INFO_SET_START(x, v) \
@ -16731,7 +16735,7 @@ static void
_efl_canvas_textblock_efl_text_style_text_underline_height_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, double height EINA_UNUSED)
{
ASYNC_BLOCK;
_FMT_SET(underline_height, height);
_FMT_SETD(underline_height, height);
}
static double
@ -17000,7 +17004,7 @@ static void
_efl_canvas_textblock_efl_text_format_ellipsis_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, double value EINA_UNUSED)
{
ASYNC_BLOCK;
_FMT_SET(ellipsis, value);
_FMT_SETD(ellipsis, value);
}
static double
@ -17286,7 +17290,7 @@ _efl_canvas_textblock_efl_text_format_text_horizontal_align_set(Eo *obj, Efl_Can
ASYNC_BLOCK;
if (EINA_DBL_EQ(_FMT(halign), value)) return;
_FMT(halign_auto) = EVAS_TEXTBLOCK_ALIGN_AUTO_NONE;
_FMT_SET(halign, value);
_FMT_SETD(halign, value);
}
static double
@ -17322,7 +17326,7 @@ _efl_canvas_textblock_efl_text_format_line_gap_set(Eo *obj EINA_UNUSED, Efl_Canv
if (EINA_DBL_EQ(linerelgap, 0.0))
{
_FMT_SET(linegap, value);
_FMT_SETD(linegap, value);
}
else
{
@ -17347,7 +17351,7 @@ _efl_canvas_textblock_efl_text_format_line_rel_gap_set(Eo *obj EINA_UNUSED, Efl_
if (EINA_DBL_EQ(linegap, 0.0))
{
_FMT_SET(linerelgap, value);
_FMT_SETD(linerelgap, value);
}
else
{

View File

@ -587,7 +587,7 @@ _map_triangle_draw(RGBA_Image *src, RGBA_Image *dst,
denom = ((x[2] - x[0]) * (y[1] - y[0]) - (x[1] - x[0]) * (y[2] - y[0]));
//Skip poly if it's an infinitely thin line
if (denom == 0) return;
if (EINA_DBL_EQ(denom, 0)) return;
denom = 1 / denom; //Reciprocal for speeding up
dudx = ((u[2] - u[0]) * (y[1] - y[0]) - (u[1] - u[0]) * (y[2] - y[0])) * denom;
@ -619,8 +619,8 @@ _map_triangle_draw(RGBA_Image *src, RGBA_Image *dst,
//Determine which side of the polygon the longer edge is on
side = (dxdy[1] > dxdy[0]) ? EINA_TRUE:EINA_FALSE;
if (y[0] == y[1]) side = x[0] > x[1];
if (y[1] == y[2]) side = x[2] > x[1];
if (EINA_DBL_EQ(y[0], y[1])) side = x[0] > x[1];
if (EINA_DBL_EQ(y[1], y[2])) side = x[2] > x[1];
//Longer edge is on the left side
if (!side)

View File

@ -240,7 +240,7 @@ _efl_canvas_gesture_recognizer_flick_efl_canvas_gesture_recognizer_recognize(Eo
{
/* This is for continues-gesture */
/* Finish line on zero momentum for continues gesture */
if ((!fd->momentum.x) && (!fd->momentum.y))
if (EINA_DBL_EQ(fd->momentum.x, 0) && EINA_DBL_EQ(fd->momentum.y, 0))
pd->t_end = efl_gesture_touch_current_timestamp_get(event);
}
}

View File

@ -218,7 +218,7 @@ _efl_canvas_gesture_recognizer_zoom_efl_canvas_gesture_recognizer_recognize(Eo *
return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
}
if ((pd->zoom_base) && (pd->zoom_distance_tolerance == 0))
if ((pd->zoom_base) && EINA_DBL_EQ(pd->zoom_distance_tolerance, 0))
{
_reset_recognizer(pd);

View File

@ -226,7 +226,7 @@ _local_transform(Efl_VG *root, double w, double h, Vg_File_Data *vfd)
Eina_Matrix3 m;
if (!vfd->static_viewbox) return;
if (vfd->view_box.w == w && vfd->view_box.h == h) return;
if (EINA_DBL_EQ(vfd->view_box.w, w) && EINA_DBL_EQ(vfd->view_box.h, h)) return;
sx = w / vfd->view_box.w;
sy = h / vfd->view_box.h;

View File

@ -23,7 +23,7 @@ printf_style(Svg_Style_Property *style, Eina_Strbuf *buf)
eina_strbuf_append_printf(buf, " fill-opacity=\"%f\"", style->fill.opacity / 255.0);
if ((style->stroke.paint.r) || (style->stroke.paint.g) || (style->stroke.paint.b))
eina_strbuf_append_printf(buf, " stroke=\"#%02X%02X%02X\" ", style->stroke.paint.r, style->stroke.paint.g, style->stroke.paint.b);
if (style->stroke.width)
if (EINA_DBL_NONZERO(style->stroke.width))
eina_strbuf_append_printf(buf, " stroke-width=\"%f\" ", style->stroke.width);
if (style->stroke.cap == EFL_GFX_CAP_ROUND)
eina_strbuf_append_printf(buf, " stroke-linecap=\"round\" ");