summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorSungtaek Hong <sth253.hong@samsung.com>2017-08-11 13:50:56 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2017-08-11 13:50:56 +0900
commit5c0fc3f2f38d21ebaf4d02226579e4adf2e28aea (patch)
tree762f9a11f36041ad22fcb2847fb893c673c8004a /src/lib
parent39c791dcbc02c84fdc1ad67d8f10e1842872c111 (diff)
Cast to double before division during region/coord calculation.
Summary: int var devided by int is cast to double after devision. This might cause wrong calculation result. Reviewers: cedric, jpeg, Jaehyun_Cho Reviewed By: Jaehyun_Cho Differential Revision: https://phab.enlightenment.org/D5079
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/elementary/elm_map.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/elementary/elm_map.c b/src/lib/elementary/elm_map.c
index b765b41f94..03dd0e0183 100644
--- a/src/lib/elementary/elm_map.c
+++ b/src/lib/elementary/elm_map.c
@@ -461,7 +461,7 @@ _coord_to_region_convert(Elm_Map_Data *sd,
461 461
462 EINA_SAFETY_ON_NULL_RETURN(sd); 462 EINA_SAFETY_ON_NULL_RETURN(sd);
463 463
464 zoom = floor(log(size / sd->size.tile) / log(2)); 464 zoom = floor(log((double)size / sd->size.tile) / log(2));
465 if ((sd->src_tile) && (sd->src_tile->coord_to_geo)) 465 if ((sd->src_tile) && (sd->src_tile->coord_to_geo))
466 { 466 {
467 if (sd->src_tile->coord_to_geo 467 if (sd->src_tile->coord_to_geo
@@ -489,7 +489,7 @@ _region_to_coord_convert(Elm_Map_Data *sd,
489 489
490 EINA_SAFETY_ON_NULL_RETURN(sd); 490 EINA_SAFETY_ON_NULL_RETURN(sd);
491 491
492 zoom = floor(log(size / 256) / log(2)); 492 zoom = floor(log((double)size / 256) / log(2));
493 if ((sd->src_tile) && (sd->src_tile->geo_to_coord)) 493 if ((sd->src_tile) && (sd->src_tile->geo_to_coord))
494 { 494 {
495 if (sd->src_tile->geo_to_coord 495 if (sd->src_tile->geo_to_coord
@@ -1120,15 +1120,15 @@ _zoom_do(Elm_Map_Data *sd,
1120 double sx, sy; 1120 double sx, sy;
1121 1121
1122 if (vw > ow) sx = 0.5; 1122 if (vw > ow) sx = 0.5;
1123 else sx = (double)(vx + (double)(vw / 2)) / ow; 1123 else sx = (vx + ((double)vw / 2)) / ow;
1124 if (vh > oh) sy = 0.5; 1124 if (vh > oh) sy = 0.5;
1125 else sy = (double)(vy + (double)(vh / 2)) / oh; 1125 else sy = (vy + ((double)vh / 2)) / oh;
1126 1126
1127 if (sx > 1.0) sx = 1.0; 1127 if (sx > 1.0) sx = 1.0;
1128 if (sy > 1.0) sy = 1.0; 1128 if (sy > 1.0) sy = 1.0;
1129 1129
1130 x = ceil((sx * sd->size.w) - (vw / 2)); 1130 x = ceil((sx * sd->size.w) - ((double)vw / 2));
1131 y = ceil((sy * sd->size.h) - (vh / 2)); 1131 y = ceil((sy * sd->size.h) - ((double)vh / 2));
1132 if (x < 0) x = 0; 1132 if (x < 0) x = 0;
1133 else if (x > (sd->size.w - vw)) 1133 else if (x > (sd->size.w - vw))
1134 x = sd->size.w - vw; 1134 x = sd->size.w - vw;