Evas: Directly load ETC2 and ETC1+Alpha formats from Eet

When loading those formats from an Eet file, software fallback was
always happening.
This commit is contained in:
Jean-Philippe Andre 2014-08-08 13:46:22 +09:00
parent a94ecda7c0
commit 7242ea324a
1 changed files with 40 additions and 5 deletions

View File

@ -69,6 +69,21 @@ static const Evas_Colorspace cspaces_etc1[2] = {
EVAS_COLORSPACE_ARGB8888 EVAS_COLORSPACE_ARGB8888
}; };
static const Evas_Colorspace cspaces_etc1_alpha[] = {
EVAS_COLORSPACE_ETC1_ALPHA,
EVAS_COLORSPACE_ARGB8888
};
static const Evas_Colorspace cspaces_etc2_rgb[] = {
EVAS_COLORSPACE_RGB8_ETC2,
EVAS_COLORSPACE_ARGB8888
};
static const Evas_Colorspace cspaces_etc2_rgba[] = {
EVAS_COLORSPACE_RGBA8_ETC2_EAC,
EVAS_COLORSPACE_ARGB8888
};
static Eina_Bool static Eina_Bool
evas_image_load_file_head_eet(void *loader_data, evas_image_load_file_head_eet(void *loader_data,
Evas_Image_Property *prop, Evas_Image_Property *prop,
@ -94,11 +109,28 @@ evas_image_load_file_head_eet(void *loader_data,
if (cspaces != NULL) if (cspaces != NULL)
{ {
for (i = 0; cspaces[i] != EET_COLORSPACE_ARGB8888; i++) for (i = 0; cspaces[i] != EET_COLORSPACE_ARGB8888; i++)
if (cspaces[i] == EET_COLORSPACE_ETC1) {
{ if (cspaces[i] == EET_COLORSPACE_ETC1)
prop->cspaces = cspaces_etc1; {
break; prop->cspaces = cspaces_etc1;
} break;
}
else if (cspaces[i] == EET_COLORSPACE_ETC1_ALPHA)
{
prop->cspaces = cspaces_etc1_alpha;
break;
}
else if (cspaces[i] == EET_COLORSPACE_RGB8_ETC2)
{
prop->cspaces = cspaces_etc2_rgb;
break;
}
else if (cspaces[i] == EET_COLORSPACE_RGBA8_ETC2_EAC)
{
prop->cspaces = cspaces_etc2_rgba;
break;
}
}
} }
} }
@ -124,6 +156,9 @@ evas_image_load_file_data_eet(void *loader_data,
switch (prop->cspace) switch (prop->cspace)
{ {
case EVAS_COLORSPACE_ETC1: cspace = EET_COLORSPACE_ETC1; break; case EVAS_COLORSPACE_ETC1: cspace = EET_COLORSPACE_ETC1; break;
case EVAS_COLORSPACE_ETC1_ALPHA: cspace = EET_COLORSPACE_ETC1_ALPHA; break;
case EVAS_COLORSPACE_RGB8_ETC2: cspace = EET_COLORSPACE_RGB8_ETC2; break;
case EVAS_COLORSPACE_RGBA8_ETC2_EAC: cspace = EET_COLORSPACE_RGBA8_ETC2_EAC; break;
case EVAS_COLORSPACE_ARGB8888: cspace = EET_COLORSPACE_ARGB8888; break; case EVAS_COLORSPACE_ARGB8888: cspace = EET_COLORSPACE_ARGB8888; break;
default: default:
return _evas_image_load_return_error(EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED, error); return _evas_image_load_return_error(EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED, error);