summaryrefslogtreecommitdiff
path: root/src/lib/edje/edje_calc.c
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-08-20 09:43:52 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-08-21 20:02:23 +0100
commitcfa8224140de350e24370ca4d39f5691af8555d7 (patch)
treede807dc96502a4123e66d116437c8067416b6004 /src/lib/edje/edje_calc.c
parent55b3e8e96dd3da77a9b7e4a791da5ef98dcf8325 (diff)
edje recalc - move rare recalc code out of hot path
we rarely use tables in edje, so move it out of the hot path for intruction prefetch/cache. also for calc single - move things to sub funcs so things like mesh, light and so on code is always out of the hot path as much as possible. we probably can merge our 2 switch statements as well. this really just restructures the code to move stuff into sub functions which also does make the calc funcs look simpler and easier to read.
Diffstat (limited to '')
-rw-r--r--src/lib/edje/edje_calc.c549
1 files changed, 306 insertions, 243 deletions
diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
index f3d31c8502..3dcdc73426 100644
--- a/src/lib/edje/edje_calc.c
+++ b/src/lib/edje/edje_calc.c
@@ -960,6 +960,46 @@ _edje_recalc(Edje *ed)
960// ed->postponed = EINA_TRUE; 960// ed->postponed = EINA_TRUE;
961} 961}
962 962
963static
964#ifdef EDJE_CALC_CACHE
965Eina_Bool
966#else
967void
968#endif
969_edje_recalc_table_parts(Edje *ed
970#ifdef EDJE_CALC_CACHE
971 , Eina_Bool need_reinit_state
972#endif
973 )
974{
975 unsigned short i;
976 Edje_Real_Part *ep;
977
978 for (i = 0; i < ed->table_parts_size; i++)
979 {
980 ep = ed->table_parts[i];
981 ep->calculated = FLAG_NONE; // FIXME: this is dubious (see below)
982 ep->calculating = FLAG_NONE;
983#ifdef EDJE_CALC_CACHE
984 if (need_reinit_state)
985 {
986 ep->state = 0;
987 ep->param1.state = 0;
988 if (ep->param2) ep->param2->state = 0;
989 }
990#endif
991 }
992 for (i = 0; i < ed->table_parts_size; i++)
993 {
994 ep = ed->table_parts[i];
995 if (ep->calculated != FLAG_XY) // FIXME: this is always true (see for above)
996 _edje_part_recalc(ed, ep, (~ep->calculated) & FLAG_XY, NULL);
997 }
998#ifdef EDJE_CALC_CACHE
999 return need_reinit_state;
1000#endif
1001}
1002
963void 1003void
964_edje_recalc_do(Edje *ed) 1004_edje_recalc_do(Edje *ed)
965{ 1005{
@@ -986,31 +1026,16 @@ _edje_recalc_do(Edje *ed)
986#endif 1026#endif
987 } 1027 }
988 1028
989 for (i = 0; i < ed->table_parts_size; i++) 1029 if (EINA_UNLIKELY(ed->table_parts_size > 0))
990 {
991 Edje_Real_Part *ep;
992
993 ep = ed->table_parts[i];
994 ep->calculated = FLAG_NONE; // FIXME: this is dubious (see below)
995 ep->calculating = FLAG_NONE;
996#ifdef EDJE_CALC_CACHE 1030#ifdef EDJE_CALC_CACHE
997 if (need_reinit_state) 1031 need_reinit_state =
998 {
999 ep->state = 0;
1000 ep->param1.state = 0;
1001 if (ep->param2)
1002 ep->param2->state = 0;
1003 }
1004#endif 1032#endif
1005 } 1033 _edje_recalc_table_parts(ed
1006 for (i = 0; i < ed->table_parts_size; i++) 1034#ifdef EDJE_CALC_CACHE
1007 { 1035 , need_reinit_state
1008 Edje_Real_Part *ep; 1036#endif
1037 );
1009 1038
1010 ep = ed->table_parts[i];
1011 if (ep->calculated != FLAG_XY) // FIXME: this is always true (see for above)
1012 _edje_part_recalc(ed, ep, (~ep->calculated) & FLAG_XY, NULL);
1013 }
1014 if (!ed->calc_only) ed->recalc = EINA_FALSE; 1039 if (!ed->calc_only) ed->recalc = EINA_FALSE;
1015#ifdef EDJE_CALC_CACHE 1040#ifdef EDJE_CALC_CACHE
1016 ed->all_part_change = EINA_FALSE; 1041 ed->all_part_change = EINA_FALSE;
@@ -2691,6 +2716,220 @@ _edje_part_recalc_single_filter(Edje *ed,
2691} 2716}
2692 2717
2693static void 2718static void
2719_edje_part_recalc_single_table(Edje_Real_Part *ep,
2720 Edje_Part_Description_Common *chosen_desc,
2721 int *minw, int *minh)
2722{
2723 Eina_Size2D lmin;
2724
2725 efl_canvas_group_need_recalculate_set(ep->object, 1);
2726 efl_canvas_group_calculate(ep->object);
2727 lmin = efl_gfx_hint_size_restricted_min_get(ep->object);
2728 if (((Edje_Part_Description_Table *)chosen_desc)->table.min.h)
2729 {
2730 if (lmin.w > *minw) *minw = lmin.w;
2731 }
2732 if (((Edje_Part_Description_Table *)chosen_desc)->table.min.v)
2733 {
2734 if (lmin.h > *minh) *minh = lmin.h;
2735 }
2736}
2737
2738static void
2739_edje_part_recalc_single_box(Edje_Real_Part *ep,
2740 Edje_Part_Description_Common *chosen_desc,
2741 int *minw, int *minh)
2742{
2743 Eina_Size2D lmin;
2744
2745 efl_canvas_group_need_recalculate_set(ep->object, 1);
2746 efl_canvas_group_calculate(ep->object);
2747 lmin = efl_gfx_hint_size_restricted_min_get(ep->object);
2748 if (((Edje_Part_Description_Box *)chosen_desc)->box.min.h)
2749 {
2750 if (lmin.w > *minw) *minw = lmin.w;
2751 }
2752 if (((Edje_Part_Description_Box *)chosen_desc)->box.min.v)
2753 {
2754 if (lmin.h > *minh) *minh = lmin.h;
2755 }
2756}
2757
2758static void
2759_edje_part_recalc_single_image(Edje *ed, Edje_Real_Part *ep,
2760 Edje_Part_Description_Common *chosen_desc,
2761 FLOAT_T pos,
2762 int *minw, int *minh, int *maxw, int *maxh)
2763{
2764 Evas_Coord w, h;
2765
2766 /* We only need pos to find the right image that would be displayed */
2767 /* Yes, if someone set aspect preference to SOURCE and also max,min
2768 to SOURCE, it will be under efficient, but who cares at the
2769 moment. */
2770 _edje_real_part_image_set(ed, ep, NULL, pos);
2771 evas_object_image_size_get(ep->object, &w, &h);
2772 if (chosen_desc->min.limit)
2773 {
2774 if (w > *minw) *minw = w;
2775 if (h > *minh) *minh = h;
2776 }
2777 if (chosen_desc->max.limit)
2778 {
2779 if ((*maxw <= 0) || (w < *maxw)) *maxw = w;
2780 if ((*maxh <= 0) || (h < *maxh)) *maxh = h;
2781 }
2782}
2783
2784#ifdef HAVE_EPHYSICS
2785static void
2786_edje_part_recalc_single_physics(Edje_Calc_Params *params,
2787 Edje_Part_Description_Common *desc)
2788{
2789 EINA_COW_CALC_PHYSICS_BEGIN(params, params_write)
2790 {
2791 params_write->mass = desc->physics.mass;
2792 params_write->restitution = desc->physics.restitution;
2793 params_write->friction = desc->physics.friction;
2794 params_write->damping.linear = desc->physics.damping.linear;
2795 params_write->damping.angular = desc->physics.damping.angular;
2796 params_write->sleep.linear = desc->physics.sleep.linear;
2797 params_write->sleep.angular = desc->physics.sleep.angular;
2798 params_write->material = desc->physics.material;
2799 params_write->density = desc->physics.density;
2800 params_write->hardness = desc->physics.hardness;
2801 params_write->ignore_part_pos = desc->physics.ignore_part_pos;
2802 params_write->light_on = desc->physics.light_on;
2803 params_write->mov_freedom.lin.x = desc->physics.mov_freedom.lin.x;
2804 params_write->mov_freedom.lin.y = desc->physics.mov_freedom.lin.y;
2805 params_write->mov_freedom.lin.z = desc->physics.mov_freedom.lin.z;
2806 params_write->mov_freedom.ang.x = desc->physics.mov_freedom.ang.x;
2807 params_write->mov_freedom.ang.y = desc->physics.mov_freedom.ang.y;
2808 params_write->mov_freedom.ang.z = desc->physics.mov_freedom.ang.z;
2809 params_write->backcull = desc->physics.backcull;
2810 params_write->z = desc->physics.z;
2811 params_write->depth = desc->physics.depth;
2812 }
2813 EINA_COW_CALC_PHYSICS_END(params, params_write);
2814}
2815#endif
2816
2817static void
2818_edje_part_calc_single_fixed_info(Edje *ed, Edje_Real_Part *ep,
2819 Eina_Bool fixedw, Eina_Bool fixedh)
2820{
2821 INF("file %s, group %s has a non-fixed part '%s'. You should add "
2822 "'fixed: %d %d'. But in order to optimize the edje calc, we "
2823 "add it automatically.", ed->path, ed->group, ep->part->name,
2824 fixedw, fixedh);
2825}
2826
2827static void
2828_edje_part_calc_single_image0(Edje *ed, Edje_Real_Part *ep,
2829 Edje_Calc_Params *params,
2830 Edje_Part_Description_Image *img_desc,
2831 FLOAT_T pos)
2832{
2833 Edje_Real_Part_Set *set;
2834
2835 _edje_real_part_image_set(ed, ep, &set, pos);
2836
2837 /* border */
2838 _edje_calc_params_need_type_common(params);
2839 params->type.common->spec.image.l = img_desc->image.border.l;
2840 params->type.common->spec.image.r = img_desc->image.border.r;
2841 params->type.common->spec.image.t = img_desc->image.border.t;
2842 params->type.common->spec.image.b = img_desc->image.border.b;
2843
2844 params->type.common->spec.image.border_scale_by = img_desc->image.border.scale_by;
2845
2846 if (set && set->set)
2847 {
2848#define SET_BORDER_DEFINED(Result, Value) Result = Value ? Value : Result;
2849 SET_BORDER_DEFINED(params->type.common->spec.image.l, set->entry->border.l);
2850 SET_BORDER_DEFINED(params->type.common->spec.image.r, set->entry->border.r);
2851 SET_BORDER_DEFINED(params->type.common->spec.image.t, set->entry->border.t);
2852 SET_BORDER_DEFINED(params->type.common->spec.image.b, set->entry->border.b);
2853
2854 params->type.common->spec.image.border_scale_by = NEQ(set->entry->border.scale_by, ZERO) ?
2855 set->entry->border.scale_by : params->type.common->spec.image.border_scale_by;
2856 }
2857}
2858
2859static void
2860_edje_part_calc_single_text0(Edje_Calc_Params *params,
2861 Edje_Part_Description_Text *text_desc,
2862 Edje_Color_Class *cc)
2863{
2864 _edje_calc_params_need_type_text(params);
2865 /* text.align */
2866 params->type.text->align.x = text_desc->text.align.x;
2867 params->type.text->align.y = text_desc->text.align.y;
2868 params->type.text->ellipsis = text_desc->text.ellipsis;
2869
2870 /* text colors */
2871 if (cc)
2872 {
2873 params->type.text->color2.r = (((int)cc->r2 + 1) * text_desc->common.color2.r) >> 8;
2874 params->type.text->color2.g = (((int)cc->g2 + 1) * text_desc->common.color2.g) >> 8;
2875 params->type.text->color2.b = (((int)cc->b2 + 1) * text_desc->common.color2.b) >> 8;
2876 params->type.text->color2.a = (((int)cc->a2 + 1) * text_desc->common.color2.a) >> 8;
2877 params->type.text->color3.r = (((int)cc->r3 + 1) * text_desc->text.color3.r) >> 8;
2878 params->type.text->color3.g = (((int)cc->g3 + 1) * text_desc->text.color3.g) >> 8;
2879 params->type.text->color3.b = (((int)cc->b3 + 1) * text_desc->text.color3.b) >> 8;
2880 params->type.text->color3.a = (((int)cc->a3 + 1) * text_desc->text.color3.a) >> 8;
2881 }
2882 else
2883 {
2884 params->type.text->color2.r = text_desc->common.color2.r;
2885 params->type.text->color2.g = text_desc->common.color2.g;
2886 params->type.text->color2.b = text_desc->common.color2.b;
2887 params->type.text->color2.a = text_desc->common.color2.a;
2888 params->type.text->color3.r = text_desc->text.color3.r;
2889 params->type.text->color3.g = text_desc->text.color3.g;
2890 params->type.text->color3.b = text_desc->text.color3.b;
2891 params->type.text->color3.a = text_desc->text.color3.a;
2892 }
2893}
2894
2895static void
2896_edje_part_calc_single_light0(Edje_Calc_Params *params,
2897 Edje_Part_Description_Light *light_desc)
2898{
2899 _edje_calc_params_need_type_node(params);
2900 params->type.node->data[0] = light_desc->light.orientation.data[0];
2901 params->type.node->point.x = light_desc->light.position.point.x;
2902 params->type.node->point.y = light_desc->light.position.point.y;
2903 params->type.node->point.z = light_desc->light.position.point.z;
2904}
2905
2906static void
2907_edje_part_calc_single_camera0(Edje_Calc_Params *params,
2908 Edje_Part_Description_Camera *camera_desc)
2909{
2910 _edje_calc_params_need_type_node(params);
2911 params->type.node->data[0] = camera_desc->camera.orientation.data[0];
2912 params->type.node->point.x = camera_desc->camera.position.point.x;
2913 params->type.node->point.y = camera_desc->camera.position.point.y;
2914 params->type.node->point.z = camera_desc->camera.position.point.z;
2915}
2916
2917static void
2918_edje_part_calc_single_mesh0(Edje_Calc_Params *params,
2919 Edje_Part_Description_Mesh_Node *mesh_desc)
2920{
2921 _edje_calc_params_need_type_node(params);
2922 params->type.node->frame = mesh_desc->mesh_node.mesh.frame;
2923 params->type.node->data[0] = mesh_desc->mesh_node.orientation.data[0];
2924 params->type.node->point.x = mesh_desc->mesh_node.position.point.x;
2925 params->type.node->point.y = mesh_desc->mesh_node.position.point.y;
2926 params->type.node->point.z = mesh_desc->mesh_node.position.point.z;
2927 params->type.node->scale_3d.x = mesh_desc->mesh_node.scale_3d.x;
2928 params->type.node->scale_3d.y = mesh_desc->mesh_node.scale_3d.y;
2929 params->type.node->scale_3d.z = mesh_desc->mesh_node.scale_3d.z;
2930}
2931
2932static void
2694_edje_part_recalc_single(Edje *ed, 2933_edje_part_recalc_single(Edje *ed,
2695 Edje_Real_Part *ep, 2934 Edje_Real_Part *ep,
2696 Edje_Part_Description_Common *desc, 2935 Edje_Part_Description_Common *desc,
@@ -2739,7 +2978,6 @@ _edje_part_recalc_single(Edje *ed,
2739 chosen_desc->fixed.w = 1; 2978 chosen_desc->fixed.w = 1;
2740 fixedw = EINA_TRUE; 2979 fixedw = EINA_TRUE;
2741 } 2980 }
2742
2743 if ((rel1_to_y == rel2_to_y) && 2981 if ((rel1_to_y == rel2_to_y) &&
2744 (EQ(desc->rel1.relative_y, desc->rel2.relative_y)) && 2982 (EQ(desc->rel1.relative_y, desc->rel2.relative_y)) &&
2745 (!chosen_desc->fixed.h)) 2983 (!chosen_desc->fixed.h))
@@ -2748,19 +2986,13 @@ _edje_part_recalc_single(Edje *ed,
2748 fixedh = EINA_TRUE; 2986 fixedh = EINA_TRUE;
2749 } 2987 }
2750 if (fixedw || fixedh) 2988 if (fixedw || fixedh)
2751 { 2989 _edje_part_calc_single_fixed_info(ed, ep, fixedw, fixedh);
2752 INF("file %s, group %s has a non-fixed part '%s'. You should add "
2753 "'fixed: %d %d'. But in order to optimize the edje calc, we "
2754 "add it automatically.", ed->path, ed->group, ep->part->name,
2755 fixedw, fixedh);
2756 }
2757 2990
2758 /* colors */ 2991 /* colors */
2759 if (ep->part->type != EDJE_PART_TYPE_SPACER) 2992 if (ep->part->type != EDJE_PART_TYPE_SPACER)
2760 { 2993 {
2761 if ((desc->color_class) && (*desc->color_class)) 2994 if ((desc->color_class) && (*desc->color_class))
2762 cc = _edje_color_class_recursive_find(ed, desc->color_class); 2995 cc = _edje_color_class_recursive_find(ed, desc->color_class);
2763
2764 if (cc) 2996 if (cc)
2765 { 2997 {
2766 params->color.r = (((int)cc->r + 1) * desc->color.r) >> 8; 2998 params->color.r = (((int)cc->r + 1) * desc->color.r) >> 8;
@@ -2799,79 +3031,16 @@ _edje_part_recalc_single(Edje *ed,
2799 params->ext->clip_to = clip_to; 3031 params->ext->clip_to = clip_to;
2800 } 3032 }
2801 3033
2802 /* set parameters, some are required for recalc_single_text[block] */ 3034 // set parameters, some are required for recalc_single_text[block]
2803 switch (ep->part->type) 3035 switch (ep->part->type)
2804 { 3036 {
2805 case EDJE_PART_TYPE_IMAGE: 3037 case EDJE_PART_TYPE_IMAGE:
2806 { 3038 _edje_part_calc_single_image0(ed, ep, params, (Edje_Part_Description_Image *)desc, pos);
2807 Edje_Real_Part_Set *set; 3039 break;
2808 Edje_Part_Description_Image *img_desc = (Edje_Part_Description_Image *)desc;
2809
2810 _edje_real_part_image_set(ed, ep, &set, pos);
2811
2812 /* border */
2813 _edje_calc_params_need_type_common(params);
2814 params->type.common->spec.image.l = img_desc->image.border.l;
2815 params->type.common->spec.image.r = img_desc->image.border.r;
2816
2817 params->type.common->spec.image.t = img_desc->image.border.t;
2818 params->type.common->spec.image.b = img_desc->image.border.b;
2819
2820 params->type.common->spec.image.border_scale_by = img_desc->image.border.scale_by;
2821
2822 if (set && set->set)
2823 {
2824#define SET_BORDER_DEFINED(Result, Value) Result = Value ? Value : Result;
2825 SET_BORDER_DEFINED(params->type.common->spec.image.l, set->entry->border.l);
2826 SET_BORDER_DEFINED(params->type.common->spec.image.r, set->entry->border.r);
2827 SET_BORDER_DEFINED(params->type.common->spec.image.t, set->entry->border.t);
2828 SET_BORDER_DEFINED(params->type.common->spec.image.b, set->entry->border.b);
2829
2830 params->type.common->spec.image.border_scale_by = NEQ(set->entry->border.scale_by, ZERO) ?
2831 set->entry->border.scale_by : params->type.common->spec.image.border_scale_by;
2832 }
2833
2834 break;
2835 }
2836
2837 case EDJE_PART_TYPE_TEXT: 3040 case EDJE_PART_TYPE_TEXT:
2838 case EDJE_PART_TYPE_TEXTBLOCK: 3041 case EDJE_PART_TYPE_TEXTBLOCK:
2839 { 3042 _edje_part_calc_single_text0(params, (Edje_Part_Description_Text *)desc, cc);
2840 Edje_Part_Description_Text *text_desc = (Edje_Part_Description_Text *)desc; 3043 break;
2841
2842 _edje_calc_params_need_type_text(params);
2843 /* text.align */
2844 params->type.text->align.x = text_desc->text.align.x;
2845 params->type.text->align.y = text_desc->text.align.y;
2846 params->type.text->ellipsis = text_desc->text.ellipsis;
2847
2848 /* text colors */
2849 if (cc)
2850 {
2851 params->type.text->color2.r = (((int)cc->r2 + 1) * text_desc->common.color2.r) >> 8;
2852 params->type.text->color2.g = (((int)cc->g2 + 1) * text_desc->common.color2.g) >> 8;
2853 params->type.text->color2.b = (((int)cc->b2 + 1) * text_desc->common.color2.b) >> 8;
2854 params->type.text->color2.a = (((int)cc->a2 + 1) * text_desc->common.color2.a) >> 8;
2855 params->type.text->color3.r = (((int)cc->r3 + 1) * text_desc->text.color3.r) >> 8;
2856 params->type.text->color3.g = (((int)cc->g3 + 1) * text_desc->text.color3.g) >> 8;
2857 params->type.text->color3.b = (((int)cc->b3 + 1) * text_desc->text.color3.b) >> 8;
2858 params->type.text->color3.a = (((int)cc->a3 + 1) * text_desc->text.color3.a) >> 8;
2859 }
2860 else
2861 {
2862 params->type.text->color2.r = text_desc->common.color2.r;
2863 params->type.text->color2.g = text_desc->common.color2.g;
2864 params->type.text->color2.b = text_desc->common.color2.b;
2865 params->type.text->color2.a = text_desc->common.color2.a;
2866 params->type.text->color3.r = text_desc->text.color3.r;
2867 params->type.text->color3.g = text_desc->text.color3.g;
2868 params->type.text->color3.b = text_desc->text.color3.b;
2869 params->type.text->color3.a = text_desc->text.color3.a;
2870 }
2871
2872 break;
2873 }
2874
2875 case EDJE_PART_TYPE_SPACER: 3044 case EDJE_PART_TYPE_SPACER:
2876 case EDJE_PART_TYPE_RECTANGLE: 3045 case EDJE_PART_TYPE_RECTANGLE:
2877 case EDJE_PART_TYPE_BOX: 3046 case EDJE_PART_TYPE_BOX:
@@ -2882,136 +3051,56 @@ _edje_part_recalc_single(Edje *ed,
2882 case EDJE_PART_TYPE_SNAPSHOT: 3051 case EDJE_PART_TYPE_SNAPSHOT:
2883 case EDJE_PART_TYPE_VECTOR: 3052 case EDJE_PART_TYPE_VECTOR:
2884 break; 3053 break;
2885
2886 case EDJE_PART_TYPE_LIGHT: 3054 case EDJE_PART_TYPE_LIGHT:
2887 { 3055 _edje_part_calc_single_light0(params, (Edje_Part_Description_Light *)desc);
2888 Edje_Part_Description_Light *light_desc = (Edje_Part_Description_Light *)desc; 3056 break;
2889
2890 _edje_calc_params_need_type_node(params);
2891 params->type.node->data[0] = light_desc->light.orientation.data[0];
2892 params->type.node->point.x = light_desc->light.position.point.x;
2893 params->type.node->point.y = light_desc->light.position.point.y;
2894 params->type.node->point.z = light_desc->light.position.point.z;
2895
2896 break;
2897 }
2898
2899 case EDJE_PART_TYPE_CAMERA: 3057 case EDJE_PART_TYPE_CAMERA:
2900 { 3058 _edje_part_calc_single_camera0(params, (Edje_Part_Description_Camera *)desc);
2901 Edje_Part_Description_Camera *camera_desc = (Edje_Part_Description_Camera *)desc; 3059 break;
2902
2903 _edje_calc_params_need_type_node(params);
2904 params->type.node->data[0] = camera_desc->camera.orientation.data[0];
2905 params->type.node->point.x = camera_desc->camera.position.point.x;
2906 params->type.node->point.y = camera_desc->camera.position.point.y;
2907 params->type.node->point.z = camera_desc->camera.position.point.z;
2908
2909 break;
2910 }
2911
2912 case EDJE_PART_TYPE_MESH_NODE: 3060 case EDJE_PART_TYPE_MESH_NODE:
2913 { 3061 _edje_part_calc_single_mesh0(params, (Edje_Part_Description_Mesh_Node *)desc);
2914 Edje_Part_Description_Mesh_Node *mesh_desc = (Edje_Part_Description_Mesh_Node *)desc; 3062 break;
2915
2916 _edje_calc_params_need_type_node(params);
2917 params->type.node->frame = mesh_desc->mesh_node.mesh.frame;
2918 params->type.node->data[0] = mesh_desc->mesh_node.orientation.data[0];
2919 params->type.node->point.x = mesh_desc->mesh_node.position.point.x;
2920 params->type.node->point.y = mesh_desc->mesh_node.position.point.y;
2921 params->type.node->point.z = mesh_desc->mesh_node.position.point.z;
2922 params->type.node->scale_3d.x = mesh_desc->mesh_node.scale_3d.x;
2923 params->type.node->scale_3d.y = mesh_desc->mesh_node.scale_3d.y;
2924 params->type.node->scale_3d.z = mesh_desc->mesh_node.scale_3d.z;
2925
2926 break;
2927 }
2928
2929 case EDJE_PART_TYPE_GRADIENT: 3063 case EDJE_PART_TYPE_GRADIENT:
2930 /* FIXME: THIS ONE SHOULD NEVER BE TRIGGERED. */ 3064 // FIXME: THIS ONE SHOULD NEVER BE TRIGGERED
2931 break; 3065 break;
2932
2933 default: 3066 default:
2934 break; 3067 break;
2935 } 3068 }
2936 3069
2937 /* if we have text that wants to make the min size the text size... */ 3070 // limit size if needed
2938 if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK) 3071 switch (ep->part->type)
2939 _edje_part_recalc_single_textblock(sc, ed, ep, (Edje_Part_Description_Text *)chosen_desc, params, &minw, &minh, &maxw, &maxh);
2940 else if (ep->part->type == EDJE_PART_TYPE_TEXT)
2941 { 3072 {
2942 _edje_part_recalc_single_text(sc, ed, ep, (Edje_Part_Description_Text*) desc, (Edje_Part_Description_Text*) chosen_desc, params, &minw, &minh, &maxw, &maxh); 3073 // if we have text that wants to make the min size the text size...
3074 case EDJE_PART_TYPE_TEXTBLOCK:
3075 _edje_part_recalc_single_textblock(sc, ed, ep, (Edje_Part_Description_Text *)chosen_desc, params, &minw, &minh, &maxw, &maxh);
3076 break;
3077 case EDJE_PART_TYPE_TEXT:
3078 _edje_part_recalc_single_text(sc, ed, ep, (Edje_Part_Description_Text *)desc, (Edje_Part_Description_Text *)chosen_desc, params, &minw, &minh, &maxw, &maxh);
2943 _edje_part_recalc_single_filter(ed, ep, desc, chosen_desc, pos); 3079 _edje_part_recalc_single_filter(ed, ep, desc, chosen_desc, pos);
2944 } 3080 break;
2945 3081 // or table/box containers that want to do the same
2946 if ((ep->part->type == EDJE_PART_TYPE_TABLE) && 3082 case EDJE_PART_TYPE_TABLE:
2947 (((((Edje_Part_Description_Table *)chosen_desc)->table.min.h) || 3083 if (((((Edje_Part_Description_Table *)chosen_desc)->table.min.h) ||
2948 (((Edje_Part_Description_Table *)chosen_desc)->table.min.v)))) 3084 (((Edje_Part_Description_Table *)chosen_desc)->table.min.v)))
2949 { 3085 _edje_part_recalc_single_table(ep, chosen_desc, &minw, &minh);
2950 Eina_Size2D lmin; 3086 break;
2951 3087 case EDJE_PART_TYPE_BOX:
2952 efl_canvas_group_need_recalculate_set(ep->object, 1); 3088 if ((((Edje_Part_Description_Box *)chosen_desc)->box.min.h) ||
2953 efl_canvas_group_calculate(ep->object); 3089 (((Edje_Part_Description_Box *)chosen_desc)->box.min.v))
2954 lmin = efl_gfx_hint_size_restricted_min_get(ep->object); 3090 _edje_part_recalc_single_box(ep, chosen_desc, &minw, &minh);
2955 if (((Edje_Part_Description_Table *)chosen_desc)->table.min.h) 3091 break;
2956 { 3092 // or an image that also wants to do this
2957 if (lmin.w > minw) minw = lmin.w; 3093 case EDJE_PART_TYPE_IMAGE:
2958 }
2959 if (((Edje_Part_Description_Table *)chosen_desc)->table.min.v)
2960 {
2961 if (lmin.h > minh) minh = lmin.h;
2962 }
2963 }
2964 else if ((ep->part->type == EDJE_PART_TYPE_BOX) &&
2965 ((((Edje_Part_Description_Box *)chosen_desc)->box.min.h) ||
2966 (((Edje_Part_Description_Box *)chosen_desc)->box.min.v)))
2967 {
2968 Eina_Size2D lmin;
2969
2970 efl_canvas_group_need_recalculate_set(ep->object, 1);
2971 efl_canvas_group_calculate(ep->object);
2972 lmin = efl_gfx_hint_size_restricted_min_get(ep->object);
2973 if (((Edje_Part_Description_Box *)chosen_desc)->box.min.h)
2974 {
2975 if (lmin.w > minw) minw = lmin.w;
2976 }
2977 if (((Edje_Part_Description_Box *)chosen_desc)->box.min.v)
2978 {
2979 if (lmin.h > minh) minh = lmin.h;
2980 }
2981 }
2982 else if (ep->part->type == EDJE_PART_TYPE_IMAGE)
2983 {
2984 if (chosen_desc->min.limit || chosen_desc->max.limit) 3094 if (chosen_desc->min.limit || chosen_desc->max.limit)
2985 { 3095 _edje_part_recalc_single_image(ed, ep, chosen_desc, pos, &minw, &minh, &maxw, &maxh);
2986 Evas_Coord w, h; 3096 EINA_FALLTHROUGH;
2987 3097 case EDJE_PART_TYPE_PROXY:
2988 /* We only need pos to find the right image that would be displayed */ 3098 case EDJE_PART_TYPE_SNAPSHOT:
2989 /* Yes, if someone set aspect preference to SOURCE and also max,min 3099 // image. proxy, snapshot share this filter recalc, so fall through
2990 to SOURCE, it will be under efficient, but who cares at the
2991 moment. */
2992 _edje_real_part_image_set(ed, ep, NULL, pos);
2993 evas_object_image_size_get(ep->object, &w, &h);
2994
2995 if (chosen_desc->min.limit)
2996 {
2997 if (w > minw) minw = w;
2998 if (h > minh) minh = h;
2999 }
3000 if (chosen_desc->max.limit)
3001 {
3002 if ((maxw <= 0) || (w < maxw)) maxw = w;
3003 if ((maxh <= 0) || (h < maxh)) maxh = h;
3004 }
3005 }
3006 _edje_part_recalc_single_filter(ed, ep, desc, chosen_desc, pos);
3007 }
3008 else if (ep->part->type == EDJE_PART_TYPE_PROXY)
3009 {
3010 _edje_part_recalc_single_filter(ed, ep, desc, chosen_desc, pos);
3011 }
3012 else if (ep->part->type == EDJE_PART_TYPE_SNAPSHOT)
3013 {
3014 _edje_part_recalc_single_filter(ed, ep, desc, chosen_desc, pos); 3100 _edje_part_recalc_single_filter(ed, ep, desc, chosen_desc, pos);
3101 break;
3102 default:
3103 break;
3015 } 3104 }
3016 3105
3017 /* remember what our size is BEFORE we go limit it */ 3106 /* remember what our size is BEFORE we go limit it */
@@ -3044,34 +3133,8 @@ _edje_part_recalc_single(Edje *ed,
3044 _edje_part_recalc_single_fill(ep, &((Edje_Part_Description_Proxy *)desc)->proxy.fill, params); 3133 _edje_part_recalc_single_fill(ep, &((Edje_Part_Description_Proxy *)desc)->proxy.fill, params);
3045 3134
3046#ifdef HAVE_EPHYSICS 3135#ifdef HAVE_EPHYSICS
3047 if (ep->part->physics_body || ep->body) 3136 if (EINA_UNLIKELY(ep->part->physics_body || ep->body))
3048 { 3137 _edje_part_recalc_single_physics(params, desc);
3049 EINA_COW_CALC_PHYSICS_BEGIN(params, params_write)
3050 {
3051 params_write->mass = desc->physics.mass;
3052 params_write->restitution = desc->physics.restitution;
3053 params_write->friction = desc->physics.friction;
3054 params_write->damping.linear = desc->physics.damping.linear;
3055 params_write->damping.angular = desc->physics.damping.angular;
3056 params_write->sleep.linear = desc->physics.sleep.linear;
3057 params_write->sleep.angular = desc->physics.sleep.angular;
3058 params_write->material = desc->physics.material;
3059 params_write->density = desc->physics.density;
3060 params_write->hardness = desc->physics.hardness;
3061 params_write->ignore_part_pos = desc->physics.ignore_part_pos;
3062 params_write->light_on = desc->physics.light_on;
3063 params_write->mov_freedom.lin.x = desc->physics.mov_freedom.lin.x;
3064 params_write->mov_freedom.lin.y = desc->physics.mov_freedom.lin.y;
3065 params_write->mov_freedom.lin.z = desc->physics.mov_freedom.lin.z;
3066 params_write->mov_freedom.ang.x = desc->physics.mov_freedom.ang.x;
3067 params_write->mov_freedom.ang.y = desc->physics.mov_freedom.ang.y;
3068 params_write->mov_freedom.ang.z = desc->physics.mov_freedom.ang.z;
3069 params_write->backcull = desc->physics.backcull;
3070 params_write->z = desc->physics.z;
3071 params_write->depth = desc->physics.depth;
3072 }
3073 EINA_COW_CALC_PHYSICS_END(params, params_write);
3074 }
3075#endif 3138#endif
3076 _edje_part_recalc_single_map(ed, ep, center, zoom_center, light, persp, desc, chosen_desc, params); 3139 _edje_part_recalc_single_map(ed, ep, center, zoom_center, light, persp, desc, chosen_desc, params);
3077} 3140}