evas: fix evas_object_image_data_convert.

SVN revision: 62722
This commit is contained in:
Cedric BAIL 2011-08-23 16:06:41 +00:00
parent 7ae4bd0f31
commit efcceff953
3 changed files with 63 additions and 3 deletions

View File

@ -38,7 +38,7 @@ struct _Evas_Object_Image
const char *file;
const char *key;
int frame;
int cspace;
Evas_Colorspace cspace;
unsigned char smooth_scale : 1;
unsigned char has_alpha :1;
@ -836,7 +836,7 @@ evas_object_image_data_convert(Evas_Object *obj, Evas_Colorspace to_cspace)
obj);
}
if (!o->engine_data) return NULL;
if (!o->cur.cspace == to_cspace) return NULL;
if (o->cur.cspace == to_cspace) return NULL;
data = NULL;
o->engine_data = obj->layer->evas->engine.func->image_data_get(obj->layer->evas->engine.data.output,
o->engine_data,
@ -3605,6 +3605,7 @@ evas_object_image_data_convert_internal(Evas_Object_Image *o, void *data, Evas_C
{
void *out = NULL;
fprintf(stderr, "data: %p (%i)\n", data, o->cur.cspace);
if (!data)
return NULL;
@ -3626,7 +3627,21 @@ evas_object_image_data_convert_internal(Evas_Object_Image *o, void *data, Evas_C
o->cur.has_alpha,
to_cspace);
break;
case EVAS_COLORSPACE_YCBCR422601_PL:
fprintf(stderr, "EVAS_COLORSPACE_YCBCR422601_PL:\n");
out = evas_common_convert_yuv_422_601_to(data,
o->cur.image.w,
o->cur.image.h,
to_cspace);
break;
case EVAS_COLORSPACE_YCBCR422P601_PL:
out = evas_common_convert_yuv_422P_601_to(data,
o->cur.image.w,
o->cur.image.h,
to_cspace);
break;
default:
fprintf(stderr, "unknow colorspace: %i\n", o->cur.cspace);
break;
}

View File

@ -96,5 +96,49 @@ evas_common_convert_rgb565_a5p_to(void *data, int w, int h, int stride, Eina_Boo
return NULL;
}
EAPI void *
evas_common_convert_yuv_422_601_to(void *data, int w, int h, Evas_Colorspace cspace)
{
switch (cspace)
{
case EVAS_COLORSPACE_ARGB8888:
{
void *dst;
fprintf(stderr, "to argb888\n");
dst = malloc(sizeof (unsigned int) * w * h);
if (!dst) return NULL;
evas_common_convert_yuv_422_601_rgba(data, dst, w, h);
return dst;
}
default:
break;
}
return NULL;
}
EAPI void *
evas_common_convert_yuv_422P_601_to(void *data, int w, int h, Evas_Colorspace cspace)
{
switch (cspace)
{
case EVAS_COLORSPACE_ARGB8888:
{
void *dst;
dst = malloc(sizeof (unsigned int) * w * h);
if (!dst) return NULL;
evas_common_convert_yuv_420p_601_rgba(data, dst, w, h);
break;
}
default:
break;
}
return NULL;
}
/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/

View File

@ -4,6 +4,7 @@
EAPI void *evas_common_convert_argb8888_to (void *data, int w, int h, int stride, Eina_Bool has_alpha, Evas_Colorspace cspace);
EAPI void *evas_common_convert_rgb565_a5p_to (void *data, int w, int h, int stride, Eina_Bool has_alpha, Evas_Colorspace cspace);
EAPI void *evas_common_convert_yuv_422P_601_to (void *data, int w, int h, Evas_Colorspace cspace);
EAPI void *evas_common_convert_yuv_422_601_to (void *data, int w, int h, Evas_Colorspace cspace);
#endif /* _EVAS_CONVERT_COLORSPACE_H */