summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-05-12 17:37:01 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-06-15 16:59:41 +0900
commit111e51a6ff35c3bf4dc835775b44b630e0191ba1 (patch)
tree92eb947706f0b9a6d3fafc05b98faebb690e7d0b
parent75ec3a7338c9c2406d4765a4cc8247f72d6bec7b (diff)
Evas: Add "no-render" flag for proxy sources & clippers
Those objects should never be rendered on the canvas, even if they are visible. On the other hand, they need to be rendered in mask or proxy surfaces. note: this patch includes some extra whitespaces changes :( @feature
-rw-r--r--src/bin/edje/edje_cc_handlers.c27
-rwxr-xr-xsrc/bin/edje/edje_cc_out.c10
-rw-r--r--src/lib/edje/edje_data.c1
-rw-r--r--src/lib/edje/edje_load.c3
-rw-r--r--src/lib/edje/edje_private.h1
-rw-r--r--src/lib/evas/canvas/evas_clip.c11
-rw-r--r--src/lib/evas/canvas/evas_object.eo35
-rw-r--r--src/lib/evas/canvas/evas_render.c21
-rw-r--r--src/lib/evas/include/evas_inline.x2
-rw-r--r--src/lib/evas/include/evas_private.h1
10 files changed, 97 insertions, 15 deletions
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c
index b371aec5ca..d9ddbd3898 100644
--- a/src/bin/edje/edje_cc_handlers.c
+++ b/src/bin/edje/edje_cc_handlers.c
@@ -258,6 +258,7 @@ static void st_collections_group_parts_part_pointer_mode(void);
258static void st_collections_group_parts_part_precise_is_inside(void); 258static void st_collections_group_parts_part_precise_is_inside(void);
259static void st_collections_group_parts_part_use_alternate_font_metrics(void); 259static void st_collections_group_parts_part_use_alternate_font_metrics(void);
260static void st_collections_group_parts_part_clip_to_id(void); 260static void st_collections_group_parts_part_clip_to_id(void);
261static void st_collections_group_parts_part_no_render(void);
261static void st_collections_group_parts_part_source(void); 262static void st_collections_group_parts_part_source(void);
262static void st_collections_group_parts_part_source2(void); 263static void st_collections_group_parts_part_source2(void);
263static void st_collections_group_parts_part_source3(void); 264static void st_collections_group_parts_part_source3(void);
@@ -693,6 +694,7 @@ New_Statement_Handler statement_handlers[] =
693 {"collections.group.parts.part.precise_is_inside", st_collections_group_parts_part_precise_is_inside}, 694 {"collections.group.parts.part.precise_is_inside", st_collections_group_parts_part_precise_is_inside},
694 {"collections.group.parts.part.use_alternate_font_metrics", st_collections_group_parts_part_use_alternate_font_metrics}, 695 {"collections.group.parts.part.use_alternate_font_metrics", st_collections_group_parts_part_use_alternate_font_metrics},
695 {"collections.group.parts.part.clip_to", st_collections_group_parts_part_clip_to_id}, 696 {"collections.group.parts.part.clip_to", st_collections_group_parts_part_clip_to_id},
697 {"collections.group.parts.part.no_render", st_collections_group_parts_part_no_render},
696 {"collections.group.parts.part.source", st_collections_group_parts_part_source}, 698 {"collections.group.parts.part.source", st_collections_group_parts_part_source},
697 {"collections.group.parts.part.source2", st_collections_group_parts_part_source2}, 699 {"collections.group.parts.part.source2", st_collections_group_parts_part_source2},
698 {"collections.group.parts.part.source3", st_collections_group_parts_part_source3}, 700 {"collections.group.parts.part.source3", st_collections_group_parts_part_source3},
@@ -4417,6 +4419,7 @@ st_collections_group_parts_alias(void)
4417 source: "groupname"; 4419 source: "groupname";
4418 pointer_mode: AUTOGRAB; 4420 pointer_mode: AUTOGRAB;
4419 use_alternate_font_metrics: 0; 4421 use_alternate_font_metrics: 0;
4422 no_render: 0;
4420 4423
4421 dragable { } 4424 dragable { }
4422 items { } 4425 items { }
@@ -4469,6 +4472,7 @@ edje_cc_handlers_part_make(int id)
4469 ep->use_alternate_font_metrics = 0; 4472 ep->use_alternate_font_metrics = 0;
4470 ep->access = 0; 4473 ep->access = 0;
4471 ep->clip_to_id = -1; 4474 ep->clip_to_id = -1;
4475 ep->no_render = 0;
4472 ep->dragable.confine_id = -1; 4476 ep->dragable.confine_id = -1;
4473 ep->dragable.threshold_id = -1; 4477 ep->dragable.threshold_id = -1;
4474 ep->dragable.event_id = -1; 4478 ep->dragable.event_id = -1;
@@ -5396,6 +5400,29 @@ st_collections_group_parts_part_clip_to_id(void)
5396/** 5400/**
5397 @page edcref 5401 @page edcref
5398 @property 5402 @property
5403 no_render
5404 @parameters
5405 [1 or 0]
5406 @effect
5407 Setting the no_render flag on an object will make it never render
5408 directly on the canvas, regardless of the visible and color properties.
5409 But the object will still be rendered in a dedicated surface when
5410 required if it is a proxy source or a mask (clipper).
5411 Strongly recommended for use with mask objects and proxy sources
5412 (instead of setting "source_visible" on the proxy itself).
5413 @endproperty
5414*/
5415static void
5416st_collections_group_parts_part_no_render(void)
5417{
5418 check_arg_count(1);
5419
5420 current_part->no_render = parse_bool(0);
5421}
5422
5423/**
5424 @page edcref
5425 @property
5399 source 5426 source
5400 @parameters 5427 @parameters
5401 [another group's name] 5428 [another group's name]
diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c
index 78d3fab431..be534aab5f 100755
--- a/src/bin/edje/edje_cc_out.c
+++ b/src/bin/edje/edje_cc_out.c
@@ -485,20 +485,20 @@ check_part(Edje_Part_Collection *pc, Edje_Part *ep, Eet_File *ef)
485 /* FIXME: check image set and sort them. */ 485 /* FIXME: check image set and sort them. */
486 if (!ep->default_desc) 486 if (!ep->default_desc)
487 error_and_abort(ef, "Collection %i: default description missing " 487 error_and_abort(ef, "Collection %i: default description missing "
488 "for part \"%s\"", pc->id, ep->name); 488 "for part \"%s\"", pc->id, ep->name);
489 489
490 for (i = 0; i < ep->other.desc_count; ++i) 490 for (i = 0; i < ep->other.desc_count; ++i)
491 check_state(pc, ep, ep->other.desc[i], ef); 491 check_state(pc, ep, ep->other.desc[i], ef);
492 492
493 if (ep->type == EDJE_PART_TYPE_IMAGE) 493 if (ep->type == EDJE_PART_TYPE_IMAGE)
494 { 494 {
495 check_image_part_desc(pc, ep, (Edje_Part_Description_Image*) ep->default_desc, ef); 495 check_image_part_desc(pc, ep, (Edje_Part_Description_Image*) ep->default_desc, ef);
496 496
497 for (i = 0; i < ep->other.desc_count; ++i) 497 for (i = 0; i < ep->other.desc_count; ++i)
498 check_image_part_desc (pc, ep, (Edje_Part_Description_Image*) ep->other.desc[i], ef); 498 check_image_part_desc(pc, ep, (Edje_Part_Description_Image*) ep->other.desc[i], ef);
499 } 499 }
500 else if ((ep->type == EDJE_PART_TYPE_BOX) || 500 else if ((ep->type == EDJE_PART_TYPE_BOX) ||
501 (ep->type == EDJE_PART_TYPE_TABLE)) 501 (ep->type == EDJE_PART_TYPE_TABLE))
502 check_packed_items(pc, ep, ef); 502 check_packed_items(pc, ep, ef);
503 else if (ep->type == EDJE_PART_TYPE_GROUP) 503 else if (ep->type == EDJE_PART_TYPE_GROUP)
504 check_source_links(pc, ep, ef, group_path); 504 check_source_links(pc, ep, ef, group_path);
diff --git a/src/lib/edje/edje_data.c b/src/lib/edje/edje_data.c
index d81ad241ff..2352e8541f 100644
--- a/src/lib/edje/edje_data.c
+++ b/src/lib/edje/edje_data.c
@@ -1197,6 +1197,7 @@ _edje_edd_init(void)
1197 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source6", source6, EET_T_STRING); 1197 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source6", source6, EET_T_STRING);
1198 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "id", id, EET_T_INT); 1198 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "id", id, EET_T_INT);
1199 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "clip_to_id", clip_to_id, EET_T_INT); 1199 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "clip_to_id", clip_to_id, EET_T_INT);
1200 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "no_render", no_render, EET_T_UCHAR);
1200 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.x", dragable.x, EET_T_CHAR); 1201 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.x", dragable.x, EET_T_CHAR);
1201 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.step_x", dragable.step_x, EET_T_INT); 1202 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.step_x", dragable.step_x, EET_T_INT);
1202 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.count_x", dragable.count_x, EET_T_INT); 1203 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.count_x", dragable.count_x, EET_T_INT);
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index 5839e6dc03..e9c4f20441 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -774,6 +774,9 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
774 nested_smart = NULL; 774 nested_smart = NULL;
775 } 775 }
776 776
777 if (ep->no_render)
778 eo_do(rp->object, evas_obj_no_render_set(1));
779
777 if (st_nested && st_nested->nested_children_count) /* Add this to list of children */ 780 if (st_nested && st_nested->nested_children_count) /* Add this to list of children */
778 { 781 {
779 evas_object_smart_member_add(rp->object, 782 evas_object_smart_member_add(rp->object,
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index ee28bba0c8..d3507cb581 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -1140,6 +1140,7 @@ struct _Edje_Part
1140 unsigned char access; /* it will be used accessibility feature */ 1140 unsigned char access; /* it will be used accessibility feature */
1141 Edje_Part_Api api; 1141 Edje_Part_Api api;
1142 unsigned char nested_children_count; 1142 unsigned char nested_children_count;
1143 unsigned char no_render; /* for proxy sources and masks, since 1.15 */
1143}; 1144};
1144 1145
1145struct _Edje_Part_Image_Id 1146struct _Edje_Part_Image_Id
diff --git a/src/lib/evas/canvas/evas_clip.c b/src/lib/evas/canvas/evas_clip.c
index a6f1e6f124..cf5b1cc6a9 100644
--- a/src/lib/evas/canvas/evas_clip.c
+++ b/src/lib/evas/canvas/evas_clip.c
@@ -491,3 +491,14 @@ _evas_object_clipees_has(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj
491 return (obj->clip.clipees ? EINA_TRUE : EINA_FALSE); 491 return (obj->clip.clipees ? EINA_TRUE : EINA_FALSE);
492} 492}
493 493
494EOLIAN void
495_evas_object_no_render_set(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, Eina_Bool enable)
496{
497 obj->no_render = enable;
498}
499
500EOLIAN Eina_Bool
501_evas_object_no_render_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj)
502{
503 return obj->no_render;
504}
diff --git a/src/lib/evas/canvas/evas_object.eo b/src/lib/evas/canvas/evas_object.eo
index 809a45099a..060b0692ea 100644
--- a/src/lib/evas/canvas/evas_object.eo
+++ b/src/lib/evas/canvas/evas_object.eo
@@ -1280,6 +1280,41 @@ abstract Evas.Object (Eo.Base, Evas.Common_Interface, Efl.Gfx.Base, Efl.Gfx.Stac
1280 @in type: const(char)* @nonull; /*@ The type (name string) to check for. Must be the name */ 1280 @in type: const(char)* @nonull; /*@ The type (name string) to check for. Must be the name */
1281 } 1281 }
1282 } 1282 }
1283 @property no_render {
1284 get {
1285 /*@
1286 Returns the state of the "no-render" flag, which means, when true,
1287 that an object should never be rendered on the canvas.
1288
1289 This flag can be used to avoid rendering visible clippers on the
1290 canvas, even if they currently don't clip any object.
1291
1292 @since 1.15 */
1293 legacy: null;
1294 }
1295 set {
1296 /*@
1297 Disable all rendering on the canvas.
1298
1299 This flag will be used to indicate to Evas that this object should
1300 never be rendered on the canvas under any circurmstances. In
1301 particular, this is useful to avoid drawing clipper objects (or masks)
1302 even when they don't clip any object. This can also be used to replace
1303 the old source_visible flag with proxy objects.
1304
1305 This is different to the visible property, as even visible objects
1306 marked as "no-render" will never appear on screen. But those objects
1307 can still be used as proxy sources or clippers. When hidden, all
1308 "no-render" objects will completely disappear from the canvas, and
1309 hide their clippees or be invisible when used as proxy sources.
1310
1311 @since 1.15 */
1312 legacy: null;
1313 }
1314 values {
1315 enable: bool; /*@ Enable "no-render" mode. */
1316 }
1317 }
1283 } 1318 }
1284 implements { 1319 implements {
1285 Eo.Base.constructor; 1320 Eo.Base.constructor;
diff --git a/src/lib/evas/canvas/evas_render.c b/src/lib/evas/canvas/evas_render.c
index b97552cd11..ed75d0a56f 100644
--- a/src/lib/evas/canvas/evas_render.c
+++ b/src/lib/evas/canvas/evas_render.c
@@ -227,7 +227,8 @@ _evas_render_is_relevant(Evas_Object *eo_obj)
227static Eina_Bool 227static Eina_Bool
228_evas_render_can_render(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj) 228_evas_render_can_render(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
229{ 229{
230 return (evas_object_is_visible(eo_obj, obj) && (!obj->cur->have_clipees)); 230 return (evas_object_is_visible(eo_obj, obj) && (!obj->cur->have_clipees) &&
231 !obj->no_render);
231} 232}
232 233
233static void 234static void
@@ -1232,7 +1233,7 @@ evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj,
1232 else RD(0, "\n"); 1233 else RD(0, "\n");
1233 if (obj->cur->clipper) 1234 if (obj->cur->clipper)
1234 { 1235 {
1235 RD(level, " clipper: '%s'%s%s %p (mask %p) %d,%d %dx%d\n", 1236 RD(level, " clipper: '%s'%s%s %p (mask: %p) %d,%d %dx%d\n",
1236 obj->cur->clipper->type, 1237 obj->cur->clipper->type,
1237 obj->cur->clipper->name ? ":" : "", 1238 obj->cur->clipper->name ? ":" : "",
1238 obj->cur->clipper->name ? obj->cur->clipper->name : "", 1239 obj->cur->clipper->name ? obj->cur->clipper->name : "",
@@ -1263,14 +1264,16 @@ evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj,
1263 return clean_them; 1264 return clean_them;
1264 } 1265 }
1265 } 1266 }
1266 else 1267 else if (!evas_object_is_proxy_visible(eo_obj, obj) ||
1267 {
1268 if (!evas_object_is_proxy_visible(eo_obj, obj) ||
1269 (obj->clip.clipees) || (obj->cur->have_clipees)) 1268 (obj->clip.clipees) || (obj->cur->have_clipees))
1270 { 1269 {
1271 RD(level, "}\n"); 1270 RD(level, "}\n");
1272 return clean_them; 1271 return clean_them;
1273 } 1272 }
1273 else if (obj->no_render)
1274 {
1275 RD(level, " no render\n}\n");
1276 return clean_them;
1274 } 1277 }
1275 } 1278 }
1276 else if (!(((evas_object_is_active(eo_obj, obj) && (!obj->clip.clipees) && 1279 else if (!(((evas_object_is_active(eo_obj, obj) && (!obj->clip.clipees) &&
diff --git a/src/lib/evas/include/evas_inline.x b/src/lib/evas/include/evas_inline.x
index 3426d15fec..83fa4b41c8 100644
--- a/src/lib/evas/include/evas_inline.x
+++ b/src/lib/evas/include/evas_inline.x
@@ -66,7 +66,7 @@ evas_common_draw_context_cutouts_add(Cutout_Rects* rects,
66static inline int 66static inline int
67evas_object_is_opaque(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj) 67evas_object_is_opaque(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
68{ 68{
69 if (obj->is_smart) return 0; 69 if (obj->is_smart || obj->no_render) return 0;
70 /* If clipped: Assume alpha */ 70 /* If clipped: Assume alpha */
71 if (obj->cur->cache.clip.a == 255) 71 if (obj->cur->cache.clip.a == 255)
72 { 72 {
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index b2678df042..967a02aeef 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -1105,6 +1105,7 @@ struct _Evas_Object_Protected_Data
1105 Eina_Bool child_has_map : 1; 1105 Eina_Bool child_has_map : 1;
1106 Eina_Bool eo_del_called : 1; 1106 Eina_Bool eo_del_called : 1;
1107 Eina_Bool is_smart : 1; 1107 Eina_Bool is_smart : 1;
1108 Eina_Bool no_render : 1; // since 1.15
1108}; 1109};
1109 1110
1110struct _Evas_Data_Node 1111struct _Evas_Data_Node