diff options
author | Hermet Park <hermet@hermet.pe.kr> | 2016-11-04 20:19:14 +0900 |
---|---|---|
committer | Hermet Park <hermet@hermet.pe.kr> | 2016-11-04 20:21:59 +0900 |
commit | c446df487f15b54d0cd667ac89ddd9c8a9e86309 (patch) | |
tree | b5665c3d94101b29061af5018a8085c46a7456b9 /src/lib/elementary/elm_transit.c | |
parent | 132bac98c8a77adde5a8271c48ed0d3c7dfb6563 (diff) | |
download | efl-c446df487f15b54d0cd667ac89ddd9c8a9e86309.tar.gz |
elementary transit: support image fill area in zoom effect.
Transit zoom effect didn't care image fill area in case of manual filling.
This additional logic computes map uvs with regards to the current image fill area.
@fix
Diffstat (limited to 'src/lib/elementary/elm_transit.c')
-rw-r--r-- | src/lib/elementary/elm_transit.c | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/src/lib/elementary/elm_transit.c b/src/lib/elementary/elm_transit.c index 13f6d78f67..8ae0d87255 100644 --- a/src/lib/elementary/elm_transit.c +++ b/src/lib/elementary/elm_transit.c @@ -479,6 +479,9 @@ _recover_image_uv(Evas_Object *obj, Evas_Map *map, Eina_Bool revert, Eina_Bool b //Since the map is not proper for all types of objects, //Need to handle uvs only for image objects int iw, ih; + int x, y, w, h; + int fill_x, fill_y, fill_w, fill_h; + const char *type = evas_object_type_get(obj); if ((!type) || (strcmp(type, "image"))) return EINA_FALSE; if (evas_object_image_source_get(obj)) return EINA_FALSE; @@ -494,10 +497,34 @@ _recover_image_uv(Evas_Object *obj, Evas_Map *map, Eina_Bool revert, Eina_Bool b } else { - evas_map_point_image_uv_set(map, 0, 0, 0); - evas_map_point_image_uv_set(map, 1, iw, 0); - evas_map_point_image_uv_set(map, 2, iw, ih); - evas_map_point_image_uv_set(map, 3, 0, ih); + if (evas_object_image_filled_get(obj)) + { + x = 0; + y = 0; + w = iw; + h = ih; + } + //Zooming image fill area. + else + { + efl_gfx_fill_get(obj, &fill_x, &fill_y, &fill_w, &fill_h); + efl_gfx_geometry_get(obj, NULL, NULL, &w, &h); + + double rate_x = (double) w / (double) fill_w; + double rate_y = (double) h / (double) fill_h; + double rate_x2 = (double) iw / (double) fill_w; + double rate_y2 = (double) ih / (double) fill_h; + + x = -(int)((double) fill_x * rate_x2); + y = -(int)((double) fill_y * rate_y2); + w = (int)(((double) iw) * rate_x) + x; + h = (int)(((double) ih) * rate_y) + y; + } + + evas_map_point_image_uv_set(map, 0, x, y); + evas_map_point_image_uv_set(map, 1, w, y); + evas_map_point_image_uv_set(map, 2, w, h); + evas_map_point_image_uv_set(map, 3, x, h); } return EINA_TRUE; } |