summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2015-07-30 11:45:05 -0400
committerChris Michael <cp.michael@samsung.com>2015-07-30 11:45:05 -0400
commit157ad667b491071a92d1480256b79f859c045783 (patch)
tree905e627784a6d95d82ccceade48348f743ab4c41
parent525269dc986e31ef672d4ed8e7c294eba2dffa91 (diff)
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
-rw-r--r--src/modules/evas/engines/wayland_shm/evas_engine.h1
-rw-r--r--src/modules/evas/engines/wayland_shm/evas_shm.c42
2 files changed, 24 insertions, 19 deletions
diff --git a/src/modules/evas/engines/wayland_shm/evas_engine.h b/src/modules/evas/engines/wayland_shm/evas_engine.h
index 72d071a31b..a702155749 100644
--- a/src/modules/evas/engines/wayland_shm/evas_engine.h
+++ b/src/modules/evas/engines/wayland_shm/evas_engine.h
@@ -120,6 +120,7 @@ Shm_Surface *_evas_shm_surface_create(struct wl_shm *shm, struct wl_surface *sur
120void _evas_shm_surface_destroy(Shm_Surface *surface); 120void _evas_shm_surface_destroy(Shm_Surface *surface);
121void _evas_shm_surface_reconfigure(Shm_Surface *surface, int dx, int dy, int w, int h, int num_buff, uint32_t flags); 121void _evas_shm_surface_reconfigure(Shm_Surface *surface, int dx, int dy, int w, int h, int num_buff, uint32_t flags);
122void *_evas_shm_surface_data_get(Shm_Surface *surface, int *w, int *h); 122void *_evas_shm_surface_data_get(Shm_Surface *surface, int *w, int *h);
123Eina_Bool _evas_shm_surface_assign(Shm_Surface *surface);
123void _evas_shm_surface_post(Shm_Surface *surface, Eina_Rectangle *rects, unsigned int count); 124void _evas_shm_surface_post(Shm_Surface *surface, Eina_Rectangle *rects, unsigned int count);
124 125
125Outbuf *_evas_outbuf_setup(int w, int h, int rot, Outbuf_Depth depth, Eina_Bool alpha, struct wl_shm *shm, struct wl_surface *surface); 126Outbuf *_evas_outbuf_setup(int w, int h, int rot, Outbuf_Depth depth, Eina_Bool alpha, struct wl_shm *shm, struct wl_surface *surface);
diff --git a/src/modules/evas/engines/wayland_shm/evas_shm.c b/src/modules/evas/engines/wayland_shm/evas_shm.c
index a6d90be788..ee01f12d01 100644
--- a/src/modules/evas/engines/wayland_shm/evas_shm.c
+++ b/src/modules/evas/engines/wayland_shm/evas_shm.c
@@ -404,28 +404,34 @@ _evas_shm_surface_reconfigure(Shm_Surface *surface, int dx, int dy, int w, int h
404 } 404 }
405} 405}
406 406
407void * 407Eina_Bool
408_evas_shm_surface_data_get(Shm_Surface *surface, int *w, int *h) 408_evas_shm_surface_assign(Shm_Surface *surface)
409{ 409{
410 Shm_Leaf *leaf = NULL; 410 int i;
411 int i = 0;
412 411
413 LOGFN(__FILE__, __LINE__, __FUNCTION__); 412 for (i = 0; i < surface->num_buff; i++)
414
415 if (w) *w = 0;
416 if (h) *h = 0;
417
418 for (; i < surface->num_buff; i++)
419 { 413 {
420 if (surface->leaf[i].busy) continue; 414 if (surface->leaf[i].busy) continue;
421 if ((!leaf) || (leaf->valid)) 415 if (surface->leaf[i].valid)
422 { 416 {
423 leaf = &surface->leaf[i]; 417 surface->current = &surface->leaf[i];
424 break; 418 return EINA_TRUE;
425 } 419 }
426 } 420 }
421 return EINA_FALSE;
422}
423
424void *
425_evas_shm_surface_data_get(Shm_Surface *surface, int *w, int *h)
426{
427 LOGFN(__FILE__, __LINE__, __FUNCTION__);
427 428
428 if (!leaf) 429 _evas_shm_surface_assign(surface);
430
431 if (w) *w = 0;
432 if (h) *h = 0;
433
434 if (!surface->current)
429 { 435 {
430 /* WRN("All buffers held by server"); */ 436 /* WRN("All buffers held by server"); */
431 return NULL; 437 return NULL;
@@ -433,12 +439,10 @@ _evas_shm_surface_data_get(Shm_Surface *surface, int *w, int *h)
433 439
434 /* DBG("Leaf Data Get %d", (int)(leaf - &surface->leaf[0])); */ 440 /* DBG("Leaf Data Get %d", (int)(leaf - &surface->leaf[0])); */
435 441
436 if (w) *w = leaf->w; 442 if (w) *w = surface->current->w;
437 if (h) *h = leaf->h; 443 if (h) *h = surface->current->h;
438
439 surface->curr_buff = (int)(leaf - &surface->leaf[0]);
440 444
441 return leaf->data->map; 445 return surface->current->data->map;
442} 446}
443 447
444void 448void