forked from enlightenment/efl
evas/framespace: Add support for framespace offset rendering translation.
Instead of moving the objects by adding the framespace offset to them, use this offset when rendering them. This way there's no change in the object's geometry/position, it works correctly with map, and will be automatically updated in case that the framespace values change (for instance if one sets a window to borderless). There are 2 main places where changes were needed: - output redraws, when they come from an object being changed, must be add the framespace offset to their damaged area; - checks to see if the object is inside a given rendering area, must also add this offset, since the object is actually being rendered on a different position;
This commit is contained in:
parent
550bc6ca48
commit
59c37d1c7b
|
@ -192,6 +192,7 @@ _clip_set(Eo *eo_obj, void *_pd, va_list *list)
|
|||
Evas_Object_Protected_Data *clip;
|
||||
Evas_Object *eo_clip = va_arg(*list, Evas_Object *);
|
||||
Evas_Object_Protected_Data *obj = _pd;
|
||||
Evas_Public_Data *e;
|
||||
|
||||
if (!eo_clip)
|
||||
{
|
||||
|
@ -256,10 +257,11 @@ _clip_set(Eo *eo_obj, void *_pd, va_list *list)
|
|||
}
|
||||
EINA_COW_STATE_WRITE_END(obj->cur->clipper, state_write, cur);
|
||||
|
||||
e = obj->cur->clipper->layer->evas;
|
||||
if (obj->cur->clipper->cur->visible)
|
||||
evas_damage_rectangle_add(obj->cur->clipper->layer->evas->evas,
|
||||
obj->cur->clipper->cur->geometry.x,
|
||||
obj->cur->clipper->cur->geometry.y,
|
||||
evas_damage_rectangle_add(e->evas,
|
||||
obj->cur->clipper->cur->geometry.x + e->framespace.x,
|
||||
obj->cur->clipper->cur->geometry.y + e->framespace.y,
|
||||
obj->cur->clipper->cur->geometry.w,
|
||||
obj->cur->clipper->cur->geometry.h);
|
||||
}
|
||||
|
@ -277,9 +279,11 @@ _clip_set(Eo *eo_obj, void *_pd, va_list *list)
|
|||
{
|
||||
/* Basically it just went invisible */
|
||||
clip->changed = 1;
|
||||
clip->layer->evas->changed = 1;
|
||||
evas_damage_rectangle_add(clip->layer->evas->evas,
|
||||
clip->cur->geometry.x, clip->cur->geometry.y,
|
||||
e = clip->layer->evas;
|
||||
e->changed = 1;
|
||||
evas_damage_rectangle_add(e->evas,
|
||||
clip->cur->geometry.x + e->framespace.x,
|
||||
clip->cur->geometry.y + e->framespace.y,
|
||||
clip->cur->geometry.w, clip->cur->geometry.h);
|
||||
}
|
||||
EINA_COW_STATE_WRITE_BEGIN(obj, state_write, cur)
|
||||
|
@ -387,11 +391,14 @@ _clip_unset(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
|
|||
EINA_COW_STATE_WRITE_END(obj->cur->clipper, state_write, cur);
|
||||
|
||||
if (obj->cur->clipper->cur->visible)
|
||||
evas_damage_rectangle_add(obj->cur->clipper->layer->evas->evas,
|
||||
obj->cur->clipper->cur->geometry.x,
|
||||
obj->cur->clipper->cur->geometry.y,
|
||||
obj->cur->clipper->cur->geometry.w,
|
||||
obj->cur->clipper->cur->geometry.h);
|
||||
{
|
||||
Evas_Public_Data *e = obj->cur->clipper->layer->evas;
|
||||
evas_damage_rectangle_add(e->evas,
|
||||
obj->cur->clipper->cur->geometry.x + e->framespace.x,
|
||||
obj->cur->clipper->cur->geometry.y + e->framespace.y,
|
||||
obj->cur->clipper->cur->geometry.w,
|
||||
obj->cur->clipper->cur->geometry.h);
|
||||
}
|
||||
}
|
||||
evas_object_change(obj->cur->clipper->object, obj->cur->clipper);
|
||||
}
|
||||
|
|
|
@ -4311,7 +4311,9 @@ evas_object_image_render_pre(Evas_Object *eo_obj, Evas_Object_Protected_Data *ob
|
|||
obj->cur->clipper->cur->cache.clip.h);
|
||||
}
|
||||
e->engine.func->output_redraws_rect_del(e->engine.data.output,
|
||||
x, y, w, h);
|
||||
x + e->framespace.x,
|
||||
y + e->framespace.y,
|
||||
w, h);
|
||||
}
|
||||
done:
|
||||
evas_object_render_pre_effect_updates(&e->clip_changes, eo_obj, is_v, was_v);
|
||||
|
|
|
@ -408,6 +408,8 @@ evas_object_render_pre_effect_updates(Eina_Array *rects, Evas_Object *eo_obj, in
|
|||
/* FIXME: was_v isn't used... why? */
|
||||
if (!obj->clip.clipees)
|
||||
{
|
||||
Evas_Public_Data *e;
|
||||
e = obj->layer->evas;
|
||||
EINA_ARRAY_ITER_NEXT(rects, i, r, it)
|
||||
{
|
||||
/* get updates and clip to current clip */
|
||||
|
@ -421,8 +423,10 @@ evas_object_render_pre_effect_updates(Eina_Array *rects, Evas_Object *eo_obj, in
|
|||
obj->cur->cache.clip.w,
|
||||
obj->cur->cache.clip.h);
|
||||
if ((w > 0) && (h > 0))
|
||||
obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
|
||||
x, y, w, h);
|
||||
obj->layer->evas->engine.func->output_redraws_rect_add(e->engine.data.output,
|
||||
x + e->framespace.x,
|
||||
y + e->framespace.y,
|
||||
w, h);
|
||||
/* get updates and clip to previous clip */
|
||||
x = r->x;
|
||||
y = r->y;
|
||||
|
@ -434,8 +438,10 @@ evas_object_render_pre_effect_updates(Eina_Array *rects, Evas_Object *eo_obj, in
|
|||
obj->prev->cache.clip.w,
|
||||
obj->prev->cache.clip.h);
|
||||
if ((w > 0) && (h > 0))
|
||||
obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
|
||||
x, y, w, h);
|
||||
obj->layer->evas->engine.func->output_redraws_rect_add(e->engine.data.output,
|
||||
x + e->framespace.x,
|
||||
y + e->framespace.y,
|
||||
w, h);
|
||||
}
|
||||
/* if the object is actually visible, take any parent clip changes */
|
||||
if (is_v)
|
||||
|
@ -455,8 +461,10 @@ evas_object_render_pre_effect_updates(Eina_Array *rects, Evas_Object *eo_obj, in
|
|||
obj->cur->cache.clip.w,
|
||||
obj->cur->cache.clip.h);
|
||||
if ((w > 0) && (h > 0))
|
||||
obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
|
||||
x, y, w, h);
|
||||
obj->layer->evas->engine.func->output_redraws_rect_add(e->engine.data.output,
|
||||
x + e->framespace.x,
|
||||
y + e->framespace.y,
|
||||
w, h);
|
||||
/* get updates and clip to previous clip */
|
||||
x = r->x; y = r->y; w = r->w; h = r->h;
|
||||
RECTS_CLIP_TO_RECT(x, y, w, h,
|
||||
|
@ -465,8 +473,10 @@ evas_object_render_pre_effect_updates(Eina_Array *rects, Evas_Object *eo_obj, in
|
|||
obj->prev->cache.clip.w,
|
||||
obj->prev->cache.clip.h);
|
||||
if ((w > 0) && (h > 0))
|
||||
obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
|
||||
x, y, w, h);
|
||||
obj->layer->evas->engine.func->output_redraws_rect_add(e->engine.data.output,
|
||||
x + e->framespace.x,
|
||||
y + e->framespace.y,
|
||||
w, h);
|
||||
}
|
||||
clipper = clipper->cur->clipper;
|
||||
}
|
||||
|
@ -672,7 +682,6 @@ _position_set(Eo *eo_obj, void *_pd, va_list *list)
|
|||
Evas_Coord x = va_arg(*list, Evas_Coord);
|
||||
Evas_Coord y = va_arg(*list, Evas_Coord);
|
||||
|
||||
Evas_Public_Data *evas;
|
||||
Eina_Bool is, was = EINA_FALSE;
|
||||
Eina_Bool pass = EINA_FALSE, freeze = EINA_FALSE;
|
||||
Eina_Bool source_invisible = EINA_FALSE;
|
||||
|
@ -680,8 +689,6 @@ _position_set(Eo *eo_obj, void *_pd, va_list *list)
|
|||
if (obj->delete_me) return;
|
||||
if (!obj->layer) return;
|
||||
|
||||
evas = obj->layer->evas;
|
||||
|
||||
if (evas_object_intercept_call_move(eo_obj, obj, x, y)) return;
|
||||
|
||||
if (obj->doing.in_move > 0)
|
||||
|
|
|
@ -220,13 +220,13 @@ static void
|
|||
_evas_render_prev_cur_clip_cache_add(Evas_Public_Data *e, Evas_Object_Protected_Data *obj)
|
||||
{
|
||||
e->engine.func->output_redraws_rect_add(e->engine.data.output,
|
||||
obj->prev->cache.clip.x,
|
||||
obj->prev->cache.clip.y,
|
||||
obj->prev->cache.clip.x + e->framespace.x,
|
||||
obj->prev->cache.clip.y + e->framespace.y,
|
||||
obj->prev->cache.clip.w,
|
||||
obj->prev->cache.clip.h);
|
||||
e->engine.func->output_redraws_rect_add(e->engine.data.output,
|
||||
obj->cur->cache.clip.x,
|
||||
obj->cur->cache.clip.y,
|
||||
obj->cur->cache.clip.x + e->framespace.x,
|
||||
obj->cur->cache.clip.y + e->framespace.y,
|
||||
obj->cur->cache.clip.w,
|
||||
obj->cur->cache.clip.h);
|
||||
}
|
||||
|
@ -249,7 +249,8 @@ _evas_render_cur_clip_cache_del(Evas_Public_Data *e, Evas_Object_Protected_Data
|
|||
obj->cur->clipper->cur->cache.clip.h);
|
||||
}
|
||||
e->engine.func->output_redraws_rect_del(e->engine.data.output,
|
||||
x, y, w, h);
|
||||
x + e->framespace.x,
|
||||
y + e->framespace.y, w, h);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1629,6 +1630,8 @@ evas_render_updates_internal(Evas *eo_e,
|
|||
if (do_draw)
|
||||
{
|
||||
unsigned int offset = 0;
|
||||
int fx = e->framespace.x;
|
||||
int fy = e->framespace.y;
|
||||
|
||||
while ((surface =
|
||||
e->engine.func->output_redraws_next_update_get
|
||||
|
@ -1672,13 +1675,13 @@ evas_render_updates_internal(Evas *eo_e,
|
|||
obj = (Evas_Object_Protected_Data *)eina_array_data_get
|
||||
(&e->obscuring_objects, i);
|
||||
eo_obj = obj->object;
|
||||
if (evas_object_is_in_output_rect(eo_obj, obj, ux, uy, uw, uh))
|
||||
if (evas_object_is_in_output_rect(eo_obj, obj, ux - fx, uy - fy, uw, uh))
|
||||
{
|
||||
eina_array_push(&e->temporary_objects, obj);
|
||||
|
||||
/* reset the background of the area if needed (using cutout and engine alpha flag to help) */
|
||||
if (alpha)
|
||||
_evas_render_cutout_add(e, obj, off_x, off_y);
|
||||
_evas_render_cutout_add(e, obj, off_x + fx, off_y + fy);
|
||||
}
|
||||
}
|
||||
if (alpha)
|
||||
|
@ -1709,7 +1712,7 @@ evas_render_updates_internal(Evas *eo_e,
|
|||
|
||||
/* if it's in our outpout rect and it doesn't clip anything */
|
||||
RD(" OBJ: [%p] '%s' %i %i %ix%i\n", obj, obj->type, obj->cur->geometry.x, obj->cur->geometry.y, obj->cur->geometry.w, obj->cur->geometry.h);
|
||||
if ((evas_object_is_in_output_rect(eo_obj, obj, ux, uy, uw, uh) ||
|
||||
if ((evas_object_is_in_output_rect(eo_obj, obj, ux - fx, uy - fy, uw, uh) ||
|
||||
(obj->is_smart)) &&
|
||||
(!obj->clip.clipees) &&
|
||||
(obj->cur->visible) &&
|
||||
|
@ -1730,8 +1733,8 @@ evas_render_updates_internal(Evas *eo_e,
|
|||
if (!obj->is_smart)
|
||||
{
|
||||
RECTS_CLIP_TO_RECT(x, y, w, h,
|
||||
obj->cur->cache.clip.x + off_x,
|
||||
obj->cur->cache.clip.y + off_y,
|
||||
obj->cur->cache.clip.x + off_x + fx,
|
||||
obj->cur->cache.clip.y + off_y + fy,
|
||||
obj->cur->cache.clip.w,
|
||||
obj->cur->cache.clip.h);
|
||||
}
|
||||
|
@ -1746,12 +1749,12 @@ evas_render_updates_internal(Evas *eo_e,
|
|||
|
||||
obj2 = (Evas_Object_Protected_Data *)eina_array_data_get
|
||||
(&e->temporary_objects, j);
|
||||
_evas_render_cutout_add(e, obj2, off_x, off_y);
|
||||
_evas_render_cutout_add(e, obj2, off_x + fx, off_y + fy);
|
||||
}
|
||||
#endif
|
||||
clean_them |= evas_render_mapped(e, eo_obj, obj, e->engine.data.context,
|
||||
surface, off_x,
|
||||
off_y, 0,
|
||||
surface, off_x + fx,
|
||||
off_y + fy, 0,
|
||||
cx, cy, cw, ch,
|
||||
NULL
|
||||
#ifdef REND_DBG
|
||||
|
|
|
@ -168,23 +168,27 @@ evas_object_is_active(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
|
|||
{
|
||||
if (evas_object_is_visible(eo_obj, obj) || evas_object_was_visible(eo_obj, obj))
|
||||
{
|
||||
Evas_Public_Data *e = obj->layer->evas;
|
||||
int fx, fy;
|
||||
fx = e->framespace.x;
|
||||
fy = e->framespace.y;
|
||||
if (obj->is_smart)
|
||||
{
|
||||
int mapsmt = 0;
|
||||
if (obj->map->cur.map && obj->map->cur.usemap) mapsmt = 1;
|
||||
if (!mapsmt) return 1;
|
||||
if (evas_object_is_in_output_rect(eo_obj, obj, 0, 0, obj->layer->evas->output.w,
|
||||
obj->layer->evas->output.h) ||
|
||||
evas_object_was_in_output_rect(eo_obj, obj, 0, 0, obj->layer->evas->output.w,
|
||||
obj->layer->evas->output.h))
|
||||
if (evas_object_is_in_output_rect(eo_obj, obj, -fx, -fy,
|
||||
e->output.w, e->output.h) ||
|
||||
evas_object_was_in_output_rect(eo_obj, obj, -fx, -fy,
|
||||
e->output.w, e->output.h))
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (evas_object_is_in_output_rect(eo_obj, obj, 0, 0, obj->layer->evas->output.w,
|
||||
obj->layer->evas->output.h) ||
|
||||
evas_object_was_in_output_rect(eo_obj, obj, 0, 0, obj->layer->evas->output.w,
|
||||
obj->layer->evas->output.h))
|
||||
if (evas_object_is_in_output_rect(eo_obj, obj, -fx, -fy,
|
||||
e->output.w, e->output.h) ||
|
||||
evas_object_was_in_output_rect(eo_obj, obj, -fx, -fy,
|
||||
e->output.w, e->output.h))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -769,7 +769,6 @@ _ecore_evas_wl_common_frame_border_size_set(Evas_Object *obj, int fx, int fy, in
|
|||
else if ((sd->border_size[i] > 0) && (!sd->border[i]))
|
||||
{
|
||||
sd->border[i] = evas_object_rectangle_add(e);
|
||||
evas_object_is_frame_object_set(sd->border[i], EINA_TRUE);
|
||||
evas_object_color_set(sd->border[i], 249, 249, 249, 255);
|
||||
evas_object_show(sd->border[i]);
|
||||
evas_object_smart_member_add(sd->border[i], obj);
|
||||
|
|
|
@ -205,12 +205,11 @@ ecore_evas_wayland_egl_new_internal(const char *disp_name, unsigned int parent,
|
|||
|
||||
ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_common_pre_free);
|
||||
|
||||
if (ee->prop.draw_frame)
|
||||
if (ee->prop.draw_frame)
|
||||
{
|
||||
wdata->frame = _ecore_evas_wl_common_frame_add(ee->evas);
|
||||
_ecore_evas_wl_common_frame_border_size_set(wdata->frame, fx, fy, fw, fh);
|
||||
evas_object_is_frame_object_set(wdata->frame, EINA_TRUE);
|
||||
evas_object_move(wdata->frame, 0, 0);
|
||||
evas_object_move(wdata->frame, -fx, -fy);
|
||||
evas_object_layer_set(wdata->frame, EVAS_LAYER_MAX - 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -214,8 +214,7 @@ ecore_evas_wayland_shm_new_internal(const char *disp_name, unsigned int parent,
|
|||
{
|
||||
wdata->frame = _ecore_evas_wl_common_frame_add(ee->evas);
|
||||
_ecore_evas_wl_common_frame_border_size_set(wdata->frame, fx, fy, fw, fh);
|
||||
evas_object_is_frame_object_set(wdata->frame, EINA_TRUE);
|
||||
evas_object_move(wdata->frame, 0, 0);
|
||||
evas_object_move(wdata->frame, -fx, -fy);
|
||||
evas_object_layer_set(wdata->frame, EVAS_LAYER_MAX - 1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue