migrate to new broken data_get/set api.

This commit is contained in:
Cedric BAIL 2016-03-17 16:54:20 -07:00
parent f9834c142c
commit f8b38f6c24
6 changed files with 105 additions and 97 deletions

View File

@ -22,18 +22,21 @@ static void _setup(void)
{ {
int i; int i;
Evas_Object *o; Evas_Object *o;
void *pixels;
pixels = malloc(sizeof (int) * 640 * 480);
for (i = 0; i < 1; i++) for (i = 0; i < 1; i++)
{ {
o = eo_add(EVAS_IMAGE_CLASS, evas); o = eo_add(EVAS_IMAGE_CLASS, evas);
o_images[i] = o; o_images[i] = o;
evas_obj_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); efl_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
evas_obj_image_colorspace_set(o, EVAS_COLORSPACE_ARGB8888); efl_gfx_buffer_alpha_set(o, 0);
efl_gfx_view_size_set(o, 640, 480);
evas_obj_image_alpha_set(o, 0);
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);
efl_gfx_buffer_copy_set(o_images[i], pixels, 640, 480, 640 * sizeof (int), EFL_GFX_COLORSPACE_ARGB8888);
} }
free(pixels);
done = 0; done = 0;
} }
@ -60,8 +63,7 @@ static void _loop(double t, int f)
efl_gfx_position_set(o_images[i], x, y); efl_gfx_position_set(o_images[i], x, y);
efl_gfx_size_set(o_images[i], w, h); efl_gfx_size_set(o_images[i], w, h);
efl_gfx_fill_set(o_images[i], 0, 0, w, h); efl_gfx_fill_set(o_images[i], 0, 0, w, h);
data = evas_obj_image_data_get(o_images[i], 1); data = efl_gfx_buffer_get(o_images[i], 1, &w, &h, &st, NULL);
st = evas_obj_image_stride_get(o_images[i]);
st = st >> 2; st = st >> 2;
p = data; p = data;
for (y = 0; y < h; y++) for (y = 0; y < h; y++)
@ -73,8 +75,8 @@ static void _loop(double t, int f)
} }
p += (st - w); p += (st - w);
} }
evas_obj_image_data_set(o_images[i], data); efl_gfx_buffer_set(o_images[i], data, w, h, st << 2, EFL_GFX_COLORSPACE_ARGB8888);
evas_obj_image_data_update_add(o_images[i], 0, 0, w, h); efl_gfx_buffer_update_add(o_images[i], 0, 0, w, h);
} }
FPS_STD(NAME); FPS_STD(NAME);
} }

View File

@ -22,18 +22,21 @@ static void _setup(void)
{ {
int i; int i;
Evas_Object *o; Evas_Object *o;
void *pixels;
pixels = malloc(sizeof (int) * 640 * 480);
for (i = 0; i < 1; i++) for (i = 0; i < 1; i++)
{ {
o = eo_add(EVAS_IMAGE_CLASS, evas); o = eo_add(EVAS_IMAGE_CLASS, evas);
o_images[i] = o; o_images[i] = o;
evas_obj_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); efl_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
evas_obj_image_colorspace_set(o, EVAS_COLORSPACE_ARGB8888); efl_gfx_buffer_alpha_set(o, 1);
efl_gfx_view_size_set(o, 640, 480);
evas_obj_image_alpha_set(o, 1);
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);
efl_gfx_buffer_copy_set(o_images[i], pixels, 640, 480, 640 * sizeof (int), EFL_GFX_COLORSPACE_ARGB8888);
} }
free(pixels);
done = 0; done = 0;
} }
@ -53,6 +56,7 @@ static void _loop(double t, int f)
{ {
unsigned int *data, *p; unsigned int *data, *p;
int a, r, g, b; int a, r, g, b;
w = 640; w = 640;
h = 480; h = 480;
x = (win_w / 2) - (w / 2); x = (win_w / 2) - (w / 2);
@ -60,8 +64,7 @@ static void _loop(double t, int f)
efl_gfx_position_set(o_images[i], x, y); efl_gfx_position_set(o_images[i], x, y);
efl_gfx_size_set(o_images[i], w, h); efl_gfx_size_set(o_images[i], w, h);
efl_gfx_fill_set(o_images[i], 0, 0, w, h); efl_gfx_fill_set(o_images[i], 0, 0, w, h);
data = evas_obj_image_data_get(o_images[i], 1); data = efl_gfx_buffer_get(o_images[i], 1, &w, &h, &st, NULL);
st = evas_obj_image_stride_get(o_images[i]);
st = st >> 2; st = st >> 2;
p = data; p = data;
for (y = 0; y < h; y++) for (y = 0; y < h; y++)
@ -84,8 +87,8 @@ static void _loop(double t, int f)
} }
p += (st - w); p += (st - w);
} }
evas_obj_image_data_set(o_images[i], data); efl_gfx_buffer_set(o_images[i], data, w, h, st << 2, EFL_GFX_COLORSPACE_ARGB8888);
evas_obj_image_data_update_add(o_images[i], 0, 0, w, h); efl_gfx_buffer_update_add(o_images[i], 0, 0, w, h);
} }
FPS_STD(NAME); FPS_STD(NAME);
} }

View File

@ -23,19 +23,20 @@ static void _setup(void)
{ {
int i, y; int i, y;
FILE *f; FILE *f;
unsigned char **data, **lp; unsigned char *data, **lp;
Evas_Object *o; Evas_Object *o;
for (i = 0; i < 1; i++) for (i = 0; i < 1; i++)
{ {
unsigned int length;
o = eo_add(EVAS_IMAGE_CLASS, evas); o = eo_add(EVAS_IMAGE_CLASS, evas);
o_images[i] = o; o_images[i] = o;
evas_obj_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); efl_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
evas_obj_image_colorspace_set(o, EVAS_COLORSPACE_YCBCR422P601_PL); efl_gfx_buffer_alpha_set(o, 0);
efl_gfx_view_size_set(o, 640, 480);
evas_obj_image_alpha_set(o, 0);
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));
yp = malloc(640 * 480); yp = malloc(640 * 480);
up = malloc(320 * 240); up = malloc(320 * 240);
vp = malloc(320 * 240); vp = malloc(320 * 240);
@ -47,8 +48,8 @@ static void _setup(void)
fread(vp, 320 * 240, 1, f); fread(vp, 320 * 240, 1, f);
fclose(f); fclose(f);
} }
data = evas_object_image_data_get(o_images[i], 1); lp = (unsigned char**) data;
lp = data;
for (y = 0; y < 480; y++) for (y = 0; y < 480; y++)
{ {
*lp = yp + (y * 640); *lp = yp + (y * 640);
@ -64,7 +65,12 @@ static void _setup(void)
*lp = vp + (y * 320); *lp = vp + (y * 320);
lp++; lp++;
} }
evas_obj_image_data_set(o_images[i], data); efl_gfx_buffer_copy_set(o_images[i], data, 640, 480, 640 * sizeof (int), EVAS_COLORSPACE_YCBCR422P601_PL);
free(data);
// Not a real copy in fact...
/* free(yp); */
/* free(up); */
/* free(vp); */
} }
done = 0; done = 0;
} }
@ -74,9 +80,10 @@ static void _cleanup(void)
{ {
int i; int i;
for (i = 0; i < 1; i++) eo_del(o_images[i]); for (i = 0; i < 1; i++) eo_del(o_images[i]);
free(yp); // FIXME: the object is not destroyed anymore so we can't free the data
free(up); /* free(yp); */
free(vp); /* free(up); */
/* free(vp); */
} }
/* loop - do things */ /* loop - do things */
@ -93,7 +100,7 @@ static void _loop(double t, int f)
efl_gfx_position_set(o_images[i], x, y); efl_gfx_position_set(o_images[i], x, y);
efl_gfx_size_set(o_images[i], w, h); efl_gfx_size_set(o_images[i], w, h);
efl_gfx_fill_set(o_images[i], 0, 0, w, h); efl_gfx_fill_set(o_images[i], 0, 0, w, h);
evas_obj_image_data_update_add(o_images[i], 0, 0, 640, 480); efl_gfx_buffer_update_add(o_images[i], 0, 0, 640, 480);
} }
FPS_STD(NAME); FPS_STD(NAME);
} }

View File

@ -27,16 +27,17 @@ static void _setup(void)
Evas_Object *o; Evas_Object *o;
for (i = 0; i < 1; i++) for (i = 0; i < 1; i++)
{ {
unsigned int length;
o = eo_add(EVAS_IMAGE_CLASS, evas); o = eo_add(EVAS_IMAGE_CLASS, evas);
o_images[i] = o; o_images[i] = o;
evas_obj_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); efl_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
evas_obj_image_colorspace_set(o, EVAS_COLORSPACE_YCBCR422P601_PL); efl_gfx_buffer_alpha_set(o, 0);
efl_gfx_view_size_set(o, 640, 480);
evas_obj_image_alpha_set(o, 0);
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_image_smooth_scale_set(o, 0); efl_image_smooth_scale_set(o, 0);
efl_gfx_visible_set(o, EINA_TRUE); efl_gfx_visible_set(o, EINA_TRUE);
data = malloc(sizeof (void*) * (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);
@ -48,7 +49,6 @@ static void _setup(void)
fread(vp, 320 * 240, 1, f); fread(vp, 320 * 240, 1, f);
fclose(f); fclose(f);
} }
data = evas_object_image_data_get(o_images[i], 1);
lp = data; lp = data;
for (y = 0; y < 480; y++) for (y = 0; y < 480; y++)
{ {
@ -65,7 +65,7 @@ static void _setup(void)
*lp = vp + (y * 320); *lp = vp + (y * 320);
lp++; lp++;
} }
evas_obj_image_data_set(o_images[i], data); efl_gfx_buffer_set(o_images[i], data, 640, 480, 640 * sizeof (int), EVAS_COLORSPACE_YCBCR422P601_PL);
} }
done = 0; done = 0;
} }
@ -75,9 +75,9 @@ static void _cleanup(void)
{ {
int i; int i;
for (i = 0; i < 1; i++) eo_del(o_images[i]); for (i = 0; i < 1; i++) eo_del(o_images[i]);
free(yp); /* free(yp); */
free(up); /* free(up); */
free(vp); /* free(vp); */
} }
/* loop - do things */ /* loop - do things */

View File

@ -27,15 +27,16 @@ static void _setup(void)
Evas_Object *o; Evas_Object *o;
for (i = 0; i < 1; i++) for (i = 0; i < 1; i++)
{ {
unsigned int length;
o = eo_add(EVAS_IMAGE_CLASS, evas); o = eo_add(EVAS_IMAGE_CLASS, evas);
o_images[i] = o; o_images[i] = o;
evas_obj_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); efl_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
evas_obj_image_colorspace_set(o, EVAS_COLORSPACE_YCBCR422P601_PL); efl_gfx_buffer_alpha_set(o, 0);
efl_gfx_view_size_set(o, 640, 480);
evas_obj_image_alpha_set(o, 0);
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));
yp = malloc(640 * 480); yp = malloc(640 * 480);
up = malloc(320 * 240); up = malloc(320 * 240);
vp = malloc(320 * 240); vp = malloc(320 * 240);
@ -47,7 +48,6 @@ static void _setup(void)
fread(vp, 320 * 240, 1, f); fread(vp, 320 * 240, 1, f);
fclose(f); fclose(f);
} }
data = evas_object_image_data_get(o_images[i], 1);
lp = data; lp = data;
for (y = 0; y < 480; y++) for (y = 0; y < 480; y++)
{ {
@ -64,7 +64,7 @@ static void _setup(void)
*lp = vp + (y * 320); *lp = vp + (y * 320);
lp++; lp++;
} }
evas_obj_image_data_set(o_images[i], data); efl_gfx_buffer_set(o_images[i], data, 640, 480, 640 * sizeof (int), EVAS_COLORSPACE_YCBCR422P601_PL);
} }
done = 0; done = 0;
} }
@ -74,9 +74,9 @@ static void _cleanup(void)
{ {
int i; int i;
for (i = 0; i < 1; i++) eo_del(o_images[i]); for (i = 0; i < 1; i++) eo_del(o_images[i]);
free(yp); /* free(yp); */
free(up); /* free(up); */
free(vp); /* free(vp); */
} }
/* loop - do things */ /* loop - do things */

View File

@ -27,15 +27,16 @@ static void _setup(void)
Evas_Object *o; Evas_Object *o;
for (i = 0; i < 1; i++) for (i = 0; i < 1; i++)
{ {
unsigned int length;
o = eo_add(EVAS_IMAGE_CLASS, evas); o = eo_add(EVAS_IMAGE_CLASS, evas);
o_images[i] = o; o_images[i] = o;
evas_obj_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); efl_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
evas_obj_image_colorspace_set(o, EVAS_COLORSPACE_YCBCR422P601_PL); efl_gfx_buffer_alpha_set(o, 0);
efl_gfx_view_size_set(o, 320, 480);
evas_obj_image_alpha_set(o, 0);
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 (unsigned char*) * (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);
@ -47,9 +48,6 @@ static void _setup(void)
fread(vp, 320 * 240, 1, f); fread(vp, 320 * 240, 1, f);
fclose(f); fclose(f);
} }
data = evas_object_image_data_get(o_images[i], 1);
if (data)
{
lp = data; lp = data;
for (y = 0; y < 480; y++) for (y = 0; y < 480; y++)
{ {
@ -66,9 +64,8 @@ static void _setup(void)
*lp = vp + (y * 320); *lp = vp + (y * 320);
lp++; lp++;
} }
evas_obj_image_data_set(o_images[i], data); efl_gfx_buffer_set(o_images[i], data, 640, 480, 640 * sizeof (int), EVAS_COLORSPACE_YCBCR422P601_PL);
evas_obj_image_data_update_add(o_images[i], 0, 0, 320, 480); efl_gfx_buffer_update_add(o_images[i], 0, 0, 320, 480);
}
} }
done = 0; done = 0;
} }
@ -78,9 +75,9 @@ static void _cleanup(void)
{ {
int i; int i;
for (i = 0; i < 1; i++) eo_del(o_images[i]); for (i = 0; i < 1; i++) eo_del(o_images[i]);
free(yp); /* free(yp); */
free(up); /* free(up); */
free(vp); /* free(vp); */
} }
/* loop - do things */ /* loop - do things */
@ -91,6 +88,7 @@ static void _loop(double t, int f)
for (i = 0; i < 1; i++) for (i = 0; i < 1; i++)
{ {
unsigned char **data, **lp; unsigned char **data, **lp;
int stride;
w = 640; w = 640;
h = 480; h = 480;
@ -106,10 +104,7 @@ static void _loop(double t, int f)
w &= ~0x1; w &= ~0x1;
efl_gfx_view_size_set(o_images[i], w, 480); data = malloc(sizeof (void*) * (480 + 240 + 240));
data = evas_object_image_data_get(o_images[i], 1);
if (data)
{
lp = data; lp = data;
for (y = 0; y < 480; y++) for (y = 0; y < 480; y++)
{ {
@ -126,9 +121,10 @@ static void _loop(double t, int f)
*lp = vp + (y * 320); *lp = vp + (y * 320);
lp++; lp++;
} }
evas_obj_image_data_set(o_images[i], data);
evas_obj_image_data_update_add(o_images[i], 0, 0, w, 480); efl_gfx_buffer_copy_set(o_images[i], data, w, 480, w * sizeof (int), EVAS_COLORSPACE_YCBCR422P601_PL);
} efl_gfx_buffer_update_add(o_images[i], 0, 0, w, 480);
free(data);
} }
FPS_STD(NAME); FPS_STD(NAME);
} }