edje/map - if user change image size of the image object which is swallwoed and it...
authorhermet <hermet>
Wed, 5 Sep 2012 09:46:09 +0000 (09:46 +0000)
committerhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 5 Sep 2012 09:46:09 +0000 (09:46 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@76184 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

ChangeLog
src/lib/edje_calc.c
src/lib/edje_util.c

index 0840e44..b4139e7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 
        * Added nested parts support.
        This lets us do nested parts, e.g parts "{ part { part { } } }"
+
+2012-09-05  ChunEon Park (Hermet)
+
+       * if user change image size of the image object which is swallowed and
+       it's map enabled by the edje, then edje needs to update it's uv mapping
+       info.
+
index 7c898d7..a38724f 100644 (file)
@@ -3033,8 +3033,11 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
                   evas_map_point_image_uv_set(map, 3, 0.0, ih );
                }
              evas_map_util_3d_rotate(map,
-                                     TO_DOUBLE(pf->map.rotation.x), TO_DOUBLE(pf->map.rotation.y), TO_DOUBLE(pf->map.rotation.z),
-                                     pf->map.center.x, pf->map.center.y, pf->map.center.z);
+                                     TO_DOUBLE(pf->map.rotation.x),
+                                                                                                TO_DOUBLE(pf->map.rotation.y),
+                                                                                                TO_DOUBLE(pf->map.rotation.z),
+                                     pf->map.center.x, pf->map.center.y,
+                                                                                                pf->map.center.z);
 
              // calculate light color & position etc. if there is one
              if (pf->lighted)
index daf1ec1..1f3a907 100644 (file)
@@ -5022,6 +5022,26 @@ _edje_object_part_swallow_changed_hints_cb(void *data, __UNUSED__ Evas *e, __UNU
 }
 
 void
+_edje_object_part_swallow_image_resize_cb(void *data, __UNUSED__ Evas *e, Evas_Object *obj, __UNUSED__ void *event_info)
+{
+   Edje_Real_Part *rp = data;
+   Evas_Coord w, h;
+
+   if (!rp->chosen_description->map.on) return;
+
+   Evas_Map *map = (Evas_Map *) evas_object_map_get(rp->swallowed_object);
+   if (!map) return;
+
+   evas_object_image_size_get(rp->swallowed_object, &w, &h);
+   evas_map_point_image_uv_set(map, 0, 0, 0);
+   evas_map_point_image_uv_set(map, 1, w, 0);
+   evas_map_point_image_uv_set(map, 2, w, h);
+   evas_map_point_image_uv_set(map, 3, 0, h);
+
+   evas_object_map_set(rp->swallowed_object, map);
+}
+
+void
 _edje_real_part_swallow(Edje_Real_Part *rp,
                        Evas_Object *obj_swallow,
                        Eina_Bool hints_update)
@@ -5062,6 +5082,12 @@ _edje_real_part_swallow(Edje_Real_Part *rp,
                                  _edje_object_part_swallow_changed_hints_cb,
                                  rp);
 
+   //If the map is enabled, uv should be updated when image size is changed.
+   if (!strcmp(evas_object_type_get(rp->swallowed_object), "image"))
+     evas_object_event_callback_add(obj_swallow, EVAS_CALLBACK_IMAGE_RESIZE,
+                                    _edje_object_part_swallow_image_resize_cb,
+                                    rp);
+
    if (hints_update)
      _edje_real_part_swallow_hints_update(rp);
 
@@ -5099,6 +5125,11 @@ _edje_real_part_swallow_clear(Edje_Real_Part *rp)
                                        EVAS_CALLBACK_CHANGED_SIZE_HINTS,
                                        _edje_object_part_swallow_changed_hints_cb,
                                        rp);
+   if (!strcmp(evas_object_type_get(rp->swallowed_object), "image"))
+     evas_object_event_callback_del_full(rp->swallowed_object,
+                                         EVAS_CALLBACK_IMAGE_RESIZE,
+                                         _edje_object_part_swallow_image_resize_cb,
+                                         rp);
    evas_object_clip_unset(rp->swallowed_object);
    evas_object_data_del(rp->swallowed_object, "\377 edje.swallowing_part");
    if (rp->part->mouse_events)