aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-09-07 08:22:07 (GMT)
committerJean-Philippe Andre <jp.andre@samsung.com>2015-10-01 11:10:54 (GMT)
commit6ac4f7154b7750b7c9765f74428e2ebcc83290d9 (patch)
treea0348c44d0c4d5e7976224fc61bc154acbe73c88
parentEdje tests: Add PROXY part to the filters test case (diff)
downloadefl-6ac4f7154b7750b7c9765f74428e2ebcc83290d9.tar.gz
Edje: Add filter support to SNAPSHOT parts
This makes SNAPSHOT a part type on it own, combining the common and filter subtypes. This means it is now possible to set an evas filter on a SNAPSHOT object, just like for TEXT, IMAGE and PROXY. @feature
-rw-r--r--src/bin/edje/edje_cc_handlers.c62
-rw-r--r--src/lib/edje/Edje_Common.h2
-rw-r--r--src/lib/edje/edje_cache.c2
-rw-r--r--src/lib/edje/edje_calc.c16
-rw-r--r--src/lib/edje/edje_data.c11
-rw-r--r--src/lib/edje/edje_private.h7
6 files changed, 84 insertions, 16 deletions
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c
index b4530c9..2ccedb1 100644
--- a/src/bin/edje/edje_cc_handlers.c
+++ b/src/bin/edje/edje_cc_handlers.c
@@ -1423,7 +1423,6 @@ _edje_part_description_alloc(unsigned char type, const char *collection, const c
case EDJE_PART_TYPE_RECTANGLE:
case EDJE_PART_TYPE_SWALLOW:
case EDJE_PART_TYPE_GROUP:
- case EDJE_PART_TYPE_SNAPSHOT:
result = mem_alloc(SZ(Edje_Part_Description_Common));
break;
case EDJE_PART_TYPE_TEXT:
@@ -1457,7 +1456,16 @@ _edje_part_description_alloc(unsigned char type, const char *collection, const c
result = &ed->common;
break;
- }
+ }
+ case EDJE_PART_TYPE_SNAPSHOT:
+ {
+ Edje_Part_Description_Snapshot *ed;
+
+ ed = mem_alloc(SZ(Edje_Part_Description_Snapshot));
+
+ result = &ed->common;
+ break;
+ }
case EDJE_PART_TYPE_PROXY:
{
Edje_Part_Description_Proxy *ed;
@@ -4921,12 +4929,12 @@ _part_desc_free(Edje_Part_Collection *pc,
case EDJE_PART_TYPE_RECTANGLE:
case EDJE_PART_TYPE_SWALLOW:
case EDJE_PART_TYPE_GROUP:
- case EDJE_PART_TYPE_SNAPSHOT:
/* Nothing todo, this part only have a common description. */
break;
case EDJE_PART_TYPE_BOX:
case EDJE_PART_TYPE_TABLE:
case EDJE_PART_TYPE_IMAGE:
+ case EDJE_PART_TYPE_SNAPSHOT:
/* Nothing todo here */
break;
case EDJE_PART_TYPE_TEXT:
@@ -7031,7 +7039,6 @@ st_collections_group_parts_part_description_inherit(void)
case EDJE_PART_TYPE_RECTANGLE:
case EDJE_PART_TYPE_SWALLOW:
case EDJE_PART_TYPE_GROUP:
- case EDJE_PART_TYPE_SNAPSHOT:
/* Nothing todo, this part only have a common description. */
break;
case EDJE_PART_TYPE_TEXT:
@@ -7090,12 +7097,12 @@ st_collections_group_parts_part_description_inherit(void)
}
/* Filters stuff */
- ied->filter.code = STRDUP(ied->filter.code);
+ ied->filter.code = STRDUP(iparent->filter.code);
if (ied->filter.code)
{
Eina_List *list, *l;
const char *name;
- list = ied->filter.sources;
+ list = iparent->filter.sources;
ied->filter.sources = NULL;
EINA_LIST_FOREACH(list, l, name)
ied->filter.sources = eina_list_append(ied->filter.sources, STRDUP(name));
@@ -7103,6 +7110,25 @@ st_collections_group_parts_part_description_inherit(void)
break;
}
+ case EDJE_PART_TYPE_SNAPSHOT:
+ {
+ Edje_Part_Description_Snapshot *sed = (Edje_Part_Description_Snapshot*) ed;
+ Edje_Part_Description_Snapshot *sparent = (Edje_Part_Description_Snapshot*) parent;
+
+ /* Filters stuff */
+ sed->filter.code = STRDUP(sparent->filter.code);
+ if (sed->filter.code)
+ {
+ Eina_List *list, *l;
+ const char *name;
+ list = sparent->filter.sources;
+ sed->filter.sources = NULL;
+ EINA_LIST_FOREACH(list, l, name)
+ sed->filter.sources = eina_list_append(sed->filter.sources, STRDUP(name));
+ }
+
+ break;
+ }
case EDJE_PART_TYPE_PROXY:
{
Edje_Part_Description_Proxy *ped = (Edje_Part_Description_Proxy*) ed;
@@ -7110,6 +7136,18 @@ st_collections_group_parts_part_description_inherit(void)
data_queue_copied_part_lookup(pc, &(pparent->proxy.id), &(ped->proxy.id));
+ /* Filters stuff */
+ ped->filter.code = STRDUP(pparent->filter.code);
+ if (ped->filter.code)
+ {
+ Eina_List *list, *l;
+ const char *name;
+ list = pparent->filter.sources;
+ ped->filter.sources = NULL;
+ EINA_LIST_FOREACH(list, l, name)
+ ped->filter.sources = eina_list_append(ped->filter.sources, STRDUP(name));
+ }
+
break;
}
case EDJE_PART_TYPE_BOX:
@@ -11913,9 +11951,11 @@ st_collections_group_parts_part_description_filter_code(void)
filter = &(((Edje_Part_Description_Image *)current_desc)->filter);
else if (current_part->type == EDJE_PART_TYPE_PROXY)
filter = &(((Edje_Part_Description_Proxy *)current_desc)->filter);
+ else if (current_part->type == EDJE_PART_TYPE_SNAPSHOT)
+ filter = &(((Edje_Part_Description_Snapshot *)current_desc)->filter);
else
{
- ERR("parse error %s:%i. filter only supported for: TEXT, IMAGE, PROXY.",
+ ERR("parse error %s:%i. filter only supported for: TEXT, IMAGE, PROXY, SNAPSHOT.",
file_in, line - 1);
exit(-1);
}
@@ -11956,9 +11996,11 @@ st_collections_group_parts_part_description_filter_source(void)
filter = &(((Edje_Part_Description_Image *)current_desc)->filter);
else if (current_part->type == EDJE_PART_TYPE_PROXY)
filter = &(((Edje_Part_Description_Proxy *)current_desc)->filter);
+ else if (current_part->type == EDJE_PART_TYPE_SNAPSHOT)
+ filter = &(((Edje_Part_Description_Snapshot *)current_desc)->filter);
else
{
- ERR("parse error %s:%i. filter set for non-TEXT and non-IMAGE part.",
+ ERR("parse error %s:%i. filter only supported for: TEXT, IMAGE, PROXY, SNAPSHOT.",
file_in, line - 1);
exit(-1);
}
@@ -12051,9 +12093,11 @@ st_collections_group_parts_part_description_filter_data(void)
filter = &(((Edje_Part_Description_Image *)current_desc)->filter);
else if (current_part->type == EDJE_PART_TYPE_PROXY)
filter = &(((Edje_Part_Description_Proxy *)current_desc)->filter);
+ else if (current_part->type == EDJE_PART_TYPE_SNAPSHOT)
+ filter = &(((Edje_Part_Description_Snapshot *)current_desc)->filter);
else
{
- ERR("parse error %s:%i. filter set for non-TEXT and non-IMAGE part.",
+ ERR("parse error %s:%i. filter only supported for: TEXT, IMAGE, PROXY, SNAPSHOT.",
file_in, line - 1);
exit(-1);
}
diff --git a/src/lib/edje/Edje_Common.h b/src/lib/edje/Edje_Common.h
index 8d03684..9d55b18 100644
--- a/src/lib/edje/Edje_Common.h
+++ b/src/lib/edje/Edje_Common.h
@@ -1235,7 +1235,7 @@ typedef enum _Edje_Part_Type
EDJE_PART_TYPE_MESH_NODE = 13,
EDJE_PART_TYPE_LIGHT = 14,
EDJE_PART_TYPE_CAMERA = 15,
- EDJE_PART_TYPE_SNAPSHOT = 16,
+ EDJE_PART_TYPE_SNAPSHOT = 16, /**< Snapshot @since 1.16 */
EDJE_PART_TYPE_LAST = 17 /**< Last type value */
} Edje_Part_Type;
/**
diff --git a/src/lib/edje/edje_cache.c b/src/lib/edje/edje_cache.c
index 7912d79..3806221 100644
--- a/src/lib/edje/edje_cache.c
+++ b/src/lib/edje/edje_cache.c
@@ -33,7 +33,7 @@ edje_cache_emp_alloc(Edje_Part_Collection_Directory_Entry *ce)
INIT_EMP_BOTH(TABLE, Edje_Part_Description_Table, ce);
INIT_EMP_BOTH(EXTERNAL, Edje_Part_Description_External, ce);
INIT_EMP_BOTH(SPACER, Edje_Part_Description_Common, ce);
- INIT_EMP_BOTH(SNAPSHOT, Edje_Part_Description_Common, ce);
+ INIT_EMP_BOTH(SNAPSHOT, Edje_Part_Description_Snapshot, ce);
INIT_EMP(part, Edje_Part, ce);
}
diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
index 2da8cb8..ac444f0 100644
--- a/src/lib/edje/edje_calc.c
+++ b/src/lib/edje/edje_calc.c
@@ -2460,7 +2460,7 @@ _edje_part_recalc_single_filter(Edje *ed,
Evas_Object *obj = ep->object;
Eina_List *li1, *li2;
- /* handle TEXT, IMAGE, PROXY part types here */
+ /* handle TEXT, IMAGE, PROXY, SNAPSHOT part types here */
if (ep->part->type == EDJE_PART_TYPE_TEXT)
{
Edje_Part_Description_Text *chosen_edt = (Edje_Part_Description_Text *) chosen_desc;
@@ -2485,6 +2485,14 @@ _edje_part_recalc_single_filter(Edje *ed,
prev_sources = edp->filter.sources;
filter_sources = chosen_edp->filter.sources;
}
+ else if (ep->part->type == EDJE_PART_TYPE_SNAPSHOT)
+ {
+ Edje_Part_Description_Snapshot *chosen_eds = (Edje_Part_Description_Snapshot *) chosen_desc;
+ Edje_Part_Description_Snapshot *eds = (Edje_Part_Description_Snapshot *) desc;
+ filter = &chosen_eds->filter;
+ prev_sources = eds->filter.sources;
+ filter_sources = chosen_eds->filter.sources;
+ }
else
{
CRI("Invalid call to filter recalc");
@@ -2777,6 +2785,7 @@ _edje_part_recalc_single(Edje *ed,
case EDJE_PART_TYPE_MESH_NODE:
case EDJE_PART_TYPE_LIGHT:
case EDJE_PART_TYPE_CAMERA:
+ case EDJE_PART_TYPE_SNAPSHOT:
break;
case EDJE_PART_TYPE_GRADIENT:
@@ -2864,6 +2873,10 @@ _edje_part_recalc_single(Edje *ed,
{
_edje_part_recalc_single_filter(ed, ep, desc, chosen_desc, pos);
}
+ else if (ep->part->type == EDJE_PART_TYPE_SNAPSHOT)
+ {
+ _edje_part_recalc_single_filter(ed, ep, desc, chosen_desc, pos);
+ }
/* remember what our size is BEFORE we go limit it */
params->req.x = TO_INT(params->eval.x);
@@ -3026,6 +3039,7 @@ _edje_proxy_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj
case EDJE_PART_TYPE_BOX:
case EDJE_PART_TYPE_TABLE:
case EDJE_PART_TYPE_PROXY:
+ case EDJE_PART_TYPE_SNAPSHOT:
evas_object_image_source_set(ep->object, pp->object);
break;
diff --git a/src/lib/edje/edje_data.c b/src/lib/edje/edje_data.c
index acad419..1dc890b 100644
--- a/src/lib/edje/edje_data.c
+++ b/src/lib/edje/edje_data.c
@@ -871,13 +871,16 @@ _edje_edd_init(void)
eet_data_descriptor_file_new(&eddc);
EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON(_edje_edd_edje_part_description_spacer, Edje_Part_Description_Common);
- EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Common);
+ // SNAPSHOT, since 1.16
+ EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Snapshot);
eddc.func.mem_free = mem_free_snapshot;
eddc.func.mem_alloc = mem_alloc_snapshot;
_edje_edd_edje_part_description_snapshot =
eet_data_descriptor_file_new(&eddc);
- EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON(_edje_edd_edje_part_description_snapshot, Edje_Part_Description_Common);
-
+ EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB(_edje_edd_edje_part_description_snapshot, Edje_Part_Description_Snapshot, common);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_snapshot, Edje_Part_Description_Snapshot, "filter.code", filter.code, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_LIST_STRING(_edje_edd_edje_part_description_snapshot, Edje_Part_Description_Snapshot, "filter.sources", filter.sources);
+ EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part_description_snapshot, Edje_Part_Description_Snapshot, "filter.data", filter.data, _edje_edd_edje_part_description_filter_data);
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Common);
eddc.func.mem_free = mem_free_swallow;
@@ -1135,7 +1138,7 @@ _edje_edd_init(void)
EDJE_DEFINE_POINTER_TYPE(Part_Description_Common, part_description_rectangle);
EDJE_DEFINE_POINTER_TYPE(Part_Description_Common, part_description_swallow);
EDJE_DEFINE_POINTER_TYPE(Part_Description_Common, part_description_group);
- EDJE_DEFINE_POINTER_TYPE(Part_Description_Common, part_description_snapshot);
+ EDJE_DEFINE_POINTER_TYPE(Part_Description_Snapshot, part_description_snapshot);
EDJE_DEFINE_POINTER_TYPE(Part_Description_Image, part_description_image);
EDJE_DEFINE_POINTER_TYPE(Part_Description_Proxy, part_description_proxy);
EDJE_DEFINE_POINTER_TYPE(Part_Description_Text, part_description_text);
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index a2b0582..87ecce4 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -350,6 +350,7 @@ typedef struct _Edje_Part_Description_External Edje_Part_Description_Exter
typedef struct _Edje_Part_Description_Mesh_Node Edje_Part_Description_Mesh_Node;
typedef struct _Edje_Part_Description_Light Edje_Part_Description_Light;
typedef struct _Edje_Part_Description_Camera Edje_Part_Description_Camera;
+typedef struct _Edje_Part_Description_Snapshot Edje_Part_Description_Snapshot;
typedef struct _Edje_Part_Description_Common Edje_Part_Description_Common;
typedef struct _Edje_Part_Description_Spec_Fill Edje_Part_Description_Spec_Fill;
typedef struct _Edje_Part_Description_Spec_Border Edje_Part_Description_Spec_Border;
@@ -1505,6 +1506,12 @@ struct _Edje_Part_Description_Proxy
Edje_Part_Description_Spec_Filter filter;
};
+struct _Edje_Part_Description_Snapshot
+{
+ Edje_Part_Description_Common common;
+ Edje_Part_Description_Spec_Filter filter;
+};
+
struct _Edje_Part_Description_Text
{
Edje_Part_Description_Common common;