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_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);
Outbuf *_evas_outbuf_setup(int w, int h, int rot, Outbuf_Depth depth, Eina_Bool alpha, struct wl_shm *shm, struct wl_surface *surface);
}
}
-void *
-_evas_shm_surface_data_get(Shm_Surface *surface, int *w, int *h)
+Eina_Bool
+_evas_shm_surface_assign(Shm_Surface *surface)
{
- Shm_Leaf *leaf = NULL;
- int i = 0;
+ int i;
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- if (w) *w = 0;
- if (h) *h = 0;
-
- for (; i < surface->num_buff; i++)
+ for (i = 0; i < surface->num_buff; i++)
{
if (surface->leaf[i].busy) continue;
- if ((!leaf) || (leaf->valid))
+ if (surface->leaf[i].valid)
{
- leaf = &surface->leaf[i];
- break;
+ surface->current = &surface->leaf[i];
+ return EINA_TRUE;
}
}
+ return EINA_FALSE;
+}
+
+void *
+_evas_shm_surface_data_get(Shm_Surface *surface, int *w, int *h)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!leaf)
+ _evas_shm_surface_assign(surface);
+
+ if (w) *w = 0;
+ if (h) *h = 0;
+
+ if (!surface->current)
{
/* WRN("All buffers held by server"); */
return NULL;
/* DBG("Leaf Data Get %d", (int)(leaf - &surface->leaf[0])); */
- if (w) *w = leaf->w;
- if (h) *h = leaf->h;
-
- surface->curr_buff = (int)(leaf - &surface->leaf[0]);
+ if (w) *w = surface->current->w;
+ if (h) *h = surface->current->h;
- return leaf->data->map;
+ return surface->current->data->map;
}
void