You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/04/16 11:06:14 UTC

[incubator-nuttx-apps] branch master updated: graphics/littlevgl: Fix lvgl internal warning with patch

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 5018ee2  graphics/littlevgl: Fix lvgl internal warning with patch
5018ee2 is described below

commit 5018ee264c820bebed7e8d9b69005f4f655961c6
Author: Qi Huang <hu...@xiaomi.com>
AuthorDate: Thu Apr 16 10:00:58 2020 +0000

    graphics/littlevgl: Fix lvgl internal warning with patch
    
    examples/lvgldemo: Fix build warning with specific config
    
    Signed-off-by: Qi Huang <hu...@xiaomi.com>
---
 examples/lvgldemo/lv_test_theme_2.c     | 22 +++++++++++++---------
 graphics/littlevgl/Makefile             |  8 +++++++-
 graphics/littlevgl/lv_fix_warning.patch | 26 ++++++++++++++++++++++++++
 3 files changed, 46 insertions(+), 10 deletions(-)

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 hue_select_event_cb(lv_obj_t *roller, lv_event_t event)
 
 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 init_all_themes(uint16_t hue)
 
 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 @@ WGET ?= wget
 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 @@ $(LVGL_UNPACKNAME): $(LVGL_TARBALL)
 	$(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) {