[Upstrea merge r63509] Elementary map : a bug fix for zoom-out in elm_map by Kim...
authorgouache <gouache@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 21 Sep 2011 06:20:28 +0000 (06:20 +0000)
committerDaniel Juyung Seo <juyung.seo@samsung.com>
Tue, 27 Sep 2011 08:00:26 +0000 (17:00 +0900)
I wrote a patch that handles a bug while zooming-out in elm_map.
When I try to zoom out, some tiles are broken.
But it is hard to notice because broken frame disappears quickly.

I investigated in a few days.
And I realize that there are something wrong.
When map is zoomed out, a tile is shrunk by evas_object_resize().
But evas_map handles its texture by just its origin image size not a shrunk size.
If evas_object's width & height is shrunk, I have to handle for its texture.

git-svn-id: https://svn.enlightenment.org/svn/e/trunk/elementary@63509 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/elm_map.c

index 97adff9..c6b0e96 100644 (file)
@@ -801,6 +801,17 @@ obj_rotate_zoom(void *data, Evas_Object *obj)
      }
 
    evas_map_util_points_populate_from_object_full(wd->map, obj, 0);
+   int ow, oh, iw, ih;
+   evas_object_image_size_get(obj, &iw, &ih);
+   evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
+   if (ow < iw || oh < ih)
+     {
+        ow *= (double)iw / ow;
+        oh *= (double)ih / oh;
+        evas_map_point_image_uv_set(wd->map, 1, ow, 0);
+        evas_map_point_image_uv_set(wd->map, 2, ow, oh);
+        evas_map_point_image_uv_set(wd->map, 3, 0, oh);
+     }
    evas_map_util_zoom(wd->map, wd->pinch.level, wd->pinch.level, wd->pinch.cx, wd->pinch.cy);
    evas_map_util_rotate(wd->map, wd->rotate.d, wd->rotate.cx, wd->rotate.cy);
    evas_object_map_enable_set(obj, EINA_TRUE);
@@ -2353,7 +2364,7 @@ _pan_calculate(Evas_Object *obj)
    rect_place(sd->wd->obj, sd->wd->pan_x, sd->wd->pan_y, ox, oy, ow, oh);
    EINA_LIST_FOREACH(sd->wd->grids, l, g)
      {
-        if ((sd->wd->pinch.level == 1.0) || (sd->wd->pinch.level == 0.5)) grid_load(sd->wd->obj, g);
+        if (sd->wd->zoom == g->zoom) grid_load(sd->wd->obj, g);
         grid_place(sd->wd->obj, g, sd->wd->pan_x, sd->wd->pan_y, ox, oy, ow, oh);
         marker_place(sd->wd->obj, g, sd->wd->pan_x, sd->wd->pan_y, ox, oy, ow, oh);
         if (!sd->wd->zoom_animator) route_place(sd->wd->obj, g, sd->wd->pan_x, sd->wd->pan_y, ox, oy, ow, oh);