summaryrefslogtreecommitdiff
path: root/src/lib/ecore_wl2/ecore_wl2_buffer.c
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2018-01-26 10:13:25 -0600
committerDerek Foreman <derekf@osg.samsung.com>2018-01-26 15:53:59 -0600
commite11bb10a4e14ec661f69a4acb2988f4b9de1d323 (patch)
tree7a2977d36f60ea0bc7e48b1583b85c70fdac8397 /src/lib/ecore_wl2/ecore_wl2_buffer.c
parent1a5e307f7304ab998837fc2969a34811ccbec7c1 (diff)
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.
Diffstat (limited to 'src/lib/ecore_wl2/ecore_wl2_buffer.c')
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_buffer.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/lib/ecore_wl2/ecore_wl2_buffer.c b/src/lib/ecore_wl2/ecore_wl2_buffer.c
index 1a9c5c5af9..3bb56748cd 100644
--- a/src/lib/ecore_wl2/ecore_wl2_buffer.c
+++ b/src/lib/ecore_wl2/ecore_wl2_buffer.c
@@ -622,13 +622,31 @@ ecore_wl2_buffer_wl_buffer_get(Ecore_Wl2_Display *ewd, Ecore_Wl2_Buffer *buf)
622} 622}
623 623
624EAPI void * 624EAPI void *
625ecore_wl2_buffer_map(Ecore_Wl2_Buffer *buf) 625ecore_wl2_buffer_map(Ecore_Wl2_Buffer *buf, int *w, int *h, int *stride)
626{ 626{
627 void *out; 627 void *out;
628 628
629 _buffer_manager_ref(); 629 EINA_SAFETY_ON_NULL_RETURN_VAL(buf, NULL);
630 out = buffer_manager->map(buf); 630
631 if (!out) _buffer_manager_deref(); 631 if (buf->locked)
632 {
633 out = buf->mapping;
634 }
635 else
636 {
637 _buffer_manager_ref();
638 out = buffer_manager->map(buf);
639 if (!out)
640 {
641 _buffer_manager_deref();
642 return NULL;
643 }
644 buf->locked = EINA_TRUE;
645 buf->mapping = out;
646 }
647 if (w) *w = buf->w;
648 if (h) *h = buf->h;
649 if (stride) *stride = (int)buf->stride;
632 return out; 650 return out;
633} 651}
634 652