e_comp_wl_map_inv_coord_get(E_Client *ec, int x, int y, int *mx, int *my)
{
const Evas_Map *map;
- int map_c;
- int min_x = 0, min_y = 0, max_x = 0, max_y = 0;
- int map_x = 0, map_y = 0;
- double diff_w, diff_h;
+ Evas_Map *map2;
+ int map_c = 0, map_x = 0, map_y = 0;
+ double inv_x = 0.0, inv_y = 0.0;
EINA_SAFETY_ON_NULL_RETURN(ec);
return;
}
+ map2 = evas_map_new(map_c);
+
+ evas_map_point_coord_set(map2, 0, ec->x, ec->y, 0);
+ evas_map_point_coord_set(map2, 1, ec->x + ec->w, ec->y, 0);
+ evas_map_point_coord_set(map2, 2, ec->x + ec->w, ec->y + ec->h, 0);
+ evas_map_point_coord_set(map2, 3, ec->x, ec->y + ec->h, 0);
+
for (int i = 0; i < map_c; i++)
{
evas_map_point_coord_get(map, i, &map_x, &map_y, NULL);
- if (i == 0)
- {
- min_x = max_x = map_x;
- min_y = max_y = map_y;
- }
- else
- {
- if (min_x > map_x) min_x = map_x;
- else if (max_x < map_x) max_x = map_x;
-
- if (min_y > map_y) min_y = map_y;
- else if (max_y < map_y) max_y = map_y;
- }
+ evas_map_point_image_uv_set(map2, i, map_x, map_y);
}
+ evas_map_coords_get(map2, (double)x, (double)y, &inv_x, &inv_y, 0);
- diff_w = (double)(max_x - min_x) / (double)ec->w;
- diff_h = (double)(max_y - min_y) / (double)ec->h;
+ *mx = (int)inv_x;
+ *my = (int)inv_y;
- *mx = (int)(x * diff_w);
- *my = (int)(y * diff_h);
+ evas_map_free(map2);
}
static void