lvgl: [5.2-dev] Missing preprocessor inclusion

My setting: #define LV_VDB_SIZE 0 #define USE_LV_REAL_DRAW 1 #define USE_LV_IMG 1

file : lv_draw.c

#if LV_VDB_SIZE != 0
void (*px_fp)(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) = lv_vpx;
void (*fill_fp)(const lv_area_t * coords, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) =  lv_vfill;
void (*letter_fp)(const lv_point_t * pos_p, const lv_area_t * mask, const lv_font_t * font_p, uint32_t letter, lv_color_t color, lv_opa_t opa) = lv_vletter;
#  if USE_LV_IMG
void (*map_fp)(const lv_area_t * cords_p, const lv_area_t * mask_p,
               const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
               lv_color_t recolor, lv_opa_t recolor_opa) = lv_vmap;
#  endif /*USE_LV_IMG*/
#elif USE_LV_REAL_DRAW != 0
/* px_fp used only by shadow drawing and anti aliasing */
void (*px_fp)(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) = lv_rpx;
void (*fill_fp)(const lv_area_t * coords, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) =  lv_rfill;
void (*letter_fp)(const lv_point_t * pos_p, const lv_area_t * mask, const lv_font_t * font_p, uint32_t letter, lv_color_t color, lv_opa_t opa) = lv_rletter;
#  if USE_LV_IMG
void (*map_fp)(const lv_area_t * cords_p, const lv_area_t * mask_p,
                      const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
                      lv_color_t recolor, lv_opa_t recolor_opa) = lv_rmap;
#  endif /*USE_LV_IMG*/
#else
/*Invalid settings. Compiler error will be thrown*/
void (*px_fp)(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) = NULL;
void (*fill_fp)(const lv_area_t * coords, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) =  NULL;
void (*letter_fp)(const lv_point_t * pos_p, const lv_area_t * mask, const lv_font_t * font_p, uint32_t letter, lv_color_t color, lv_opa_t opa) = NULL;
void (*map_fp)(const lv_area_t * cords_p, const lv_area_t * mask_p,
                      const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
                      lv_color_t recolor, lv_opa_t recolor_opa) = NULL;
#endif

file: lv_draw.h

extern void (*px_fp)(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_color_t color, lv_opa_t opa);
extern void (*fill_fp)(const lv_area_t * coords, const lv_area_t * mask, lv_color_t color, lv_opa_t opa);
extern void (*letter_fp)(const lv_point_t * pos_p, const lv_area_t * mask, const lv_font_t * font_p, uint32_t letter, lv_color_t color, lv_opa_t opa);
extern void (*map_fp)(const lv_area_t * cords_p, const lv_area_t * mask_p,
               const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
               lv_color_t recolor, lv_opa_t recolor_opa);

The problem with my setting: the compiler don’t found px_fp declaration. The reason, it is called even if px_fp is used only by shadow drawing and anti aliasing.

To fix my problem, i just remove comment and declare it. I don’t no if it i was the best way ? If it is not used like the comment said, it is better to add new preprocessor inclusion to remove theses call when theses settings are set. What it is the best ? Need patch this file : lv_draw_line.c I will do a pull request once i got the answer 😃

PS: preprocessor inclusion are sources of recurring errors. I observe that when lvgl will only work with a VDB, a lot of configuration like these will be removed. It is a good thing.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (15 by maintainers)

Most upvoted comments

Hi,

I forget LV_COLOR_DEPTH 1. It should be fine now.

I was sure -Wall was enabled at me but it wasn’t… Now I added it and fixed some additional warnings.