redo pixmap image border to take xywh instead of lrtb

client size is not set by the time opacity is set so it's necessary to store the full rect
This commit is contained in:
Mike Blumenkrantz 2015-02-10 18:07:41 -05:00
parent 090261bc1b
commit d97c6b04bb
4 changed files with 24 additions and 21 deletions

View File

@ -3201,7 +3201,7 @@ e_comp_object_dirty(Evas_Object *obj)
Eina_Rectangle *rect;
Eina_List *ll;
Evas_Object *o;
int w, h, t, b, l, r;
int w, h, bx, by, bxx, byy;
Eina_Bool dirty, visible;
API_ENTRY;
@ -3214,14 +3214,18 @@ e_comp_object_dirty(Evas_Object *obj)
evas_object_image_data_set(cw->obj, NULL);
evas_object_image_size_set(cw->obj, w, h);
e_pixmap_image_border_get(cw->ec->pixmap, &l, &r, &t, &b);
evas_object_image_border_set(cw->obj, l, r, t, b);
e_pixmap_image_opaque_get(cw->ec->pixmap, &bx, &by, &bxx, &byy);
if (bxx && byy)
bxx = cw->ec->client.w - (bx + bxx), byy = cw->ec->client.h - (by + byy);
else
bx = by = bxx = byy = 0;
evas_object_image_border_set(cw->obj, bx, by, bxx, byy);
RENDER_DEBUG("SIZE [%p]: %dx%d", cw->ec, w, h);
if (cw->pending_updates)
eina_tiler_area_size_set(cw->pending_updates, w, h);
EINA_LIST_FOREACH(cw->obj_mirror, ll, o)
{
evas_object_image_border_set(o, l, r, t, b);
evas_object_image_border_set(o, bx, by, bxx, byy);
evas_object_image_pixels_dirty_set(o, dirty);
if (!dirty)
evas_object_image_data_set(o, NULL);

View File

@ -1043,15 +1043,14 @@ _e_comp_wl_surface_cb_opaque_region_set(struct wl_client *client EINA_UNUSED, st
it = eina_tiler_iterator_new(tmp);
EINA_ITERATOR_FOREACH(it, rect)
{
e_pixmap_image_border_set(ec->pixmap, rect->x, ec->client.w - rect->x,
rect->y, ec->client.h - rect->y);
e_pixmap_image_opaque_set(ec->pixmap, rect->x, rect->y, rect->w, rect->h);
break;
}
eina_iterator_free(it);
}
else
e_pixmap_image_border_set(ec->pixmap, 0, 0, 0, 0);
e_pixmap_image_opaque_set(ec->pixmap, 0, 0, 0, 0);
}
static void

View File

@ -34,7 +34,7 @@ struct _E_Pixmap
#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY)
struct wl_resource *resource;
Eina_List *resource_cache;
Eina_Rectangle border;
Eina_Rectangle opaque;
#endif
Eina_Bool usable : 1;
@ -889,11 +889,11 @@ e_pixmap_image_draw(E_Pixmap *cp, const Eina_Rectangle *r)
}
EAPI void
e_pixmap_image_border_set(E_Pixmap *cp, int l, int r, int t, int b)
e_pixmap_image_opaque_set(E_Pixmap *cp, int x, int y, int w, int h)
{
EINA_SAFETY_ON_NULL_RETURN(cp);
#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY)
EINA_RECTANGLE_SET(&cp->border, t, b, l, r);
EINA_RECTANGLE_SET(&cp->opaque, x, y, w, h);
#else
(void)l;
(void)r;
@ -903,18 +903,18 @@ e_pixmap_image_border_set(E_Pixmap *cp, int l, int r, int t, int b)
}
EAPI void
e_pixmap_image_border_get(E_Pixmap *cp, int *l, int *r, int *t, int *b)
e_pixmap_image_opaque_get(E_Pixmap *cp, int *x, int *y, int *w, int *h)
{
EINA_SAFETY_ON_NULL_RETURN(cp);
#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY)
if (t) *t = cp->border.x;
if (b) *b = cp->border.y;
if (l) *l = cp->border.w;
if (r) *r = cp->border.h;
if (x) *x = cp->opaque.x;
if (y) *y = cp->opaque.y;
if (w) *w = cp->opaque.w;
if (h) *h = cp->opaque.h;
#else
if (t) *t = 0;
if (b) *b = 0;
if (l) *l = 0;
if (r) *r = 0;
if (x) *x = 0;
if (y) *y = 0;
if (w) *w = 0;
if (h) *h = 0;
#endif
}

View File

@ -45,8 +45,8 @@ EAPI void *e_pixmap_image_data_get(E_Pixmap *cp);
EAPI Eina_Bool e_pixmap_image_data_argb_convert(E_Pixmap *cp, void *pix, void *ipix, Eina_Rectangle *r, int stride);
EAPI Eina_Bool e_pixmap_image_draw(E_Pixmap *cp, const Eina_Rectangle *r);
EAPI void e_pixmap_image_border_set(E_Pixmap *cp, int l, int r, int t, int b);
EAPI void e_pixmap_image_border_get(E_Pixmap *cp, int *l, int *r, int *t, int *b);
EAPI void e_pixmap_image_opaque_set(E_Pixmap *cp, int x, int y, int w, int h);
EAPI void e_pixmap_image_opaque_get(E_Pixmap *cp, int *x, int *y, int *w, int *h);
static inline Eina_Bool
e_pixmap_is_x(const E_Pixmap *cp)