From 7d2a55f7e9a2d940d3e5f854c9e8bc250af9f4a8 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 17 Sep 2015 16:48:43 -0400 Subject: [PATCH] add function to blank out a client's rendered image when working with Extremely Serious effects, it may be the case that a user is rendering at such an advanced level that any attempt by enlightenment to perform rendering will be like a child trying to reproduce a masterpiece of art while using fingerpaints https://www.youtube.com/watch?v=tY6qag5KFx0&hd=1 --- src/bin/e_comp_object.c | 32 ++++++++++++++++++++++++++------ src/bin/e_comp_object.h | 1 + 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/bin/e_comp_object.c b/src/bin/e_comp_object.c index 49e47bd..725e0e3 100644 --- a/src/bin/e_comp_object.c +++ b/src/bin/e_comp_object.c @@ -124,6 +124,7 @@ typedef struct _E_Comp_Object Eina_Bool force_move : 1; Eina_Bool frame_extends : 1; //frame may extend beyond object size + Eina_Bool blanked : 1; //window is rendering blank content (externally composited) } E_Comp_Object; @@ -278,7 +279,7 @@ _e_comp_object_alpha_set(E_Comp_Object *cw) { Eina_Bool alpha = cw->ec->argb; - if (cw->ns || cw->ec->shaped) alpha = EINA_TRUE; + if (cw->blanked || cw->ns || cw->ec->shaped) alpha = EINA_TRUE; evas_object_image_alpha_set(cw->obj, alpha); } @@ -3355,7 +3356,7 @@ e_comp_object_native_surface_set(Evas_Object *obj, Eina_Bool set) } cw->native = set; - evas_object_image_native_surface_set(cw->obj, set ? (cw->ns ?: &ns) : NULL); + evas_object_image_native_surface_set(cw->obj, set && (!cw->blanked) ? (cw->ns ?: &ns) : NULL); EINA_LIST_FOREACH(cw->obj_mirror, l, o) { evas_object_image_alpha_set(o, !!cw->ns ? 1 : cw->ec->argb); @@ -3377,6 +3378,25 @@ e_comp_object_native_surface_override(Evas_Object *obj, Evas_Native_Surface *ns) e_comp_object_damage(obj, 0, 0, cw->w, cw->h); } +E_API void +e_comp_object_blank(Evas_Object *obj, Eina_Bool set) +{ + API_ENTRY; + + set = !!set; + + if (cw->blanked == set) return; + cw->blanked = set; + _e_comp_object_alpha_set(cw); + if (set) + { + evas_object_image_native_surface_set(cw->obj, NULL); + evas_object_image_data_set(cw->obj, NULL); + return; + } + if (cw->native) + e_comp_object_native_surface_set(obj, 1); + e_comp_object_damage(obj, 0, 0, cw->w, cw->h); } /* mark an object as dirty and setup damages */ @@ -3395,7 +3415,7 @@ e_comp_object_dirty(Evas_Object *obj) dirty = e_pixmap_size_get(cw->ec->pixmap, &w, &h); visible = cw->visible; if (!dirty) w = h = 1; - evas_object_image_pixels_dirty_set(cw->obj, dirty); + evas_object_image_pixels_dirty_set(cw->obj, cw->blanked ? 0 : dirty); if (!dirty) evas_object_image_data_set(cw->obj, NULL); evas_object_image_size_set(cw->obj, w, h); @@ -3531,12 +3551,12 @@ e_comp_object_render(Evas_Object *obj) if (e_comp->comp_type == E_PIXMAP_TYPE_WL) { #warning FIXME BROKEN WAYLAND SHM BUFFER PROTOCOL - evas_object_image_data_copy_set(cw->obj, pix); + evas_object_image_data_copy_set(cw->obj, cw->blanked ? NULL : pix); pix = evas_object_image_data_get(cw->obj, 0); evas_object_image_data_set(cw->obj, pix); } else - evas_object_image_data_set(cw->obj, pix); + evas_object_image_data_set(cw->obj, cw->blanked ? NULL : pix); EINA_LIST_FOREACH(cw->obj_mirror, l, o) { evas_object_image_data_set(o, pix); @@ -3570,7 +3590,7 @@ e_comp_object_render(Evas_Object *obj) e_pixmap_image_data_argb_convert(cw->ec->pixmap, pix, srcpix, r, stride); RENDER_DEBUG("UPDATE [%p]: %d %d %dx%d -- pix = %p", cw->ec, r->x, r->y, r->w, r->h, pix); } - evas_object_image_data_set(cw->obj, pix); + evas_object_image_data_set(cw->obj, cw->blanked ? NULL : pix); EINA_LIST_FOREACH(cw->obj_mirror, l, o) { evas_object_image_data_set(o, pix); diff --git a/src/bin/e_comp_object.h b/src/bin/e_comp_object.h index e06f738..aca2ba4 100644 --- a/src/bin/e_comp_object.h +++ b/src/bin/e_comp_object.h @@ -72,6 +72,7 @@ E_API void e_comp_object_shape_apply(Evas_Object *obj); E_API void e_comp_object_redirected_set(Evas_Object *obj, Eina_Bool set); E_API void e_comp_object_native_surface_set(Evas_Object *obj, Eina_Bool set); E_API void e_comp_object_native_surface_override(Evas_Object *obj, Evas_Native_Surface *ns); +E_API void e_comp_object_blank(Evas_Object *obj, Eina_Bool set); E_API void e_comp_object_dirty(Evas_Object *obj); E_API Eina_Bool e_comp_object_render(Evas_Object *obj); EAPI Eina_Bool e_comp_object_effect_allowed_get(Evas_Object *obj); -- 2.7.4