From 10eeeb2490b884275bcd9a3c8db30600c85f5721 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 31 Aug 2020 11:18:40 +0200 Subject: [PATCH] image cover check: minor reordering for better performance --- src/lv_widgets/lv_img.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lv_widgets/lv_img.c b/src/lv_widgets/lv_img.c index 911db34ea..dc95c4985 100644 --- a/src/lv_widgets/lv_img.c +++ b/src/lv_widgets/lv_img.c @@ -580,6 +580,9 @@ static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area /*Non true color format might have "holes"*/ if(ext->cf != LV_IMG_CF_TRUE_COLOR && ext->cf != LV_IMG_CF_RAW) return LV_DESIGN_RES_NOT_COVER; + /*With not LV_OPA_COVER images acn't cover an area */ + if(lv_obj_get_style_image_opa(img, LV_IMG_PART_MAIN) != LV_OPA_COVER) return LV_DESIGN_RES_NOT_COVER; + int32_t angle_final = lv_obj_get_style_transform_angle(img, LV_IMG_PART_MAIN); angle_final += ext->angle; @@ -602,8 +605,6 @@ static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area if(_lv_area_is_in(clip_area, &a, 0) == false) return LV_DESIGN_RES_NOT_COVER; } - if(lv_obj_get_style_image_opa(img, LV_IMG_PART_MAIN) != LV_OPA_COVER) return LV_DESIGN_RES_NOT_COVER; - return LV_DESIGN_RES_COVER; } else if(mode == LV_DESIGN_DRAW_MAIN) {