summaryrefslogtreecommitdiff
path: root/src/lib/edje/edje_calc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/edje/edje_calc.c')
-rw-r--r--src/lib/edje/edje_calc.c101
1 files changed, 62 insertions, 39 deletions
diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
index 2af652c..c558cf8 100644
--- a/src/lib/edje/edje_calc.c
+++ b/src/lib/edje/edje_calc.c
@@ -2,7 +2,7 @@
2 2
3#include "edje_private.h" 3#include "edje_private.h"
4 4
5#include "../evas/canvas/evas_table.eo.h" 5#include "../evas/canvas/evas_table_eo.h"
6 6
7static void _edje_part_make_rtl(Edje_Part_Description_Common *desc); 7static void _edje_part_make_rtl(Edje_Part_Description_Common *desc);
8static Edje_Part_Description_Common *_edje_get_description_by_orientation(Edje *ed, Edje_Part_Description_Common *src, Edje_Part_Description_Common **dst, unsigned char type); 8static Edje_Part_Description_Common *_edje_get_description_by_orientation(Edje *ed, Edje_Part_Description_Common *src, Edje_Part_Description_Common **dst, unsigned char type);
@@ -2397,12 +2397,29 @@ _edje_filter_get(Edje *ed, Edje_Part_Description_Spec_Filter *filter)
2397static void 2397static void
2398_edje_part_pixel_adjust(Edje *ed, 2398_edje_part_pixel_adjust(Edje *ed,
2399 Edje_Real_Part *ep, 2399 Edje_Real_Part *ep,
2400 Edje_Calc_Params *params) 2400 Edje_Calc_Params *params,
2401 Eina_Bool round)
2401{ 2402{
2403 int xw, yh, fxw, fyh;
2404
2405 xw = ABS(params->final.x) + params->final.w;
2406 yh = ABS(params->final.y) + params->final.h;
2407
2408 if (round)
2409 {
2410 fxw = TO_INT_ROUND(ADD(ABS(params->eval.x), params->eval.w));
2411 fyh = TO_INT_ROUND(ADD(ABS(params->eval.y), params->eval.h));
2412 }
2413 else
2414 {
2415 fxw = TO_INT(ADD(ABS(params->eval.x), params->eval.w));
2416 fyh = TO_INT(ADD(ABS(params->eval.y), params->eval.h));
2417 }
2418
2402 /* Adjust rounding to not loose one pixels compared to float 2419 /* Adjust rounding to not loose one pixels compared to float
2403 information only when rendering to avoid infinite adjustement 2420 information only when rendering to avoid infinite adjustement
2404 when doing min restricted calc */ 2421 when doing min restricted calc */
2405 if (ABS(params->final.x) + params->final.w < TO_INT(ADD(ABS(params->eval.x), params->eval.w))) 2422 if (xw < fxw)
2406 { 2423 {
2407 if (!ed->calc_only) 2424 if (!ed->calc_only)
2408 { 2425 {
@@ -2413,7 +2430,7 @@ _edje_part_pixel_adjust(Edje *ed,
2413 ep->invalidate = EINA_TRUE; 2430 ep->invalidate = EINA_TRUE;
2414 } 2431 }
2415 } 2432 }
2416 else if (ABS(params->final.x) + params->final.w > TO_INT(ADD(ABS(params->eval.x), params->eval.w))) 2433 else if (xw > fxw)
2417 { 2434 {
2418 if (!ed->calc_only) 2435 if (!ed->calc_only)
2419 { 2436 {
@@ -2424,7 +2441,8 @@ _edje_part_pixel_adjust(Edje *ed,
2424 ep->invalidate = EINA_TRUE; 2441 ep->invalidate = EINA_TRUE;
2425 } 2442 }
2426 } 2443 }
2427 if (ABS(params->final.y) + params->final.h < TO_INT(ADD(ABS(params->eval.y), params->eval.h))) 2444
2445 if (yh < fyh)
2428 { 2446 {
2429 if (!ed->calc_only) 2447 if (!ed->calc_only)
2430 { 2448 {
@@ -2435,7 +2453,7 @@ _edje_part_pixel_adjust(Edje *ed,
2435 ep->invalidate = EINA_TRUE; 2453 ep->invalidate = EINA_TRUE;
2436 } 2454 }
2437 } 2455 }
2438 else if (ABS(params->final.y) + params->final.h > TO_INT(ADD(ABS(params->eval.y), params->eval.h))) 2456 else if (yh > fyh)
2439 { 2457 {
2440 if (!ed->calc_only) 2458 if (!ed->calc_only)
2441 { 2459 {
@@ -2447,6 +2465,8 @@ _edje_part_pixel_adjust(Edje *ed,
2447 } 2465 }
2448 } 2466 }
2449 2467
2468 if (params->final.w < 0 || params->final.h < 0)
2469 ERR("The params final size became negative");
2450} 2470}
2451 2471
2452static void 2472static void
@@ -2991,7 +3011,7 @@ _edje_part_recalc_single(Edje *ed,
2991 params->final.w = TO_INT(params->eval.w); 3011 params->final.w = TO_INT(params->eval.w);
2992 params->final.h = TO_INT(params->eval.h); 3012 params->final.h = TO_INT(params->eval.h);
2993 3013
2994 _edje_part_pixel_adjust(ed, ep, params); 3014 _edje_part_pixel_adjust(ed, ep, params, EINA_FALSE);
2995 /* fill */ 3015 /* fill */
2996 if (ep->part->type == EDJE_PART_TYPE_IMAGE) 3016 if (ep->part->type == EDJE_PART_TYPE_IMAGE)
2997 _edje_part_recalc_single_fill(ep, &((Edje_Part_Description_Image *)desc)->image.fill, params); 3017 _edje_part_recalc_single_fill(ep, &((Edje_Part_Description_Image *)desc)->image.fill, params);
@@ -3242,7 +3262,7 @@ _edje_vector_load_json(Edje *ed, Edje_Real_Part *ep, const char *key)
3242 json_data = (char *)eet_read(ed->file->ef, key, &json_data_len); 3262 json_data = (char *)eet_read(ed->file->ef, key, &json_data_len);
3243 json_data[json_data_len] = '\0'; 3263 json_data[json_data_len] = '\0';
3244 file = eina_file_virtualize(NULL, json_data, json_data_len + 1, EINA_FALSE); 3264 file = eina_file_virtualize(NULL, json_data, json_data_len + 1, EINA_FALSE);
3245 efl_file_mmap_set(ep->object, file, NULL); 3265 efl_file_simple_mmap_load(ep->object, file, NULL);
3246 3266
3247 if (ep->typedata.vector->json_virtual_file) 3267 if (ep->typedata.vector->json_virtual_file)
3248 eina_file_close(ep->typedata.vector->json_virtual_file); 3268 eina_file_close(ep->typedata.vector->json_virtual_file);
@@ -3303,17 +3323,17 @@ _edje_vector_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3 EIN
3303 3323
3304 if ((new_id < 0) || (new_type == EDJE_VECTOR_FILE_TYPE_JSON)) 3324 if ((new_id < 0) || (new_type == EDJE_VECTOR_FILE_TYPE_JSON))
3305 { 3325 {
3306 efl_file_set(ep->object, ed->file->path, src_key); 3326 efl_file_simple_load(ep->object, ed->file->path, src_key);
3307 } 3327 }
3308 else 3328 else
3309 { 3329 {
3310 snprintf(dest_key, sizeof(dest_key), "edje/vectors/%i", new_id); 3330 snprintf(dest_key, sizeof(dest_key), "edje/vectors/%i", new_id);
3311 3331
3312 efl_file_set(ep->object, ed->file->path, src_key); 3332 efl_file_simple_load(ep->object, ed->file->path, src_key);
3313 src_root = efl_canvas_vg_object_root_node_get(ep->object); 3333 src_root = efl_canvas_vg_object_root_node_get(ep->object);
3314 efl_ref(src_root); 3334 efl_ref(src_root);
3315 3335
3316 efl_file_set(ep->object, ed->file->path, dest_key); 3336 efl_file_simple_load(ep->object, ed->file->path, dest_key);
3317 dest_root = efl_canvas_vg_object_root_node_get(ep->object); 3337 dest_root = efl_canvas_vg_object_root_node_get(ep->object);
3318 efl_ref(dest_root); 3338 efl_ref(dest_root);
3319 3339
@@ -3593,7 +3613,7 @@ _edje_physics_body_add(Edje *ed, Edje_Real_Part *rp, EPhysics_World *world)
3593 ? (_x1) \ 3613 ? (_x1) \
3594 : ADD(_x1, MUL(_p, SUB(_x2, _x1)))); 3614 : ADD(_x1, MUL(_p, SUB(_x2, _x1))));
3595 3615
3596#define INTP(_x1, _x2, _p) TO_INT(FINTP(_x1, _x2, _p)) 3616#define INTP(_x1, _x2, _p) TO_INT_ROUND(FINTP(_x1, _x2, _p))
3597 3617
3598static void 3618static void
3599_map_colors_free(Edje_Calc_Params *pf) 3619_map_colors_free(Edje_Calc_Params *pf)
@@ -3780,7 +3800,7 @@ _edje_map_prop_set(Evas_Map *map, const Edje_Calc_Params *pf,
3780#define Rel2X 2 3800#define Rel2X 2
3781#define Rel2Y 3 3801#define Rel2Y 3
3782static Eina_Bool 3802static Eina_Bool
3783_circular_dependency_find(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part *cep, Eina_List **clist) 3803_circular_dependency_find(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part *cep, Eina_Array *arr)
3784{ 3804{
3785 Edje_Real_Part *rp = NULL; 3805 Edje_Real_Part *rp = NULL;
3786 3806
@@ -3794,18 +3814,18 @@ _circular_dependency_find(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part *cep, Ein
3794 if (cep->param1.description->rel1.id_x >= 0) 3814 if (cep->param1.description->rel1.id_x >= 0)
3795 { 3815 {
3796 rp = ed->table_parts[cep->param1.description->rel1.id_x]; 3816 rp = ed->table_parts[cep->param1.description->rel1.id_x];
3797 if (_circular_dependency_find(ed, ep, rp, clist)) 3817 if (_circular_dependency_find(ed, ep, rp, arr))
3798 { 3818 {
3799 *clist = eina_list_prepend(*clist, rp->part->name); 3819 eina_array_push(arr, eina_stringshare_ref(rp->part->name));
3800 return EINA_TRUE; 3820 return EINA_TRUE;
3801 } 3821 }
3802 } 3822 }
3803 if (cep->param1.description->rel2.id_x >= 0) 3823 if (cep->param1.description->rel2.id_x >= 0)
3804 { 3824 {
3805 rp = ed->table_parts[cep->param1.description->rel2.id_x]; 3825 rp = ed->table_parts[cep->param1.description->rel2.id_x];
3806 if (_circular_dependency_find(ed, ep, rp, clist)) 3826 if (_circular_dependency_find(ed, ep, rp, arr))
3807 { 3827 {
3808 *clist = eina_list_prepend(*clist, rp->part->name); 3828 eina_array_push(arr, eina_stringshare_ref(rp->part->name));
3809 return EINA_TRUE; 3829 return EINA_TRUE;
3810 } 3830 }
3811 } 3831 }
@@ -3816,18 +3836,18 @@ _circular_dependency_find(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part *cep, Ein
3816 if (cep->param2->description->rel1.id_x >= 0) 3836 if (cep->param2->description->rel1.id_x >= 0)
3817 { 3837 {
3818 rp = ed->table_parts[cep->param2->description->rel1.id_x]; 3838 rp = ed->table_parts[cep->param2->description->rel1.id_x];
3819 if (_circular_dependency_find(ed, ep, rp, clist)) 3839 if (_circular_dependency_find(ed, ep, rp, arr))
3820 { 3840 {
3821 *clist = eina_list_prepend(*clist, rp->part->name); 3841 eina_array_push(arr, eina_stringshare_ref(rp->part->name));
3822 return EINA_TRUE; 3842 return EINA_TRUE;
3823 } 3843 }
3824 } 3844 }
3825 if (cep->param2->description->rel2.id_x >= 0) 3845 if (cep->param2->description->rel2.id_x >= 0)
3826 { 3846 {
3827 rp = ed->table_parts[cep->param2->description->rel2.id_x]; 3847 rp = ed->table_parts[cep->param2->description->rel2.id_x];
3828 if (_circular_dependency_find(ed, ep, rp, clist)) 3848 if (_circular_dependency_find(ed, ep, rp, arr))
3829 { 3849 {
3830 *clist = eina_list_prepend(*clist, rp->part->name); 3850 eina_array_push(arr, eina_stringshare_ref(rp->part->name));
3831 return EINA_TRUE; 3851 return EINA_TRUE;
3832 } 3852 }
3833 } 3853 }
@@ -3840,18 +3860,18 @@ _circular_dependency_find(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part *cep, Ein
3840 if (cep->param1.description->rel1.id_y >= 0) 3860 if (cep->param1.description->rel1.id_y >= 0)
3841 { 3861 {
3842 rp = ed->table_parts[cep->param1.description->rel1.id_y]; 3862 rp = ed->table_parts[cep->param1.description->rel1.id_y];
3843 if (_circular_dependency_find(ed, ep, rp, clist)) 3863 if (_circular_dependency_find(ed, ep, rp, arr))
3844 { 3864 {
3845 *clist = eina_list_prepend(*clist, rp->part->name); 3865 eina_array_push(arr, eina_stringshare_ref(rp->part->name));
3846 return EINA_TRUE; 3866 return EINA_TRUE;
3847 } 3867 }
3848 } 3868 }
3849 if (cep->param1.description->rel2.id_y >= 0) 3869 if (cep->param1.description->rel2.id_y >= 0)
3850 { 3870 {
3851 rp = ed->table_parts[cep->param1.description->rel2.id_y]; 3871 rp = ed->table_parts[cep->param1.description->rel2.id_y];
3852 if (_circular_dependency_find(ed, ep, rp, clist)) 3872 if (_circular_dependency_find(ed, ep, rp, arr))
3853 { 3873 {
3854 *clist = eina_list_prepend(*clist, rp->part->name); 3874 eina_array_push(arr, eina_stringshare_ref(rp->part->name));
3855 return EINA_TRUE; 3875 return EINA_TRUE;
3856 } 3876 }
3857 } 3877 }
@@ -3861,18 +3881,18 @@ _circular_dependency_find(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part *cep, Ein
3861 if (cep->param2->description->rel1.id_y >= 0) 3881 if (cep->param2->description->rel1.id_y >= 0)
3862 { 3882 {
3863 rp = ed->table_parts[cep->param2->description->rel1.id_y]; 3883 rp = ed->table_parts[cep->param2->description->rel1.id_y];
3864 if (_circular_dependency_find(ed, ep, rp, clist)) 3884 if (_circular_dependency_find(ed, ep, rp, arr))
3865 { 3885 {
3866 *clist = eina_list_prepend(*clist, rp->part->name); 3886 eina_array_push(arr, eina_stringshare_ref(rp->part->name));
3867 return EINA_TRUE; 3887 return EINA_TRUE;
3868 } 3888 }
3869 } 3889 }
3870 if (cep->param2->description->rel2.id_y >= 0) 3890 if (cep->param2->description->rel2.id_y >= 0)
3871 { 3891 {
3872 rp = ed->table_parts[cep->param2->description->rel2.id_y]; 3892 rp = ed->table_parts[cep->param2->description->rel2.id_y];
3873 if (_circular_dependency_find(ed, ep, rp, clist)) 3893 if (_circular_dependency_find(ed, ep, rp, arr))
3874 { 3894 {
3875 *clist = eina_list_prepend(*clist, rp->part->name); 3895 eina_array_push(arr, eina_stringshare_ref(rp->part->name));
3876 return EINA_TRUE; 3896 return EINA_TRUE;
3877 } 3897 }
3878 } 3898 }
@@ -4032,26 +4052,29 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
4032 axes, ep->calculating, 4052 axes, ep->calculating,
4033 faxes, flags); 4053 faxes, flags);
4034 4054
4035 Eina_List *clist = NULL; 4055 Eina_Array *part_array = eina_array_new(10);;
4036 Eina_List *l = NULL;
4037 char *part_name;
4038 char depends_path[PATH_MAX] = "";
4039 4056
4040 if (_circular_dependency_find(ed, ep, NULL, &clist)) 4057 if (_circular_dependency_find(ed, ep, NULL, part_array))
4041 { 4058 {
4059 Eina_Array_Iterator it;
4060 unsigned int i;
4061 char *part_name;
4062 char depends_path[PATH_MAX] = "";
4063
4064 efl_event_callback_legacy_call(ed->obj, EFL_LAYOUT_EVENT_CIRCULAR_DEPENDENCY, part_array);
4042 strncat(depends_path, ep->part->name, 4065 strncat(depends_path, ep->part->name,
4043 sizeof(depends_path) - strlen(depends_path) - 1); 4066 sizeof(depends_path) - strlen(depends_path) - 1);
4044 EINA_LIST_FOREACH(clist, l, part_name) 4067 EINA_ARRAY_ITER_NEXT(part_array, i, part_name, it)
4045 { 4068 {
4046 strncat(depends_path, " -> ", 4069 strncat(depends_path, " -> ",
4047 sizeof(depends_path) - strlen(depends_path) - 1); 4070 sizeof(depends_path) - strlen(depends_path) - 1);
4048 strncat(depends_path, part_name, 4071 strncat(depends_path, part_name,
4049 sizeof(depends_path) - strlen(depends_path) - 1); 4072 sizeof(depends_path) - strlen(depends_path) - 1);
4073 eina_stringshare_del(part_name);
4050 } 4074 }
4051 efl_event_callback_legacy_call(ed->obj, EFL_LAYOUT_EVENT_CIRCULAR_DEPENDENCY, clist);
4052 ERR("Circular dependency in the group '%s' : %s", 4075 ERR("Circular dependency in the group '%s' : %s",
4053 ed->group, depends_path); 4076 ed->group, depends_path);
4054 eina_list_free(clist); 4077 eina_array_free(part_array);
4055 } 4078 }
4056#endif 4079#endif
4057 return; 4080 return;
@@ -4477,7 +4500,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
4477 p3->req.w = INTP(p1->req.w, p2->req.w, pos); 4500 p3->req.w = INTP(p1->req.w, p2->req.w, pos);
4478 p3->req.h = INTP(p1->req.h, p2->req.h, pos); 4501 p3->req.h = INTP(p1->req.h, p2->req.h, pos);
4479 4502
4480 _edje_part_pixel_adjust(ed, ep, p3); 4503 _edje_part_pixel_adjust(ed, ep, p3, EINA_TRUE);
4481 4504
4482 if (ep->part->dragable.x) 4505 if (ep->part->dragable.x)
4483 { 4506 {
@@ -5067,7 +5090,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
5067 proxy = ed->file->image_dir->entries[pd_mesh_node->mesh_node.texture.id].entry; 5090 proxy = ed->file->image_dir->entries[pd_mesh_node->mesh_node.texture.id].entry;
5068 if (proxy) 5091 if (proxy)
5069 { 5092 {
5070 efl_file_mmap_set(texture, ed->file->f, proxy); 5093 efl_file_simple_mmap_load(texture, ed->file->f, proxy);
5071 evas_canvas3d_texture_filter_set(texture, pd_mesh_node->mesh_node.texture.filter1, pd_mesh_node->mesh_node.texture.filter2); 5094 evas_canvas3d_texture_filter_set(texture, pd_mesh_node->mesh_node.texture.filter1, pd_mesh_node->mesh_node.texture.filter2);
5072 evas_canvas3d_texture_wrap_set(texture, pd_mesh_node->mesh_node.texture.wrap1, pd_mesh_node->mesh_node.texture.wrap2); 5095 evas_canvas3d_texture_wrap_set(texture, pd_mesh_node->mesh_node.texture.wrap1, pd_mesh_node->mesh_node.texture.wrap2);
5073 } 5096 }