forked from enlightenment/efl
Evas: Implement ARGY88 and GRY8 conversion to ARGB8888
This is adding support for a deprecated function, but apparently it is used. Also, remove crazy abort() inside the data_put function. Fixes T2991
This commit is contained in:
parent
e47edc250d
commit
2ac9e788c6
|
@ -4709,6 +4709,22 @@ evas_object_image_data_convert_internal(Evas_Image_Data *o, void *data, Evas_Col
|
||||||
o->cur->image.h,
|
o->cur->image.h,
|
||||||
to_cspace);
|
to_cspace);
|
||||||
break;
|
break;
|
||||||
|
case EVAS_COLORSPACE_AGRY88:
|
||||||
|
out = evas_common_convert_agry88_to(data,
|
||||||
|
o->cur->image.w,
|
||||||
|
o->cur->image.h,
|
||||||
|
o->cur->image.stride,
|
||||||
|
o->cur->has_alpha,
|
||||||
|
to_cspace);
|
||||||
|
break;
|
||||||
|
case EVAS_COLORSPACE_GRY8:
|
||||||
|
out = evas_common_convert_gry8_to(data,
|
||||||
|
o->cur->image.w,
|
||||||
|
o->cur->image.h,
|
||||||
|
o->cur->image.stride,
|
||||||
|
o->cur->has_alpha,
|
||||||
|
to_cspace);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
WRN("unknow colorspace: %i\n", o->cur->cspace);
|
WRN("unknow colorspace: %i\n", o->cur->cspace);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -46,6 +46,90 @@ evas_common_convert_rgb565_a5p_to_argb8888(void *data, int w, int h, int stride,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void *
|
||||||
|
evas_common_convert_agry88_to_argb8888(const void *data, int w, int h, int stride, Eina_Bool has_alpha)
|
||||||
|
{
|
||||||
|
const DATA16 *src, *end;
|
||||||
|
DATA32 *ret, *dst;
|
||||||
|
|
||||||
|
src = data;
|
||||||
|
end = src + ((stride >> 1) * h);
|
||||||
|
ret = malloc(w * h * sizeof(DATA32));
|
||||||
|
dst = ret;
|
||||||
|
|
||||||
|
if (has_alpha)
|
||||||
|
{
|
||||||
|
for (; src < end; src++, dst++)
|
||||||
|
{
|
||||||
|
int c = (*src) & 0xFF;
|
||||||
|
*dst = ARGB_JOIN((*src >> 8), c, c, c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (; src < end; src++, dst++)
|
||||||
|
{
|
||||||
|
int c = (*src) & 0xFF;
|
||||||
|
*dst = ARGB_JOIN(0xFF, c, c, c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
evas_common_convert_agry88_to(const void *data, int w, int h, int stride, Eina_Bool has_alpha, Evas_Colorspace cspace)
|
||||||
|
{
|
||||||
|
switch (cspace) {
|
||||||
|
case EVAS_COLORSPACE_ARGB8888:
|
||||||
|
return evas_common_convert_agry88_to_argb8888(data, w, h, stride, has_alpha);
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void *
|
||||||
|
evas_common_convert_gry8_to_argb8888(const void *data, int w, int h, int stride, Eina_Bool has_alpha)
|
||||||
|
{
|
||||||
|
const DATA8 *src, *end;
|
||||||
|
DATA32 *ret, *dst;
|
||||||
|
|
||||||
|
src = data;
|
||||||
|
end = src + (stride * h);
|
||||||
|
ret = malloc(w * h * sizeof(DATA32));
|
||||||
|
dst = ret;
|
||||||
|
|
||||||
|
if (has_alpha)
|
||||||
|
{
|
||||||
|
for (; src < end; src++, dst++)
|
||||||
|
{
|
||||||
|
int c = (*src) & 0xFF;
|
||||||
|
*dst = ARGB_JOIN(c, c, c, c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (; src < end; src++, dst++)
|
||||||
|
{
|
||||||
|
int c = (*src) & 0xFF;
|
||||||
|
*dst = ARGB_JOIN(0xFF, c, c, c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
evas_common_convert_gry8_to(const void *data, int w, int h, int stride, Eina_Bool has_alpha, Evas_Colorspace cspace)
|
||||||
|
{
|
||||||
|
switch (cspace) {
|
||||||
|
case EVAS_COLORSPACE_ARGB8888:
|
||||||
|
return evas_common_convert_gry8_to_argb8888(data, w, h, stride, has_alpha);
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static inline void *
|
static inline void *
|
||||||
evas_common_convert_argb8888_to_a8(void *data, int w, int h, int stride, Eina_Bool has_alpha)
|
evas_common_convert_argb8888_to_a8(void *data, int w, int h, int stride, Eina_Bool has_alpha)
|
||||||
{
|
{
|
||||||
|
@ -68,8 +152,6 @@ evas_common_convert_argb8888_to_a8(void *data, int w, int h, int stride, Eina_Bo
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EAPI void *
|
EAPI void *
|
||||||
evas_common_convert_argb8888_to(void *data, int w, int h, int stride, Eina_Bool has_alpha, Evas_Colorspace cspace)
|
evas_common_convert_argb8888_to(void *data, int w, int h, int stride, Eina_Bool has_alpha, Evas_Colorspace cspace)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,5 +8,7 @@ EAPI void *evas_common_convert_yuv_422P_601_to(void *data, int w, int h, Evas_Co
|
||||||
EAPI void *evas_common_convert_yuv_422_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);
|
||||||
EAPI void *evas_common_convert_yuv_420_601_to (void *data, int w, int h, Evas_Colorspace cspace);
|
EAPI void *evas_common_convert_yuv_420_601_to (void *data, int w, int h, Evas_Colorspace cspace);
|
||||||
EAPI void *evas_common_convert_yuv_420T_601_to(void *data, int w, int h, Evas_Colorspace cspace);
|
EAPI void *evas_common_convert_yuv_420T_601_to(void *data, int w, int h, Evas_Colorspace cspace);
|
||||||
|
void *evas_common_convert_agry88_to(const void *data, int w, int h, int stride, Eina_Bool has_alpha, Evas_Colorspace cspace);
|
||||||
|
void *evas_common_convert_gry8_to(const void *data, int w, int h, int stride, Eina_Bool has_alpha, Evas_Colorspace cspace);
|
||||||
|
|
||||||
#endif /* _EVAS_CONVERT_COLORSPACE_H */
|
#endif /* _EVAS_CONVERT_COLORSPACE_H */
|
||||||
|
|
|
@ -970,6 +970,8 @@ eng_image_data_put(void *data, void *image, DATA32 *image_data)
|
||||||
switch (im->cs.space)
|
switch (im->cs.space)
|
||||||
{
|
{
|
||||||
case EVAS_COLORSPACE_ARGB8888:
|
case EVAS_COLORSPACE_ARGB8888:
|
||||||
|
case EVAS_COLORSPACE_AGRY88:
|
||||||
|
case EVAS_COLORSPACE_GRY8:
|
||||||
if ((!im->im) || (image_data != im->im->image.data))
|
if ((!im->im) || (image_data != im->im->image.data))
|
||||||
{
|
{
|
||||||
im2 = eng_image_new_from_data(data, im->w, im->h, image_data,
|
im2 = eng_image_new_from_data(data, im->w, im->h, image_data,
|
||||||
|
@ -997,8 +999,8 @@ eng_image_data_put(void *data, void *image, DATA32 *image_data)
|
||||||
evas_gl_common_image_dirty(im, 0, 0, 0, 0);
|
evas_gl_common_image_dirty(im, 0, 0, 0, 0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
abort();
|
ERR("colorspace %d is not supported here", im->cs.space);
|
||||||
break;
|
return NULL;
|
||||||
}
|
}
|
||||||
return im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue