edje - store original size in edje struct and dont exceed max size

evas can tell us max texture size. in edje when we have image sets
(multiple images that make up mipmaps effectively for a logical
image), we now can avoid choosing an image that exceeds max texture
size. this actually fixes bugs i have seen on the rpi3 which has a max
texture size of 2048 which makes it easy to exceed it with wallpapers
or even terminology's default theme.

so combo of new feature and fix... but requires a rebuild of the edj
files...

@feat + @fix
This commit is contained in:
Carsten Haitzler 2020-01-22 23:31:30 +00:00
parent 97098dcc50
commit 68d7f584cb
2 changed files with 10 additions and 1 deletions

View File

@ -552,7 +552,7 @@ _edje_image_find(Evas_Object *obj, Edje *ed, Edje_Real_Part_Set **eps,
Edje_Image_Directory_Set_Entry *entry;
Edje_Image_Directory_Set *set = NULL;
Eina_List *l;
int w = 0, h = 0, id;
int w = 0, h = 0, id, maxw = 0, maxh = 0;
if (!st && !imid) return -1;
if (st && !st->image.set) return st->image.id;
@ -581,8 +581,15 @@ _edje_image_find(Evas_Object *obj, Edje *ed, Edje_Real_Part_Set **eps,
if (!set) set = ed->file->image_dir->sets + id;
if (set->entries)
evas_image_max_size_get(evas_object_evas_get(obj), &maxw, &maxh);
EINA_LIST_FOREACH(set->entries, l, entry)
{
// skip images that exceed max size
if ((maxw > 0) && (maxh > 0) &&
(entry->size.w > 0) && (entry->size.h > 0) &&
((w > entry->size.w) || (h > entry->size.h)))
continue;
if ((entry->size.min.w <= w) && (w <= entry->size.max.w))
{
if ((entry->size.min.h <= h) && (h <= entry->size.max.h))

View File

@ -399,6 +399,8 @@ _edje_edd_init(void)
eet_data_descriptor_file_new(&eddc);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "name", name, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "id", id, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "w", size.w, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "h", size.h, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "min.w", size.min.w, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "min.h", size.min.h, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "max.w", size.max.w, EET_T_INT);