graphics/littlevgl: Fix lvgl internal warning with patch
examples/lvgldemo: Fix build warning with specific config
Signed-off-by: Qi Huang <huangqi3@xiaomi.com>
diff --git a/examples/lvgldemo/lv_test_theme_2.c b/examples/lvgldemo/lv_test_theme_2.c
index bcc016c..2ea40cd 100644
--- a/examples/lvgldemo/lv_test_theme_2.c
+++ b/examples/lvgldemo/lv_test_theme_2.c
@@ -448,33 +448,37 @@
static void init_all_themes(uint16_t hue)
{
- int i = 0;
+ int i = 0;
+
+ /* Disalbe warning when no theme selected. */
+
+ UNUSED(i);
#if LV_USE_THEME_NIGHT
- themes[i++] = lv_theme_night_init(hue, NULL);
+ themes[i++] = lv_theme_night_init(hue, NULL);
#endif
#if LV_USE_THEME_MATERIAL
- themes[i++] = lv_theme_material_init(hue, NULL);
+ themes[i++] = lv_theme_material_init(hue, NULL);
#endif
#if LV_USE_THEME_ALIEN
- themes[i++] = lv_theme_alien_init(hue, NULL);
+ themes[i++] = lv_theme_alien_init(hue, NULL);
#endif
#if LV_USE_THEME_ZEN
- themes[i++] = lv_theme_zen_init(hue, NULL);
+ themes[i++] = lv_theme_zen_init(hue, NULL);
#endif
#if LV_USE_THEME_NEMO
- themes[i++] = lv_theme_nemo_init(hue, NULL);
+ themes[i++] = lv_theme_nemo_init(hue, NULL);
#endif
#if LV_USE_THEME_MONO
- themes[i++] = lv_theme_mono_init(hue, NULL);
+ themes[i++] = lv_theme_mono_init(hue, NULL);
#endif
#if LV_USE_THEME_DEFAULT
- themes[i++] = lv_theme_default_init(hue, NULL);
+ themes[i++] = lv_theme_default_init(hue, NULL);
#endif
}
@@ -492,7 +496,7 @@
static void bar_set_value(lv_obj_t *bar, int16_t value)
{
- lv_bar_set_value(bar, value, LV_ANIM_OFF);
+ lv_bar_set_value(bar, value, LV_ANIM_OFF);
}
/****************************************************************************
diff --git a/graphics/littlevgl/Makefile b/graphics/littlevgl/Makefile
index b382a04..fbb6d39 100644
--- a/graphics/littlevgl/Makefile
+++ b/graphics/littlevgl/Makefile
@@ -62,6 +62,9 @@
LVGL_UNPACKNAME = lvgl
UNPACK ?= unzip -o
+PATCH_FILES = lv_fix_warning.patch
+PATCH ?= patch -p0
+
LVGL_UNPACKDIR = $(WD)/$(LVGL_UNPACKNAME)
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(APPDIR)/graphics/littlevgl}
@@ -76,10 +79,13 @@
$(Q) mv lvgl-$(LVGL_VERSION) $(LVGL_UNPACKNAME)
$(Q) touch $(LVGL_UNPACKNAME)
+$(LVGL_UNPACKNAME)/.patched: $(LVGL_UNPACKNAME) $(PATCH_FILES)
+ $(Q) cat $(PATCH_FILES) | $(PATCH)
+ $(Q) touch $(LVGL_UNPACKNAME)/.patched
lvgl/lvgl.h: $(LVGL_UNPACKNAME)
-$(APPDIR)/include/graphics/lvgl.h: lvgl/lvgl.h
+$(APPDIR)/include/graphics/lvgl.h: lvgl/lvgl.h $(LVGL_UNPACKNAME)/.patched
@echo "CP: lvgl/lvgl.h"
$(Q) cp lvgl/lvgl.h $(APPDIR)/include/graphics/lvgl.h
diff --git a/graphics/littlevgl/lv_fix_warning.patch b/graphics/littlevgl/lv_fix_warning.patch
new file mode 100644
index 0000000..1feb7bb
--- /dev/null
+++ b/graphics/littlevgl/lv_fix_warning.patch
@@ -0,0 +1,26 @@
+diff -ur lvgl-6.1.2/src/lv_draw/lv_draw_basic.c lvgl/src/lv_draw/lv_draw_basic.c
+--- lvgl-6.1.2/src/lv_draw/lv_draw_basic.c 2020-02-26 22:35:12.000000000 +0000
++++ lvgl/src/lv_draw/lv_draw_basic.c 2020-04-16 09:24:53.015257341 +0000
+@@ -530,7 +530,7 @@
+ else {
+ for(row = masked_a.y1; row <= masked_a.y2; row++) {
+ #if LV_USE_GPU
+- if(disp->driver.gpu_blend_cb == false) {
++ if(disp->driver.gpu_blend_cb == NULL) {
+ sw_mem_blend(vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa);
+ } else {
+ disp->driver.gpu_blend_cb(&disp->driver, vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa);
+diff -ur lvgl-6.1.2/src/lv_objx/lv_img.c lvgl/src/lv_objx/lv_img.c
+--- lvgl-6.1.2/src/lv_objx/lv_img.c 2020-02-26 22:35:12.000000000 +0000
++++ lvgl/src/lv_objx/lv_img.c 2020-04-16 09:24:23.419691790 +0000
+@@ -355,8 +355,8 @@
+
+ if(ext->cf == LV_IMG_CF_TRUE_COLOR || ext->cf == LV_IMG_CF_RAW) cover = lv_area_is_in(mask, &img->coords);
+
+- const lv_style_t * style = lv_img_get_style(img, LV_IMG_STYLE_MAIN);
+- if(style->image.opa < LV_OPA_MAX) return false;
++ const lv_style_t * style_ = lv_img_get_style(img, LV_IMG_STYLE_MAIN);
++ if(style_->image.opa < LV_OPA_MAX) return false;
+
+ return cover;
+ } else if(mode == LV_DESIGN_DRAW_MAIN) {