aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-04-28 18:56:02 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-06-15 16:59:41 +0900
commit75ec3a7338c9c2406d4765a4cc8247f72d6bec7b (patch)
tree2ce20dfa89b036f5d5326eadb4d9026da27f8309
parenteina: add test cases for various eina_matrix operations (diff)
downloadefl-75ec3a7338c9c2406d4765a4cc8247f72d6bec7b.tar.gz
Edje: Add clip as a property of a part description
Since masking, for performance and themeing reasons, it becomes interesting to be able to switch clippers on the fly. In particular, switching from an IMAGE mask to a standard RECT clipper can save a lot of power when masking is not required. This new flag "description.clip_to" will behave a bit like a mix of rel.to and visible: - It points to a part by name, just like part.clip_to. This will override the clipper set by the part, or override the default clipper. - Like "visible", it can not be interpolated between two values, so it will switch only at the end of a transition. - By default there is no clip override, which means Edje will fallback to the part's clipper, if any, or the base (group's) clipper. NOTE: - Since a clipper that does not clip anything becomes a standard object, it is visible and rendered. This will in 99.999% cases not be the intended behaviour. Currently we can simply use a transparent RECT in order to always have something clipped by the clipper, but this is a hack and this will trigger rendering of masks in their surfaces even when they are not actually used. Ideally, there should be a flag indicating to Edje & Evas that an object should be considered a clipper in all situations, and never be rendered on screen. TODO: - Support Edje Edit - Add Embryo & Lua functions - Add support in edje_convert - Add Edje/Evas flag to mark objects as "no_render" @feature
-rw-r--r--src/bin/edje/edje_cc_handlers.c33
-rwxr-xr-xsrc/bin/edje/edje_cc_out.c17
-rw-r--r--src/lib/edje/edje_calc.c63
-rw-r--r--src/lib/edje/edje_data.c38
-rw-r--r--src/lib/edje/edje_edit.c18
-rw-r--r--src/lib/edje/edje_load.c24
-rw-r--r--src/lib/edje/edje_private.h3
7 files changed, 152 insertions, 44 deletions
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c
index 1cb5b6ef10..b371aec5ca 100644
--- a/src/bin/edje/edje_cc_handlers.c
+++ b/src/bin/edje/edje_cc_handlers.c
@@ -326,6 +326,7 @@ static void st_collections_group_parts_part_description_rel2_to_set(const char *
static void st_collections_group_parts_part_description_rel2_to(void);
static void st_collections_group_parts_part_description_rel2_to_x(void);
static void st_collections_group_parts_part_description_rel2_to_y(void);
+static void st_collections_group_parts_part_description_clip_to_id(void);
static void st_collections_group_parts_part_description_image_normal(void);
static void st_collections_group_parts_part_description_image_tween(void);
static void st_collections_group_parts_part_description_image_border(void);
@@ -771,6 +772,7 @@ New_Statement_Handler statement_handlers[] =
{"collections.group.parts.part.description.rel2.to", st_collections_group_parts_part_description_rel2_to},
{"collections.group.parts.part.description.rel2.to_x", st_collections_group_parts_part_description_rel2_to_x},
{"collections.group.parts.part.description.rel2.to_y", st_collections_group_parts_part_description_rel2_to_y},
+ {"collections.group.parts.part.description.clip_to", st_collections_group_parts_part_description_clip_to_id},
{"collections.group.parts.part.description.image.normal", st_collections_group_parts_part_description_image_normal},
{"collections.group.parts.part.description.image.tween", st_collections_group_parts_part_description_image_tween},
IMAGE_SET_STATEMENTS("collections.group.parts.part.description.image")
@@ -1496,6 +1498,7 @@ _edje_part_description_alloc(unsigned char type, const char *collection, const c
result->physics.depth = 30;
#endif
+ result->clip_to_id = -1;
return result;
}
@@ -4581,6 +4584,7 @@ _part_desc_free(Edje_Part_Collection *pc,
part_lookup_del(pc, &(ed->rel1.id_y));
part_lookup_del(pc, &(ed->rel2.id_x));
part_lookup_del(pc, &(ed->rel2.id_y));
+ part_lookup_del(pc, &(ed->clip_to_id));
part_lookup_del(pc, &(ed->map.id_persp));
part_lookup_del(pc, &(ed->map.id_light));
part_lookup_del(pc, &(ed->map.rot.id_center));
@@ -5381,11 +5385,11 @@ st_collections_group_parts_part_clip_to_id(void)
pc = eina_list_data_get(eina_list_last(edje_collections));
{
- char *name;
+ char *name;
- name = parse_str(0);
- data_queue_part_lookup(pc, name, &(current_part->clip_to_id));
- free(name);
+ name = parse_str(0);
+ data_queue_part_lookup(pc, name, &(current_part->clip_to_id));
+ free(name);
}
}
@@ -6397,6 +6401,7 @@ _copied_map_colors_get(Edje_Part_Description_Common *parent)
fixed: 0 0;
step: 0 0;
aspect: 1 1;
+ clip_to: "clip_override_part_name";
rel1 {
..
@@ -6428,6 +6433,7 @@ ob_collections_group_parts_part_description(void)
ed->rel1.id_y = -1;
ed->rel2.id_x = -1;
ed->rel2.id_y = -1;
+ ed->clip_to_id = -1;
if (!ep->default_desc)
{
@@ -6628,6 +6634,8 @@ st_collections_group_parts_part_description_inherit(void)
data_queue_copied_part_lookup(pc, &parent->rel2.id_x, &ed->rel2.id_x);
data_queue_copied_part_lookup(pc, &parent->rel2.id_y, &ed->rel2.id_y);
+ data_queue_copied_part_lookup(pc, &parent->clip_to_id, &ed->clip_to_id);
+
data_queue_copied_part_lookup(pc, &parent->map.id_persp, &ed->map.id_persp);
data_queue_copied_part_lookup(pc, &parent->map.id_light, &ed->map.id_light);
data_queue_copied_part_lookup(pc, &parent->map.rot.id_center, &ed->map.rot.id_center);
@@ -7625,6 +7633,23 @@ st_collections_group_parts_part_description_rel2_to_y(void)
}
}
+static void
+st_collections_group_parts_part_description_clip_to_id(void)
+{
+ Edje_Part_Collection *pc;
+
+ check_arg_count(1);
+
+ pc = eina_list_data_get(eina_list_last(edje_collections));
+ {
+ char *name;
+
+ name = parse_str(0);
+ data_queue_part_lookup(pc, name, &(current_desc->clip_to_id));
+ free(name);
+ }
+}
+
/** @edcsubsection{collections_group_parts_description_image,
* Group.Parts.Part.Description.Image} */
diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c
index 485aa8c0dc..78d3fab431 100755
--- a/src/bin/edje/edje_cc_out.c
+++ b/src/bin/edje/edje_cc_out.c
@@ -465,6 +465,19 @@ check_nameless_state(Edje_Part_Collection *pc, Edje_Part *ep, Edje_Part_Descript
}
static void
+check_state(Edje_Part_Collection *pc, Edje_Part *ep, Edje_Part_Description_Common *ed, Eet_File *ef)
+{
+ /* FIXME: When smart masks are supported, remove this check */
+ if (ed->clip_to_id != -1 &&
+ (pc->parts[ed->clip_to_id]->type != EDJE_PART_TYPE_RECTANGLE) &&
+ (pc->parts[ed->clip_to_id]->type != EDJE_PART_TYPE_IMAGE))
+ error_and_abort(ef, "Collection %i: description.clip_to point to a non RECT/IMAGE part '%s' !",
+ pc->id, pc->parts[ed->clip_to_id]->name);
+
+ check_nameless_state(pc, ep, ed, ef);
+}
+
+static void
check_part(Edje_Part_Collection *pc, Edje_Part *ep, Eet_File *ef)
{
unsigned int i;
@@ -475,7 +488,7 @@ check_part(Edje_Part_Collection *pc, Edje_Part *ep, Eet_File *ef)
"for part \"%s\"", pc->id, ep->name);
for (i = 0; i < ep->other.desc_count; ++i)
- check_nameless_state(pc, ep, ep->other.desc[i], ef);
+ check_state(pc, ep, ep->other.desc[i], ef);
if (ep->type == EDJE_PART_TYPE_IMAGE)
{
@@ -490,7 +503,7 @@ check_part(Edje_Part_Collection *pc, Edje_Part *ep, Eet_File *ef)
else if (ep->type == EDJE_PART_TYPE_GROUP)
check_source_links(pc, ep, ef, group_path);
- /* FIXME: When mask are supported remove this check */
+ /* FIXME: When smart masks are supported, remove this check */
if (ep->clip_to_id != -1 &&
(pc->parts[ep->clip_to_id]->type != EDJE_PART_TYPE_RECTANGLE) &&
(pc->parts[ep->clip_to_id]->type != EDJE_PART_TYPE_IMAGE))
diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
index f6627152ed..f213d85eef 100644
--- a/src/lib/edje/edje_calc.c
+++ b/src/lib/edje/edje_calc.c
@@ -8,6 +8,7 @@ static void _edje_part_recalc_single(Edje *ed, Edje_Rea
Edje_Real_Part *center, Edje_Real_Part *light, Edje_Real_Part *persp,
Edje_Real_Part *rel1_to_x, Edje_Real_Part *rel1_to_y,
Edje_Real_Part *rel2_to_x, Edje_Real_Part *rel2_to_y,
+ Edje_Real_Part *clip_to,
Edje_Real_Part *confine_to, Edje_Real_Part *threshold,
Edje_Calc_Params *params,
Evas_Coord mmw, Evas_Coord mmh,
@@ -746,7 +747,7 @@ _edje_recalc_do(Edje *ed)
Edje_Real_Part *ep;
ep = ed->table_parts[i];
- ep->calculated = FLAG_NONE;
+ ep->calculated = FLAG_NONE; // FIXME: this is dubious (see below)
ep->calculating = FLAG_NONE;
}
for (i = 0; i < ed->table_parts_size; i++)
@@ -754,7 +755,7 @@ _edje_recalc_do(Edje *ed)
Edje_Real_Part *ep;
ep = ed->table_parts[i];
- if (ep->calculated != FLAG_XY)
+ if (ep->calculated != FLAG_XY) // FIXME: this is always true (see for above)
_edje_part_recalc(ed, ep, (~ep->calculated) & FLAG_XY, NULL);
}
if (!ed->calc_only) ed->recalc = EINA_FALSE;
@@ -2346,6 +2347,7 @@ _edje_part_recalc_single(Edje *ed,
Edje_Real_Part *rel1_to_y,
Edje_Real_Part *rel2_to_x,
Edje_Real_Part *rel2_to_y,
+ Edje_Real_Part *clip_to,
Edje_Real_Part *confine_to,
Edje_Real_Part *threshold,
Edje_Calc_Params *params,
@@ -2397,6 +2399,9 @@ _edje_part_recalc_single(Edje *ed,
/* visible */
params->visible = desc->visible;
+ /* clip override */
+ params->clip_to = clip_to;
+
/* set parameters, some are required for recalc_single_text[block] */
switch (ep->part->type)
{
@@ -3232,11 +3237,13 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
int statel2 = -1;
int statep1 = -1;
int statep2 = -1;
+ int statecl = -1;
Edje_Real_Part *center[2] = { NULL, NULL };
Edje_Real_Part *light[2] = { NULL, NULL };
Edje_Real_Part *persp[2] = { NULL, NULL };
Edje_Real_Part *rp1[4] = { NULL, NULL, NULL, NULL };
Edje_Real_Part *rp2[4] = { NULL, NULL, NULL, NULL };
+ Edje_Real_Part *clip1 = NULL, *clip2 = NULL;
Edje_Calc_Params *p1, *pf;
Edje_Part_Description_Common *chosen_desc;
Edje_Real_Part *confine_to = NULL;
@@ -3344,6 +3351,8 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
rp1[Rel1Y] = ed->table_parts[ep->param1.description->rel1.id_y];
if (ep->param1.description->rel2.id_y >= 0)
rp1[Rel2Y] = ed->table_parts[ep->param1.description->rel2.id_y];
+ if (ep->param1.description->clip_to_id >= 0)
+ clip1 = ed->table_parts[ep->param1.description->clip_to_id % ed->table_parts_size];
}
if (ep->param2)
{
@@ -3355,6 +3364,8 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
rp2[Rel1Y] = ed->table_parts[ep->param2->description->rel1.id_y];
if (ep->param2->description->rel2.id_y >= 0)
rp2[Rel2Y] = ed->table_parts[ep->param2->description->rel2.id_y];
+ if (ep->param2->description->clip_to_id >= 0)
+ clip2 = ed->table_parts[ep->param2->description->clip_to_id % ed->table_parts_size];
}
if (flags & FLAG_X)
@@ -3433,6 +3444,17 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
}
}
}
+ if (clip1)
+ {
+ _edje_part_recalc(ed, clip1, flags, NULL);
+ statecl = clip1->state;
+ }
+ if (clip2)
+ {
+ _edje_part_recalc(ed, clip2, flags, NULL);
+ if (statecl < clip2->state)
+ statecl = clip2->state;
+ }
if (ep->drag)
{
if (ep->drag->confine_to)
@@ -3530,6 +3552,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
(statec1 >= ep->param1.state) ||
(statel1 >= ep->param1.state) ||
(statep1 >= ep->param1.state) ||
+ (statecl >= ep->param1.state) ||
proxy_invalidate ||
state ||
ed->need_map_update ||
@@ -3541,7 +3564,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
_edje_part_recalc_single(ed, ep, ep->param1.description,
chosen_desc, center[0], light[0],
persp[0], rp1[Rel1X], rp1[Rel1Y],
- rp1[Rel2X], rp1[Rel2Y], confine_to,
+ rp1[Rel2X], rp1[Rel2Y], clip1, confine_to,
threshold, p1, mmw, mmh,
pos);
#ifdef EDJE_CALC_CACHE
@@ -3598,6 +3621,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
(statec2 >= ep->param2->state) ||
(statel2 >= ep->param2->state) ||
(statep2 >= ep->param2->state) ||
+ (statecl >= ep->param2->state) ||
proxy_invalidate ||
state ||
ed->need_map_update ||
@@ -3609,7 +3633,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
_edje_part_recalc_single(ed, ep, ep->param2->description,
chosen_desc, center[1], light[1],
persp[1], rp2[Rel1X], rp2[Rel1Y],
- rp2[Rel2X], rp2[Rel2Y], confine_to,
+ rp2[Rel2X], rp2[Rel2Y], clip2, confine_to,
threshold, p2, mmw, mmh,
pos);
#ifdef EDJE_CALC_CACHE
@@ -3632,6 +3656,16 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
else
p3->visible = p1->visible;
+ /* clip_to will behave a bit like visible */
+ if (pos == ZERO)
+ p3->clip_to = p1->clip_to;
+ else if (pos == FROM_INT(1))
+ p3->clip_to = p2->clip_to;
+ else if (!p1->clip_to)
+ p3->clip_to = p2->clip_to;
+ else
+ p3->clip_to = p1->clip_to;
+
p3->smooth = (beginning_pos) ? p1->smooth : p2->smooth;
/* FIXME: do x and y separately base on flag */
@@ -4015,12 +4049,20 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
if (ep->nested_smart) /* Move, Resize all nested parts */
{ /* Not really needed but will improve the bounding box evaluation done by Evas */
- eo_do(ep->nested_smart,
- efl_gfx_position_set(ed->x + pf->final.x, ed->y + pf->final.y),
- efl_gfx_size_set(pf->final.w, pf->final.h));
+ eo_do(ep->nested_smart,
+ efl_gfx_position_set(ed->x + pf->final.x, ed->y + pf->final.y),
+ efl_gfx_size_set(pf->final.w, pf->final.h));
}
if (ep->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
_edje_entry_real_part_configure(ed, ep);
+
+ /* handle clip overrides */
+ if (pf->clip_to && pf->clip_to->object)
+ evas_object_clip_set(ep->object, pf->clip_to->object);
+ else if (ep->part->clip_to_id >= 0)
+ evas_object_clip_set(ep->object, ed->table_parts[ep->part->clip_to_id % ed->table_parts_size]->object);
+ else
+ evas_object_clip_set(ep->object, ed->base->clipper);
break;
case EDJE_PART_TYPE_TEXT:
@@ -4085,6 +4127,13 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
(ep->typedata.swallow)) &&
(ep->typedata.swallow->swallowed_object))
{
+ if (pf->clip_to && pf->clip_to->object)
+ evas_object_clip_set(ep->typedata.swallow->swallowed_object, pf->clip_to->object);
+ else if (ep->part->clip_to_id >= 0)
+ evas_object_clip_set(ep->typedata.swallow->swallowed_object, ed->table_parts[ep->part->clip_to_id % ed->table_parts_size]->object);
+ else
+ evas_object_clip_set(ep->typedata.swallow->swallowed_object, ed->base->clipper);
+
if (pf->visible)
{
Eina_Bool vis = EINA_TRUE;
diff --git a/src/lib/edje/edje_data.c b/src/lib/edje/edje_data.c
index d0eae225e7..d81ad241ff 100644
--- a/src/lib/edje/edje_data.c
+++ b/src/lib/edje/edje_data.c
@@ -75,16 +75,21 @@ Eet_Data_Descriptor *_edje_edd_edje_physics_face = NULL;
Eet_Data_Descriptor *_edje_edd_edje_map_colors = NULL;
Eet_Data_Descriptor *_edje_edd_edje_map_colors_pointer = NULL;
+/* allocate a description struct.
+ * this initializes clip_to_id as this field will not be present in most
+ * edje files.
+ */
#define EMP(Type, Minus) \
EAPI Eina_Mempool *_emp_##Type = NULL; \
\
static void * \
mem_alloc_##Minus(size_t size) \
{ \
- void *data; \
+ Edje_Part_Description_Common *data; \
\
data = eina_mempool_malloc(_emp_##Type, size); \
memset(data, 0, size); \
+ data->clip_to_id = -1; \
return data; \
} \
\
@@ -94,20 +99,21 @@ Eet_Data_Descriptor *_edje_edd_edje_map_colors_pointer = NULL;
eina_mempool_free(_emp_##Type, data); \
}
-EMP(RECTANGLE, rectangle);
-EMP(TEXT, text);
-EMP(IMAGE, image);
-EMP(PROXY, proxy);
-EMP(SWALLOW, swallow);
-EMP(TEXTBLOCK, textblock);
-EMP(GROUP, group);
-EMP(BOX, box);
-EMP(TABLE, table);
-EMP(EXTERNAL, external);
-EMP(SPACER, spacer);
-EMP(MESH_NODE, mesh_node);
-EMP(LIGHT, light);
-EMP(CAMERA, camera);
+EMP(RECTANGLE, rectangle)
+EMP(TEXT, text)
+EMP(IMAGE, image)
+EMP(PROXY, proxy)
+EMP(SWALLOW, swallow)
+EMP(TEXTBLOCK, textblock)
+EMP(GROUP, group)
+EMP(BOX, box)
+EMP(TABLE, table)
+EMP(EXTERNAL, external)
+EMP(SPACER, spacer)
+EMP(MESH_NODE, mesh_node)
+EMP(LIGHT, light)
+EMP(CAMERA, camera)
+#undef EMP
EAPI Eina_Mempool *_emp_part = NULL;
@@ -661,6 +667,7 @@ _edje_edd_init(void)
EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.offset_y", rel2.offset_y, EET_T_INT); \
EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.id_x", rel2.id_x, EET_T_INT); \
EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.id_y", rel2.id_y, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "clip_to_id", clip_to_id, EET_T_INT); \
EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color_class", color_class, EET_T_STRING); \
EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.r", color.r, EET_T_UCHAR); \
EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.g", color.g, EET_T_UCHAR); \
@@ -751,6 +758,7 @@ _edje_edd_init(void)
EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.offset_y", Dec.rel2.offset_y, EET_T_INT); \
EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.id_x", Dec.rel2.id_x, EET_T_INT); \
EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.id_y", Dec.rel2.id_y, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "clip_to_id", Dec.clip_to_id, EET_T_INT); \
EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color_class", Dec.color_class, EET_T_STRING); \
EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.r", Dec.color.r, EET_T_UCHAR); \
EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.g", Dec.color.g, EET_T_UCHAR); \
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index 73d7777a66..4e6b94f98d 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -532,6 +532,7 @@ _edje_part_description_id_set(int type, Edje_Part_Description_Common *c, int old
if (c->rel1.id_y == old_id) c->rel1.id_y = new_id;
if (c->rel2.id_x == old_id) c->rel2.id_x = new_id;
if (c->rel2.id_y == old_id) c->rel2.id_y = new_id;
+ if (c->clip_to_id == old_id) c->clip_to_id = new_id;
if (type == EDJE_PART_TYPE_TEXT
|| type == EDJE_PART_TYPE_TEXTBLOCK)
@@ -630,18 +631,26 @@ _edje_part_id_set(Edje *ed, Edje_Real_Part *rp, int new_id)
static void
_edje_part_description_id_switch(int type, Edje_Part_Description_Common *c, int id1, int id2)
{
- if (c->rel1.id_x == id1) c->rel1.id_x = id2;
+ if (c->rel1.id_x == id1)
+ c->rel1.id_x = id2;
else if (c->rel1.id_x == id2)
c->rel1.id_x = id1;
- if (c->rel1.id_y == id1) c->rel1.id_y = id2;
+ if (c->rel1.id_y == id1)
+ c->rel1.id_y = id2;
else if (c->rel1.id_y == id2)
c->rel1.id_y = id1;
- if (c->rel2.id_x == id1) c->rel2.id_x = id2;
+ if (c->rel2.id_x == id1)
+ c->rel2.id_x = id2;
else if (c->rel2.id_x == id2)
c->rel2.id_x = id1;
- if (c->rel2.id_y == id1) c->rel2.id_y = id2;
+ if (c->rel2.id_y == id1)
+ c->rel2.id_y = id2;
else if (c->rel2.id_y == id2)
c->rel2.id_y = id1;
+ if (c->clip_to_id == id1)
+ c->clip_to_id = id2;
+ else if (c->clip_to_id == id2)
+ c->clip_to_id = id1;
if (type == EDJE_PART_TYPE_TEXT
|| type == EDJE_PART_TYPE_TEXTBLOCK)
@@ -5262,6 +5271,7 @@ edje_edit_state_add(Evas_Object *obj, const char *part, const char *name, double
pd->rel2.offset_y = -1;
pd->rel2.id_x = -1;
pd->rel2.id_y = -1;
+ pd->clip_to_id = -1;
pd->color_class = NULL;
pd->color.r = 255;
pd->color.g = 255;
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index 0457c8157e..5839e6dc03 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -846,6 +846,8 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
}
for (i = 0; i < ed->table_parts_size; i++)
{
+ Edje_Real_Part *clip_to = NULL;
+
rp = ed->table_parts[i];
if (rp->param1.description) /* FIXME: prevent rel to gone radient part to go wrong. You may
be able to remove this when all theme are correctly rewritten. */
@@ -859,20 +861,18 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
if (rp->param1.description->rel2.id_y >= 0)
rp->param1.description->rel2.id_y %= ed->table_parts_size;
}
- if (rp->part->clip_to_id >= 0)
- {
- Edje_Real_Part *clip_to;
- clip_to = ed->table_parts[rp->part->clip_to_id % ed->table_parts_size];
- if (clip_to &&
- clip_to->object &&
- rp->object)
- {
- evas_object_pass_events_set(clip_to->object, 1);
- evas_object_pointer_mode_set(clip_to->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
- evas_object_clip_set(rp->object, clip_to->object);
- }
+ if (rp->param1.description && (rp->param1.description->clip_to_id >= 0))
+ clip_to = ed->table_parts[rp->param1.description->clip_to_id % ed->table_parts_size];
+ else if (rp->part->clip_to_id >= 0)
+ clip_to = ed->table_parts[rp->part->clip_to_id % ed->table_parts_size];
+ if (clip_to && clip_to->object && rp->object)
+ {
+ evas_object_pass_events_set(clip_to->object, 1);
+ evas_object_pointer_mode_set(clip_to->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
+ evas_object_clip_set(rp->object, clip_to->object);
}
+
if (rp->drag)
{
if (rp->part->dragable.confine_id >= 0)
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index 3b41699627..ee28bba0c8 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -1174,6 +1174,8 @@ struct _Edje_Part_Description_Common
Edje_Color color;
Edje_Color color2;
+ int clip_to_id; /* state clip override @since 1.15 */
+
struct {
FLOAT_T relative_x;
FLOAT_T relative_y;
@@ -1715,6 +1717,7 @@ struct _Edje_Calc_Params
#ifdef HAVE_EPHYSICS
const Edje_Calc_Params_Physics *physics; // 90
#endif
+ Edje_Real_Part *clip_to; /* state clip override @since 1.15 */
unsigned char persp_on : 1;
unsigned char lighted : 1;
unsigned char mapped : 1;