summaryrefslogtreecommitdiff
path: root/src/lib/ecore_wl2/ecore_wl2_buffer.c
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2018-01-25 17:01:23 -0600
committerDerek Foreman <derekf@osg.samsung.com>2018-01-26 15:53:59 -0600
commit1a5e307f7304ab998837fc2969a34811ccbec7c1 (patch)
tree701ed334d88c485ad789cd4a7fba975d43721d86 /src/lib/ecore_wl2/ecore_wl2_buffer.c
parent7d81a16cdbb9a19748fad95cac54ac6022e607f0 (diff)
ecore_wl2: Add buffer_fit API and use it from surface code
This tries to resize the buffer's useable area to fit the specified size - this is possible if the stride of the buffer is larger than the current width.
Diffstat (limited to 'src/lib/ecore_wl2/ecore_wl2_buffer.c')
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_buffer.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/lib/ecore_wl2/ecore_wl2_buffer.c b/src/lib/ecore_wl2/ecore_wl2_buffer.c
index eefb0e91f3..1a9c5c5af9 100644
--- a/src/lib/ecore_wl2/ecore_wl2_buffer.c
+++ b/src/lib/ecore_wl2/ecore_wl2_buffer.c
@@ -711,6 +711,23 @@ ecore_wl2_buffer_age_inc(Ecore_Wl2_Buffer *buffer)
711 buffer->age++; 711 buffer->age++;
712} 712}
713 713
714EAPI Eina_Bool
715ecore_wl2_buffer_fit(Ecore_Wl2_Buffer *b, int w, int h)
716{
717 int stride;
718
719 EINA_SAFETY_ON_NULL_RETURN_VAL(b, EINA_FALSE);
720
721 stride = b->stride;
722 if ((w >= b->w) && (w <= stride / 4) && (h == b->h))
723 {
724 b->w = w;
725 return EINA_TRUE;
726 }
727
728 return EINA_FALSE;
729}
730
714static Ecore_Wl2_Buffer * 731static Ecore_Wl2_Buffer *
715_ecore_wl2_buffer_partial_create(int w, int h, Eina_Bool alpha) 732_ecore_wl2_buffer_partial_create(int w, int h, Eina_Bool alpha)
716{ 733{