forked from enlightenment/efl
wayland-shm: refactor _evas_shm_surface_data_get()
Summary: Split out the buffer picking stuff because we're going to want to call it from somewhere else. Reviewers: zmike, devilhorns Reviewed By: devilhorns Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2889
This commit is contained in:
parent
525269dc98
commit
157ad667b4
|
@ -120,6 +120,7 @@ Shm_Surface *_evas_shm_surface_create(struct wl_shm *shm, struct wl_surface *sur
|
||||||
void _evas_shm_surface_destroy(Shm_Surface *surface);
|
void _evas_shm_surface_destroy(Shm_Surface *surface);
|
||||||
void _evas_shm_surface_reconfigure(Shm_Surface *surface, int dx, int dy, int w, int h, int num_buff, uint32_t flags);
|
void _evas_shm_surface_reconfigure(Shm_Surface *surface, int dx, int dy, int w, int h, int num_buff, uint32_t flags);
|
||||||
void *_evas_shm_surface_data_get(Shm_Surface *surface, int *w, int *h);
|
void *_evas_shm_surface_data_get(Shm_Surface *surface, int *w, int *h);
|
||||||
|
Eina_Bool _evas_shm_surface_assign(Shm_Surface *surface);
|
||||||
void _evas_shm_surface_post(Shm_Surface *surface, Eina_Rectangle *rects, unsigned int count);
|
void _evas_shm_surface_post(Shm_Surface *surface, Eina_Rectangle *rects, unsigned int count);
|
||||||
|
|
||||||
Outbuf *_evas_outbuf_setup(int w, int h, int rot, Outbuf_Depth depth, Eina_Bool alpha, struct wl_shm *shm, struct wl_surface *surface);
|
Outbuf *_evas_outbuf_setup(int w, int h, int rot, Outbuf_Depth depth, Eina_Bool alpha, struct wl_shm *shm, struct wl_surface *surface);
|
||||||
|
|
|
@ -404,28 +404,34 @@ _evas_shm_surface_reconfigure(Shm_Surface *surface, int dx, int dy, int w, int h
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
_evas_shm_surface_assign(Shm_Surface *surface)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < surface->num_buff; i++)
|
||||||
|
{
|
||||||
|
if (surface->leaf[i].busy) continue;
|
||||||
|
if (surface->leaf[i].valid)
|
||||||
|
{
|
||||||
|
surface->current = &surface->leaf[i];
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
_evas_shm_surface_data_get(Shm_Surface *surface, int *w, int *h)
|
_evas_shm_surface_data_get(Shm_Surface *surface, int *w, int *h)
|
||||||
{
|
{
|
||||||
Shm_Leaf *leaf = NULL;
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||||
|
|
||||||
|
_evas_shm_surface_assign(surface);
|
||||||
|
|
||||||
if (w) *w = 0;
|
if (w) *w = 0;
|
||||||
if (h) *h = 0;
|
if (h) *h = 0;
|
||||||
|
|
||||||
for (; i < surface->num_buff; i++)
|
if (!surface->current)
|
||||||
{
|
|
||||||
if (surface->leaf[i].busy) continue;
|
|
||||||
if ((!leaf) || (leaf->valid))
|
|
||||||
{
|
|
||||||
leaf = &surface->leaf[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!leaf)
|
|
||||||
{
|
{
|
||||||
/* WRN("All buffers held by server"); */
|
/* WRN("All buffers held by server"); */
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -433,12 +439,10 @@ _evas_shm_surface_data_get(Shm_Surface *surface, int *w, int *h)
|
||||||
|
|
||||||
/* DBG("Leaf Data Get %d", (int)(leaf - &surface->leaf[0])); */
|
/* DBG("Leaf Data Get %d", (int)(leaf - &surface->leaf[0])); */
|
||||||
|
|
||||||
if (w) *w = leaf->w;
|
if (w) *w = surface->current->w;
|
||||||
if (h) *h = leaf->h;
|
if (h) *h = surface->current->h;
|
||||||
|
|
||||||
surface->curr_buff = (int)(leaf - &surface->leaf[0]);
|
return surface->current->data->map;
|
||||||
|
|
||||||
return leaf->data->map;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue