Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(imagebutton): tiling regression #6195

Merged
merged 3 commits into from May 13, 2024

Conversation

liamHowatt
Copy link
Collaborator

Description of the feature or fix

A regression was introduced by #6029. The lv_imagebutton does not set the image_area field of the lv_draw_image_dsc_t so it still holds the default value set by lv_draw_image_dsc_init of {0, 0, LV_COORD_MIN, 0} when it reaches _lv_draw_image_tiled_helper.

If draw_dsc->image_area is the invalid, fallback on coords which is what it used to always use before #6029. What I do not know is whether this fix will undo the fix done by #6029. @kisvegabor are you able to determine this? Thanks.

Added a test so imagebutton does not break again.

diff --git a/src/draw/lv_draw_image.c b/src/draw/lv_draw_image.c
index 263260613..b4ffb9ad5 100644
--- a/src/draw/lv_draw_image.c
+++ b/src/draw/lv_draw_image.c
@@ -185,7 +185,13 @@ void _lv_draw_image_tiled_helper(lv_draw_unit_t * draw_unit, const lv_draw_image
     int32_t img_w = draw_dsc->header.w;
     int32_t img_h = draw_dsc->header.h;
 
-    lv_area_t tile_area = draw_dsc->image_area;
+    lv_area_t tile_area;
+    if(lv_area_get_width(&draw_dsc->image_area) >= 0) {
+        tile_area = draw_dsc->image_area;
+    }
+    else {
+        tile_area = *coords;
+    }
     lv_area_set_width(&tile_area, img_w);
     lv_area_set_height(&tile_area, img_h);

At the time of creating this PR:
imagebutton_1

Notes

@liamHowatt liamHowatt changed the title fix(img): tiling regression fix(imagebutton): tiling regression May 8, 2024
Copy link
Member

@kisvegabor kisvegabor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Special thanks for the test! 🙂

@kisvegabor kisvegabor merged commit df19f1e into lvgl:master May 13, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants