summaryrefslogtreecommitdiff
path: root/src/lib/ector/software
diff options
context:
space:
mode:
authorsubhransu mohanty <sub.mohanty@samsung.com>2018-02-08 14:27:15 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2018-02-08 14:44:29 +0900
commit48433efc43de9eeaf353e3da18c7109e434902da (patch)
tree38bba818fa70f69175e8677b35e8e4da9a8f102c /src/lib/ector/software
parent80cc3f230d47bc3f3d049e59adde449694e93b2c (diff)
ector: Updated the ector_buffer_pixels_set() api with stride info
Reviewers: jypark, jpeg Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D5795
Diffstat (limited to 'src/lib/ector/software')
-rw-r--r--src/lib/ector/software/ector_software_buffer.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/ector/software/ector_software_buffer.c b/src/lib/ector/software/ector_software_buffer.c
index d44962bbec..8afe6c85c4 100644
--- a/src/lib/ector/software/ector_software_buffer.c
+++ b/src/lib/ector/software/ector_software_buffer.c
@@ -71,10 +71,10 @@ on_fail:
71 71
72EOLIAN static Eina_Bool 72EOLIAN static Eina_Bool
73_ector_software_buffer_base_ector_buffer_pixels_set(Eo *obj, Ector_Software_Buffer_Base_Data *pd, 73_ector_software_buffer_base_ector_buffer_pixels_set(Eo *obj, Ector_Software_Buffer_Base_Data *pd,
74 void *pixels, int width, int height, 74 void *pixels, int width, int height, int stride,
75 Efl_Gfx_Colorspace cspace, Eina_Bool writable) 75 Efl_Gfx_Colorspace cspace, Eina_Bool writable)
76{ 76{
77 unsigned pxs, stride; 77 unsigned pxs;
78 78
79 if (pd->generic->immutable) 79 if (pd->generic->immutable)
80 fail("This buffer is immutable."); 80 fail("This buffer is immutable.");
@@ -92,7 +92,11 @@ _ector_software_buffer_base_ector_buffer_pixels_set(Eo *obj, Ector_Software_Buff
92 if (((unsigned long long)(uintptr_t)pixels) & (pxs - 1)) 92 if (((unsigned long long)(uintptr_t)pixels) & (pxs - 1))
93 fail ("Pixel data is not aligned to %u bytes!", pxs); 93 fail ("Pixel data is not aligned to %u bytes!", pxs);
94 94
95 stride = width * pxs; 95 if (stride == 0)
96 stride = width * pxs;
97 else if (stride < (int)(width * pxs))
98 fail ("Stride is less than minimum stride: provided %u bytes, minimum %u bytes!", stride, (width * pxs));
99
96 if (pd->pixels.u8 && (pd->pixels.u8 != pixels)) 100 if (pd->pixels.u8 && (pd->pixels.u8 != pixels))
97 _ector_software_buffer_base_pixels_clear(obj, pd); 101 _ector_software_buffer_base_pixels_clear(obj, pd);
98 102