attempt to use the new buffer_copy_set API.

It does currently crash or fails. Seems to me like an evas issue.
This commit is contained in:
Cedric BAIL 2016-12-27 11:56:49 -08:00
parent cd80106f54
commit f59b164351
2 changed files with 15 additions and 10 deletions

View File

@ -23,8 +23,10 @@ static void _setup(void)
{ {
int i, y; int i, y;
FILE *f; FILE *f;
unsigned char *data, **lp; unsigned char **lp;
Evas_Object *o; Evas_Object *o;
Eina_Slice slice;
for (i = 0; i < 1; i++) for (i = 0; i < 1; i++)
{ {
o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas); o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
@ -34,7 +36,8 @@ static void _setup(void)
efl_gfx_fill_set(o, 0, 0, 640, 480); efl_gfx_fill_set(o, 0, 0, 640, 480);
efl_gfx_size_set(o, 640, 480); efl_gfx_size_set(o, 640, 480);
efl_gfx_visible_set(o, EINA_TRUE); efl_gfx_visible_set(o, EINA_TRUE);
data = malloc(sizeof (void*) * (480 + 240 + 240)); slice.mem = malloc(sizeof (void*) * (480 + 240 + 240));
slice.len = (480 + 240 + 240);
yp = malloc(640 * 480); yp = malloc(640 * 480);
up = malloc(320 * 240); up = malloc(320 * 240);
vp = malloc(320 * 240); vp = malloc(320 * 240);
@ -46,7 +49,7 @@ static void _setup(void)
fread(vp, 320 * 240, 1, f); fread(vp, 320 * 240, 1, f);
fclose(f); fclose(f);
} }
lp = (unsigned char**) data; lp = (unsigned char**) slice.bytes;
for (y = 0; y < 480; y++) for (y = 0; y < 480; y++)
{ {
@ -63,8 +66,8 @@ static void _setup(void)
*lp = vp + (y * 320); *lp = vp + (y * 320);
lp++; lp++;
} }
efl_gfx_buffer_copy_set(o_images[i], data, 640, 480, 640 * sizeof (int), EVAS_COLORSPACE_YCBCR422P601_PL, 0); /* efl_gfx_buffer_copy_set(o_images[i], &slice, 640, 480, 640 * sizeof (int), EVAS_COLORSPACE_YCBCR422P601_PL, 0); */
free(data); free(slice.mem);
// Not a real copy in fact... // Not a real copy in fact...
/* free(yp); */ /* free(yp); */
/* free(up); */ /* free(up); */

View File

@ -89,9 +89,10 @@ static void _loop(double t, int f)
{ {
int i; int i;
Evas_Coord x, y, w, h; Evas_Coord x, y, w, h;
Eina_Slice slice;
for (i = 0; i < 1; i++) for (i = 0; i < 1; i++)
{ {
unsigned char **data, **lp; unsigned char **lp;
w = 640; w = 640;
h = 480; h = 480;
@ -107,8 +108,9 @@ static void _loop(double t, int f)
w &= ~0x1; w &= ~0x1;
data = malloc(sizeof (void*) * (480 + 240 + 240)); slice.mem = malloc(sizeof (void*) * (480 + 240 + 240));
lp = data; slice.len = (480 + 240 + 240);
lp = slice.mem;
for (y = 0; y < 480; y++) for (y = 0; y < 480; y++)
{ {
*lp = yp + (y * 640); *lp = yp + (y * 640);
@ -125,9 +127,9 @@ static void _loop(double t, int f)
lp++; lp++;
} }
efl_gfx_buffer_copy_set(o_images[i], data, w, 480, w * sizeof (int), EVAS_COLORSPACE_YCBCR422P601_PL, 0); /* efl_gfx_buffer_copy_set(o_images[i], &slice, w, 480, w * sizeof (int), EVAS_COLORSPACE_YCBCR422P601_PL, 0); */
efl_gfx_buffer_update_add(o_images[i], 0, 0, w, 480); efl_gfx_buffer_update_add(o_images[i], 0, 0, w, 480);
free(data); free(slice.mem);
} }
FPS_STD(NAME); FPS_STD(NAME);
} }