summaryrefslogtreecommitdiff
path: root/src/lib/edje/edje_calc.c
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-08-13 17:41:36 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-08-13 17:44:37 +0100
commit672d1de7304d412ecae7cc7dc0b5a8fe7309105e (patch)
tree5e2547093ae4a54f9c9b221fa5eada434f6af907 /src/lib/edje/edje_calc.c
parent990c46c94d85103c3c14de692a1e1e855157a6a9 (diff)
edje - calce - really respect max image size for img sets
when you have an image set for an image it wouldnt actually respect image max size and not select something bigger than it.. now it will @fix
Diffstat (limited to '')
-rw-r--r--src/lib/edje/edje_calc.c61
1 files changed, 28 insertions, 33 deletions
diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
index 5d3f42344b..eed9215b23 100644
--- a/src/lib/edje/edje_calc.c
+++ b/src/lib/edje/edje_calc.c
@@ -491,6 +491,25 @@ _edje_part_description_find(Edje *ed, Edje_Real_Part *rp, const char *state_name
491} 491}
492 492
493static int 493static int
494_edje_image_set_fill(Edje_Real_Part_Set **eps,
495 Edje_Image_Directory_Set_Entry *entry,
496 Edje_Image_Directory_Set *set,
497 int id)
498{
499 if (eps)
500 {
501 if (!*eps) *eps = calloc(1, sizeof(Edje_Real_Part_Set));
502 if (*eps)
503 {
504 (*eps)->entry = entry;
505 (*eps)->set = set;
506 (*eps)->id = id;
507 }
508 }
509 return entry->id;
510}
511
512static int
494_edje_image_find(Evas_Object *obj, Edje *ed, Edje_Real_Part_Set **eps, 513_edje_image_find(Evas_Object *obj, Edje *ed, Edje_Real_Part_Set **eps,
495 Edje_Part_Description_Image *st, Edje_Part_Image_Id *imid) 514 Edje_Part_Description_Image *st, Edje_Part_Image_Id *imid)
496{ 515{
@@ -517,9 +536,7 @@ _edje_image_find(Evas_Object *obj, Edje *ed, Edje_Real_Part_Set **eps,
517 { 536 {
518 if (((*eps)->entry->size.min.h <= h) && 537 if (((*eps)->entry->size.min.h <= h) &&
519 (h <= (*eps)->entry->size.max.h)) 538 (h <= (*eps)->entry->size.max.h))
520 { 539 return (*eps)->entry->id;
521 return (*eps)->entry->id;
522 }
523 } 540 }
524 } 541 }
525 } 542 }
@@ -530,46 +547,24 @@ _edje_image_find(Evas_Object *obj, Edje *ed, Edje_Real_Part_Set **eps,
530 evas_image_max_size_get(evas_object_evas_get(obj), &maxw, &maxh); 547 evas_image_max_size_get(evas_object_evas_get(obj), &maxw, &maxh);
531 EINA_LIST_FOREACH(set->entries, l, entry) 548 EINA_LIST_FOREACH(set->entries, l, entry)
532 { 549 {
550 // skip images b
551 if ((entry->size.w > 0) && (entry->size.h > 0) &&
552 ((w > entry->size.w) || (h > entry->size.h)))
553 continue;
533 // skip images that exceed max size 554 // skip images that exceed max size
534 if ((maxw > 0) && (maxh > 0) && 555 if ((maxw > 0) && (maxh > 0) &&
535 (entry->size.w > 0) && (entry->size.h > 0) && 556 ((entry->size.w > maxw) || (entry->size.h > maxh)))
536 ((w > entry->size.w) || (h > entry->size.h)))
537 continue; 557 continue;
538 if ((entry->size.min.w <= w) && (w <= entry->size.max.w)) 558 if ((entry->size.min.w <= w) && (w <= entry->size.max.w))
539 { 559 {
540 if ((entry->size.min.h <= h) && (h <= entry->size.max.h)) 560 if ((entry->size.min.h <= h) && (h <= entry->size.max.h))
541 { 561 return _edje_image_set_fill(eps, entry, set, id);
542 if (eps)
543 {
544 if (!*eps) *eps = calloc(1, sizeof(Edje_Real_Part_Set));
545 if (*eps)
546 {
547 (*eps)->entry = entry;
548 (*eps)->set = set;
549 (*eps)->id = id;
550 }
551 }
552 return entry->id;
553 }
554 } 562 }
555 } 563 }
556 564 // nothing found so pick first - which shouldbe smallest
557 entry = eina_list_data_get(set->entries); 565 entry = eina_list_data_get(set->entries);
558 if (entry) 566 if (entry)
559 { 567 return _edje_image_set_fill(eps, entry, set, id);
560 if (eps)
561 {
562 if (!*eps)
563 *eps = calloc(1, sizeof (Edje_Real_Part_Set));
564 if (*eps)
565 {
566 (*eps)->entry = entry;
567 (*eps)->set = set;
568 (*eps)->id = id;
569 }
570 }
571 return entry->id;
572 }
573 568
574 return -1; 569 return -1;
575} 570}