evas - sw generic - fix enum passing with casts or correct types fix wrn

This commit is contained in:
Carsten Haitzler 2020-08-25 09:34:09 +01:00
parent ed12d482d5
commit 880973ebcf
1 changed files with 28 additions and 14 deletions

View File

@ -1518,11 +1518,15 @@ eng_image_data_map(void *engdata EINA_UNUSED, void **image, Eina_Rw_Slice *slice
void *src_data; void *src_data;
int dst_stride, dst_len, dst_offset = 0; int dst_stride, dst_len, dst_offset = 0;
cs_func = efl_draw_convert_func_get(ie->space, cspace, &can_region); cs_func = efl_draw_convert_func_get((Efl_Gfx_Colorspace)ie->space,
(Efl_Gfx_Colorspace)cspace,
&can_region);
if (!cs_func) return EINA_FALSE; if (!cs_func) return EINA_FALSE;
// make sure we can convert back, if map for writing // make sure we can convert back, if map for writing
if (to_write && !efl_draw_convert_func_get(cspace, ie->space, NULL)) if (to_write && !efl_draw_convert_func_get((Efl_Gfx_Colorspace)cspace,
(Efl_Gfx_Colorspace)ie->space,
NULL))
return EINA_FALSE; return EINA_FALSE;
if (can_region) if (can_region)
@ -1554,7 +1558,10 @@ eng_image_data_map(void *engdata EINA_UNUSED, void **image, Eina_Rw_Slice *slice
data = malloc(dst_len); data = malloc(dst_len);
if (!data) return EINA_FALSE; if (!data) return EINA_FALSE;
if (!cs_func(data, src_data, rw, rh, src_stride, dst_stride, ie->flags.alpha, ie->space, cspace)) if (!cs_func(data, src_data, rw, rh, src_stride, dst_stride,
ie->flags.alpha,
(Efl_Gfx_Colorspace)ie->space,
(Efl_Gfx_Colorspace)cspace))
{ {
ERR("color conversion failed"); ERR("color conversion failed");
free(data); free(data);
@ -1656,19 +1663,25 @@ _image_data_commit(RGBA_Image *im, RGBA_Image_Data_Map *map)
Cspace_Convert_Func cs_func; Cspace_Convert_Func cs_func;
Eina_Bool can_region; Eina_Bool can_region;
cs_func = efl_draw_convert_func_get(map->cspace, ie->space, &can_region); cs_func = efl_draw_convert_func_get((Efl_Gfx_Colorspace)map->cspace,
(Efl_Gfx_Colorspace)ie->space,
&can_region);
EINA_SAFETY_ON_NULL_RETURN(cs_func); EINA_SAFETY_ON_NULL_RETURN(cs_func);
DBG("unmap commit: convert func (%p)", cs_func); DBG("unmap commit: convert func (%p)", cs_func);
if (can_region) if (can_region)
{ {
cs_func(dst, map->slice.mem, map->rw, map->rh, map->stride, dst_stride, cs_func(dst, map->slice.mem, map->rw, map->rh, map->stride, dst_stride,
ie->flags.alpha, map->cspace, ie->space); ie->flags.alpha,
(Efl_Gfx_Colorspace)map->cspace,
(Efl_Gfx_Colorspace)ie->space);
} }
else else
{ {
cs_func(dst, map->baseptr, ie->w, ie->h, map->stride, dst_stride, cs_func(dst, map->baseptr, ie->w, ie->h, map->stride, dst_stride,
ie->flags.alpha, map->cspace, ie->space); ie->flags.alpha,
(Efl_Gfx_Colorspace)map->cspace,
(Efl_Gfx_Colorspace)ie->space);
} }
} }
} }
@ -1722,15 +1735,15 @@ eng_image_data_maps_get(void *engdata EINA_UNUSED, const void *image, const Eina
} }
static inline Eina_Bool static inline Eina_Bool
_is_yuv(Efl_Gfx_Colorspace cspace) _is_yuv(Evas_Colorspace cspace)
{ {
switch (cspace) switch (cspace)
{ {
case EFL_GFX_COLORSPACE_YCBCR422P601_PL: case EVAS_COLORSPACE_YCBCR422P601_PL:
case EFL_GFX_COLORSPACE_YCBCR422P709_PL: case EVAS_COLORSPACE_YCBCR422P709_PL:
case EFL_GFX_COLORSPACE_YCBCR422601_PL: case EVAS_COLORSPACE_YCBCR422601_PL:
case EFL_GFX_COLORSPACE_YCBCR420NV12601_PL: case EVAS_COLORSPACE_YCBCR420NV12601_PL:
case EFL_GFX_COLORSPACE_YCBCR420TM12601_PL: case EVAS_COLORSPACE_YCBCR420TM12601_PL:
return EINA_TRUE; return EINA_TRUE;
default: default:
@ -4391,8 +4404,9 @@ eng_ector_buffer_new(void *data, Evas *evas, int width, int height,
} }
// alloc buffer // alloc buffer
ie = evas_cache_image_copied_data(evas_common_image_cache_get(), width, height, ie = evas_cache_image_copied_data(evas_common_image_cache_get(),
NULL, EINA_TRUE, cspace); width, height, NULL, EINA_TRUE,
(Evas_Colorspace)cspace);
if (!ie) return NULL; if (!ie) return NULL;
pixels = ((RGBA_Image *) ie)->image.data; pixels = ((RGBA_Image *) ie)->image.data;
memset(pixels, 0, width * height * pxs); memset(pixels, 0, width * height * pxs);