evas font: do floating point division for calculating more accurately

Summary:
Assigning a result of integral division to a double type variable is
not useful for next division calculation. For more accurate calculation,
it needs to be casted to double before doing division.
It does not fix some bugs. It was reported by a code quality advisor.

Test Plan: N/A

Reviewers: raster, cedric, jpeg, herdsman, eunue

Reviewed By: cedric

Differential Revision: https://phab.enlightenment.org/D5069

Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
This commit is contained in:
Youngbok Shin 2017-08-30 11:40:26 -07:00 committed by Cedric Bail
parent 67d1c0e51c
commit 2b9a2692e8
1 changed files with 2 additions and 2 deletions

View File

@ -755,13 +755,13 @@ evas_common_font_query_char_at_coords(RGBA_Font *fn, const Evas_Text_Props *text
if (text_props->bidi_dir == EVAS_BIDI_DIRECTION_LTR)
{
double part;
part = cluster_adv / items;
part = (double) cluster_adv / items;
item_pos = (int) ((x - cluster_start) / part);
}
else
{
double part;
part = cluster_adv / items;
part = (double) cluster_adv / items;
item_pos = items - ((int) ((x - cluster_start) / part)) - 1;
}