forked from enlightenment/efl
ecore_wl2: Move smarts from surface_map to buffer_map
This simplifies the surface code so that it no longer needs access to buffer structure members.
This commit is contained in:
parent
1a5e307f73
commit
e11bb10a4e
|
@ -2002,7 +2002,7 @@ EAPI Eina_Bool ecore_wl2_buffer_init(Ecore_Wl2_Display *ewd, Ecore_Wl2_Buffer_Ty
|
|||
EAPI Ecore_Wl2_Buffer *ecore_wl2_buffer_create(Ecore_Wl2_Display *ewd, int w, int h, Eina_Bool alpha);
|
||||
EAPI void ecore_wl2_buffer_destroy(Ecore_Wl2_Buffer *b);
|
||||
EAPI struct wl_buffer *ecore_wl2_buffer_wl_buffer_get(Ecore_Wl2_Display *ewd, Ecore_Wl2_Buffer *buf);
|
||||
EAPI void *ecore_wl2_buffer_map(Ecore_Wl2_Buffer *buf);
|
||||
EAPI void *ecore_wl2_buffer_map(Ecore_Wl2_Buffer *buf, int *w, int *h, int *stride);
|
||||
EAPI void ecore_wl2_buffer_unmap(Ecore_Wl2_Buffer *buf);
|
||||
EAPI void ecore_wl2_buffer_discard(Ecore_Wl2_Buffer *buf);
|
||||
EAPI void ecore_wl2_buffer_unlock(Ecore_Wl2_Buffer *b);
|
||||
|
|
|
@ -622,13 +622,31 @@ ecore_wl2_buffer_wl_buffer_get(Ecore_Wl2_Display *ewd, Ecore_Wl2_Buffer *buf)
|
|||
}
|
||||
|
||||
EAPI void *
|
||||
ecore_wl2_buffer_map(Ecore_Wl2_Buffer *buf)
|
||||
ecore_wl2_buffer_map(Ecore_Wl2_Buffer *buf, int *w, int *h, int *stride)
|
||||
{
|
||||
void *out;
|
||||
|
||||
_buffer_manager_ref();
|
||||
out = buffer_manager->map(buf);
|
||||
if (!out) _buffer_manager_deref();
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(buf, NULL);
|
||||
|
||||
if (buf->locked)
|
||||
{
|
||||
out = buf->mapping;
|
||||
}
|
||||
else
|
||||
{
|
||||
_buffer_manager_ref();
|
||||
out = buffer_manager->map(buf);
|
||||
if (!out)
|
||||
{
|
||||
_buffer_manager_deref();
|
||||
return NULL;
|
||||
}
|
||||
buf->locked = EINA_TRUE;
|
||||
buf->mapping = out;
|
||||
}
|
||||
if (w) *w = buf->w;
|
||||
if (h) *h = buf->h;
|
||||
if (stride) *stride = (int)buf->stride;
|
||||
return out;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,24 +53,20 @@ _evas_dmabuf_surface_data_get(Ecore_Wl2_Surface *s, int *w, int *h)
|
|||
{
|
||||
Ecore_Wl2_Buffer *b;
|
||||
void *ptr;
|
||||
int stride;
|
||||
|
||||
b = s->current;
|
||||
if (!b) return NULL;
|
||||
|
||||
ptr = ecore_wl2_buffer_map(b, NULL, h, &stride);
|
||||
if (!ptr) return NULL;
|
||||
|
||||
/* We return stride/bpp because it may not match the allocated
|
||||
* width. evas will figure out the clipping
|
||||
*/
|
||||
if (w) *w = b->stride / 4;
|
||||
if (h) *h = b->h;
|
||||
if (b->locked) return b->mapping;
|
||||
if (w) *w = stride / 4;
|
||||
|
||||
ptr = ecore_wl2_buffer_map(b);
|
||||
if (!ptr)
|
||||
return NULL;
|
||||
|
||||
b->mapping = ptr;
|
||||
b->locked = EINA_TRUE;
|
||||
return b->mapping;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static Ecore_Wl2_Buffer *
|
||||
|
|
Loading…
Reference in New Issue