summaryrefslogtreecommitdiff
path: root/src/lib/evas/common
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-09-05 13:53:00 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-09-06 16:55:00 +0900
commitb2d92f2626574efec6d2e159b08d44c7e4936069 (patch)
tree9cf5a444cf4c72bf8cb57ffa7c07327a4df8531d /src/lib/evas/common
parent2f737e8f3bb6705fa981bced09a5337db3ee2bcb (diff)
evas: Implement support for external buffers
This brings support for the eo api for external buffers (like the old data_set / data_get). The new API now works with slices and planes. The internal code still relies on the old cs.data array for YUV color conversion. This makes the code a little bit too complex to my taste. Tested with expedite for RGBA and YUV 422 601 planar, both SW and GL engines (x11).
Diffstat (limited to 'src/lib/evas/common')
-rw-r--r--src/lib/evas/common/evas_image_main.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/evas/common/evas_image_main.c b/src/lib/evas/common/evas_image_main.c
index df2e5e27eb..ade4b9cd42 100644
--- a/src/lib/evas/common/evas_image_main.c
+++ b/src/lib/evas/common/evas_image_main.c
@@ -246,12 +246,12 @@ _evas_common_rgba_image_plane_get(const RGBA_Image *im, int plane, Eina_Slice *s
246 } 246 }
247 return EINA_FALSE; 247 return EINA_FALSE;
248 248
249 // YUV, assume contiguous memory within a plane (and no padding) 249 // YUV, assume contiguous memory within a plane - padding ok
250 // single interleaved plane 250 // 1 plane
251 case EVAS_COLORSPACE_YCBCR422601_PL: 251 case EVAS_COLORSPACE_YCBCR422601_PL:
252 if (plane != 0) return EINA_FALSE; 252 if (plane != 0) return EINA_FALSE;
253 slice->mem = csdata[0]; 253 slice->mem = csdata[0];
254 slice->len = (w * h * 3) / 2; 254 slice->len = (h > 1) ? ((size_t) (csdata[1] - csdata[0]) * h * 2) : (w * 2);
255 return EINA_TRUE; 255 return EINA_TRUE;
256 256
257 // 2 planes 257 // 2 planes
@@ -260,13 +260,13 @@ _evas_common_rgba_image_plane_get(const RGBA_Image *im, int plane, Eina_Slice *s
260 if (plane == 0) 260 if (plane == 0)
261 { 261 {
262 slice->mem = csdata[0]; 262 slice->mem = csdata[0];
263 slice->len = w * h; 263 slice->len = (h > 1) ? ((size_t) (csdata[1] - csdata[0]) * h) : w;
264 return EINA_TRUE; 264 return EINA_TRUE;
265 } 265 }
266 else if (plane == 1) 266 else if (plane == 1)
267 { 267 {
268 slice->mem = csdata[h]; 268 slice->mem = csdata[h];
269 slice->len = w * h / 4; 269 slice->len = (h > 1) ? ((size_t) (csdata[h+1] - csdata[h]) * h / 2) : w / 2;
270 return EINA_TRUE; 270 return EINA_TRUE;
271 } 271 }
272 return EINA_FALSE; 272 return EINA_FALSE;
@@ -277,19 +277,19 @@ _evas_common_rgba_image_plane_get(const RGBA_Image *im, int plane, Eina_Slice *s
277 if (plane == 0) 277 if (plane == 0)
278 { 278 {
279 slice->mem = csdata[0]; 279 slice->mem = csdata[0];
280 slice->len = w * h; 280 slice->len = (h > 1) ? ((size_t) (csdata[1] - csdata[0]) * h) : w;
281 return EINA_TRUE; 281 return EINA_TRUE;
282 } 282 }
283 else if (plane == 1) 283 else if (plane == 1)
284 { 284 {
285 slice->mem = csdata[h]; 285 slice->mem = csdata[h];
286 slice->len = w * h / 4; 286 slice->len = (h > 1) ? ((size_t) (csdata[h+1] - csdata[h]) * h / 2) : w / 2;
287 return EINA_TRUE; 287 return EINA_TRUE;
288 } 288 }
289 else if (plane == 2) 289 else if (plane == 2)
290 { 290 {
291 slice->mem = csdata[2 * h]; 291 slice->mem = csdata[h + h / 2];
292 slice->len = w * h / 4; 292 slice->len = (h > 1) ? ((size_t) (csdata[h+h/2+1] - csdata[h+h/2]) * h / 2) : w / 2;
293 return EINA_TRUE; 293 return EINA_TRUE;
294 } 294 }
295 return EINA_FALSE; 295 return EINA_FALSE;