Sfoglia il codice sorgente

fix: 修正lvgl-lcd-sdl2颜色错误

Wendal Chen 3 anni fa
parent
commit
654cd4f3eb
2 ha cambiato i file con 7 aggiunte e 2 eliminazioni
  1. 1 1
      bsp/sysp/include/luat_conf_bsp.h
  2. 6 1
      components/ui/sdl2/luat_lcd_sdl2.c

+ 1 - 1
bsp/sysp/include/luat_conf_bsp.h

@@ -9,7 +9,7 @@
 
 // #define LUAT_MAIN_DEMO 1
 
-#define USE_U8G2_OPPOSANSM12_CHINESE
+// #define USE_U8G2_OPPOSANSM12_CHINESE
 
 
 //---------------------

+ 6 - 1
components/ui/sdl2/luat_lcd_sdl2.c

@@ -4,6 +4,8 @@
 #include "luat_sdl2.h"
 #include "luat_malloc.h"
 
+#include "lvgl.h"
+
 static uint32_t* fb;
 
 static inline uint32_t luat_color_565to8888(luat_color_t color);
@@ -69,11 +71,14 @@ int luat_lcd_draw(luat_lcd_conf_t* conf, uint16_t x1, uint16_t y1, uint16_t x2,
     size_t rh = y2 - y1 + 1;
 
     uint32_t *tmp = fb;
+    lv_color_t c;
     for (size_t i = 0; i < rh; i++)
     {
         for (size_t j = 0; j < rw; j++)
         {
-            *tmp = luat_color_565to8888(*color_p);
+            // *tmp = luat_color_565to8888(*color_p);
+            c.full = *color_p;
+            *tmp = lv_color_to32(c);
             tmp ++;
             color_p ++;
         }