Fixing some compile-time errors and warning (on mipsel-gcc 4.6)

This commit is contained in:
Alexander
2018-09-12 18:55:28 +03:00
parent a89548ed48
commit a6b3addb4f
4 changed files with 287 additions and 320 deletions

View File

@@ -38,7 +38,7 @@ static lv_img_src_t decoder_src_type;
static lv_img_header_t decoder_header; static lv_img_header_t decoder_header;
static const lv_style_t * decoder_style; static const lv_style_t * decoder_style;
static lv_fs_file_t decoder_file; static lv_fs_file_t decoder_file;
static lv_color_t decoder_index_map[256] = {LV_COLOR_RED, LV_COLOR_BLUE, LV_COLOR_GREEN, LV_COLOR_PURPLE}; static lv_color_t decoder_index_map[256] = {{{0}}};
static lv_img_decoder_info_f_t lv_img_decoder_info_custom; static lv_img_decoder_info_f_t lv_img_decoder_info_custom;
static lv_img_decoder_open_f_t lv_img_decoder_open_custom; static lv_img_decoder_open_f_t lv_img_decoder_open_custom;
@@ -102,7 +102,6 @@ lv_res_t lv_img_dsc_get_info(const char * src, lv_img_header_t * header)
lv_img_src_t src_type = lv_img_src_get_type(src); lv_img_src_t src_type = lv_img_src_get_type(src);
if(src_type == LV_IMG_SRC_VARIABLE) { if(src_type == LV_IMG_SRC_VARIABLE) {
header->cf =
header->w = ((lv_img_dsc_t *)src)->header.w; header->w = ((lv_img_dsc_t *)src)->header.w;
header->h = ((lv_img_dsc_t *)src)->header.h; header->h = ((lv_img_dsc_t *)src)->header.h;
header->cf = ((lv_img_dsc_t *)src)->header.cf; header->cf = ((lv_img_dsc_t *)src)->header.cf;
@@ -231,11 +230,9 @@ lv_img_src_t lv_img_src_get_type(const void * src)
/*The first byte shows the type of the image source*/ /*The first byte shows the type of the image source*/
if(u8_p[0] >= 0x20 && u8_p[0] <= 0x7F) { if(u8_p[0] >= 0x20 && u8_p[0] <= 0x7F) {
return LV_IMG_SRC_FILE; /*If it's an ASCII character then it's file name*/ return LV_IMG_SRC_FILE; /*If it's an ASCII character then it's file name*/
} } else if(u8_p[0] >= 0x80) {
else if(u8_p[0] >= 0x80) {
return LV_IMG_SRC_SYMBOL; /*Symbols begins after 0x7F*/ return LV_IMG_SRC_SYMBOL; /*Symbols begins after 0x7F*/
} } else {
else {
return LV_IMG_SRC_VARIABLE; /*`lv_img_dsc_t` is design to the first byte < 0x20*/ return LV_IMG_SRC_VARIABLE; /*`lv_img_dsc_t` is design to the first byte < 0x20*/
} }
@@ -254,7 +251,7 @@ void lv_img_decoder_set_custom(lv_img_decoder_info_f_t info_fp, lv_img_decoder_
{ {
lv_img_decoder_info_custom = info_fp; lv_img_decoder_info_custom = info_fp;
lv_img_decoder_open_custom = open_fp; lv_img_decoder_open_custom = open_fp;
lv_img_decoder_read_line_custom= read_fp; lv_img_decoder_read_line_custom = read_fp;
lv_img_decoder_close_custom = close_fp; lv_img_decoder_close_custom = close_fp;
} }
@@ -387,8 +384,7 @@ static const uint8_t * lv_img_decoder_open(const void * src, const lv_style_t *
lv_img_cf_t cf = decoder_header.cf; lv_img_cf_t cf = decoder_header.cf;
if(cf == LV_IMG_CF_TRUE_COLOR || if(cf == LV_IMG_CF_TRUE_COLOR ||
cf == LV_IMG_CF_TRUE_COLOR_ALPHA || cf == LV_IMG_CF_TRUE_COLOR_ALPHA ||
cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED) cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED) {
{
if(decoder_src_type == LV_IMG_SRC_VARIABLE) { if(decoder_src_type == LV_IMG_SRC_VARIABLE) {
/*In case of uncompressed formats if the image stored in the ROM/RAM simply give it's pointer*/ /*In case of uncompressed formats if the image stored in the ROM/RAM simply give it's pointer*/
return ((lv_img_dsc_t *)decoder_src)->data; return ((lv_img_dsc_t *)decoder_src)->data;
@@ -396,12 +392,10 @@ static const uint8_t * lv_img_decoder_open(const void * src, const lv_style_t *
/*If it's file it need to be read line by line later*/ /*If it's file it need to be read line by line later*/
return NULL; return NULL;
} }
} } else if(cf == LV_IMG_CF_INDEXED_1BIT ||
else if (cf == LV_IMG_CF_INDEXED_1BIT ||
cf == LV_IMG_CF_INDEXED_2BIT || cf == LV_IMG_CF_INDEXED_2BIT ||
cf == LV_IMG_CF_INDEXED_4BIT || cf == LV_IMG_CF_INDEXED_4BIT ||
cf == LV_IMG_CF_INDEXED_8BIT) cf == LV_IMG_CF_INDEXED_8BIT) {
{
lv_color24_t palette_file[256]; lv_color24_t palette_file[256];
lv_color24_t * palette_p = NULL; lv_color24_t * palette_p = NULL;
uint8_t px_size = lv_img_color_format_get_px_size(cf); uint8_t px_size = lv_img_color_format_get_px_size(cf);
@@ -416,7 +410,7 @@ static const uint8_t * lv_img_decoder_open(const void * src, const lv_style_t *
palette_file[0] = 0; /*Just to solve warnings*/ palette_file[0] = 0; /*Just to solve warnings*/
#endif #endif
} else { } else {
palette_p = (lv_color_t*)((lv_img_dsc_t *)decoder_src)->data; palette_p = (lv_color_t *)((lv_img_dsc_t *)decoder_src)->data;
} }
uint32_t i; uint32_t i;
@@ -424,16 +418,12 @@ static const uint8_t * lv_img_decoder_open(const void * src, const lv_style_t *
decoder_index_map[i] = LV_COLOR_MAKE(palette_p[i].red, palette_p[i].green, palette_p[i].blue); decoder_index_map[i] = LV_COLOR_MAKE(palette_p[i].red, palette_p[i].green, palette_p[i].blue);
} }
return NULL; return NULL;
} } else if(cf == LV_IMG_CF_ALPHA_1BIT ||
else if (cf == LV_IMG_CF_ALPHA_1BIT ||
cf == LV_IMG_CF_ALPHA_2BIT || cf == LV_IMG_CF_ALPHA_2BIT ||
cf == LV_IMG_CF_ALPHA_4BIT || cf == LV_IMG_CF_ALPHA_4BIT ||
cf == LV_IMG_CF_ALPHA_8BIT) cf == LV_IMG_CF_ALPHA_8BIT) {
{
return NULL; /*Nothing to process*/ return NULL; /*Nothing to process*/
} } else {
else
{
LV_LOG_WARN("Image decoder open: unknown color format") LV_LOG_WARN("Image decoder open: unknown color format")
return LV_IMG_DECODER_OPEN_FAIL; return LV_IMG_DECODER_OPEN_FAIL;
} }
@@ -462,8 +452,7 @@ static lv_res_t lv_img_decoder_read_line(lv_coord_t x, lv_coord_t y, lv_coord_t
if(decoder_header.cf == LV_IMG_CF_TRUE_COLOR || if(decoder_header.cf == LV_IMG_CF_TRUE_COLOR ||
decoder_header.cf == LV_IMG_CF_TRUE_COLOR_ALPHA || decoder_header.cf == LV_IMG_CF_TRUE_COLOR_ALPHA ||
decoder_header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED) decoder_header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED) {
{
uint32_t pos = ((y * decoder_header.w + x) * px_size) >> 3; uint32_t pos = ((y * decoder_header.w + x) * px_size) >> 3;
res = lv_fs_seek(&decoder_file, pos); res = lv_fs_seek(&decoder_file, pos);
if(res != LV_FS_RES_OK) { if(res != LV_FS_RES_OK) {
@@ -477,18 +466,15 @@ static lv_res_t lv_img_decoder_read_line(lv_coord_t x, lv_coord_t y, lv_coord_t
LV_LOG_WARN("Built-in image decoder read failed"); LV_LOG_WARN("Built-in image decoder read failed");
return false; return false;
} }
} } else if(decoder_header.cf == LV_IMG_CF_ALPHA_1BIT ||
else if(decoder_header.cf == LV_IMG_CF_ALPHA_1BIT ||
decoder_header.cf == LV_IMG_CF_ALPHA_2BIT || decoder_header.cf == LV_IMG_CF_ALPHA_2BIT ||
decoder_header.cf == LV_IMG_CF_ALPHA_4BIT || decoder_header.cf == LV_IMG_CF_ALPHA_4BIT ||
decoder_header.cf == LV_IMG_CF_ALPHA_8BIT) decoder_header.cf == LV_IMG_CF_ALPHA_8BIT) {
{
lv_img_built_in_decoder_line_alpha(x, y, len, buf); lv_img_built_in_decoder_line_alpha(x, y, len, buf);
} else if(decoder_header.cf == LV_IMG_CF_INDEXED_1BIT || } else if(decoder_header.cf == LV_IMG_CF_INDEXED_1BIT ||
decoder_header.cf == LV_IMG_CF_INDEXED_2BIT || decoder_header.cf == LV_IMG_CF_INDEXED_2BIT ||
decoder_header.cf == LV_IMG_CF_INDEXED_4BIT || decoder_header.cf == LV_IMG_CF_INDEXED_4BIT ||
decoder_header.cf == LV_IMG_CF_INDEXED_8BIT) decoder_header.cf == LV_IMG_CF_INDEXED_8BIT) {
{
lv_img_built_in_decoder_line_indexed(x, y, len, buf); lv_img_built_in_decoder_line_indexed(x, y, len, buf);
} else { } else {
LV_LOG_WARN("Built-in image decoder read not supports the color format"); LV_LOG_WARN("Built-in image decoder read not supports the color format");
@@ -498,20 +484,18 @@ static lv_res_t lv_img_decoder_read_line(lv_coord_t x, lv_coord_t y, lv_coord_t
LV_LOG_WARN("Image built-in decoder can't read file because USE_LV_FILESYSTEM = 0"); LV_LOG_WARN("Image built-in decoder can't read file because USE_LV_FILESYSTEM = 0");
return false; return false;
#endif #endif
} else if (decoder_src_type == LV_IMG_SRC_VARIABLE) { } else if(decoder_src_type == LV_IMG_SRC_VARIABLE) {
const lv_img_dsc_t * img_dsc = decoder_src; const lv_img_dsc_t * img_dsc = decoder_src;
if(img_dsc->header.cf == LV_IMG_CF_ALPHA_1BIT || if(img_dsc->header.cf == LV_IMG_CF_ALPHA_1BIT ||
img_dsc->header.cf == LV_IMG_CF_ALPHA_2BIT || img_dsc->header.cf == LV_IMG_CF_ALPHA_2BIT ||
img_dsc->header.cf == LV_IMG_CF_ALPHA_4BIT || img_dsc->header.cf == LV_IMG_CF_ALPHA_4BIT ||
img_dsc->header.cf == LV_IMG_CF_ALPHA_8BIT) img_dsc->header.cf == LV_IMG_CF_ALPHA_8BIT) {
{
lv_img_built_in_decoder_line_alpha(x, y, len, buf); lv_img_built_in_decoder_line_alpha(x, y, len, buf);
} else if(img_dsc->header.cf == LV_IMG_CF_INDEXED_1BIT || } else if(img_dsc->header.cf == LV_IMG_CF_INDEXED_1BIT ||
img_dsc->header.cf == LV_IMG_CF_INDEXED_2BIT || img_dsc->header.cf == LV_IMG_CF_INDEXED_2BIT ||
img_dsc->header.cf == LV_IMG_CF_INDEXED_4BIT || img_dsc->header.cf == LV_IMG_CF_INDEXED_4BIT ||
img_dsc->header.cf == LV_IMG_CF_INDEXED_8BIT) img_dsc->header.cf == LV_IMG_CF_INDEXED_8BIT) {
{
lv_img_built_in_decoder_line_indexed(x, y, len, buf); lv_img_built_in_decoder_line_indexed(x, y, len, buf);
} else { } else {
LV_LOG_WARN("Built-in image decoder not supports the color format"); LV_LOG_WARN("Built-in image decoder not supports the color format");
@@ -562,7 +546,7 @@ static lv_res_t lv_img_built_in_decoder_line_alpha(lv_coord_t x, lv_coord_t y, l
buf[i * LV_IMG_PX_SIZE_ALPHA_BYTE] = bg_color.full & 0xFF; buf[i * LV_IMG_PX_SIZE_ALPHA_BYTE] = bg_color.full & 0xFF;
buf[i * LV_IMG_PX_SIZE_ALPHA_BYTE + 1] = (bg_color.full >> 8) & 0xFF; buf[i * LV_IMG_PX_SIZE_ALPHA_BYTE + 1] = (bg_color.full >> 8) & 0xFF;
#elif LV_COLOR_DEPTH == 24 #elif LV_COLOR_DEPTH == 24
*((uint32_t*)&buf[i * LV_IMG_PX_SIZE_ALPHA_BYTE]) = bg_color.full; *((uint32_t *)&buf[i * LV_IMG_PX_SIZE_ALPHA_BYTE]) = bg_color.full;
#endif #endif
} }

View File

@@ -81,7 +81,7 @@ void lv_vpx(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t col
lv_disp_t * disp = lv_disp_get_active(); lv_disp_t * disp = lv_disp_get_active();
if(disp->driver.vdb_wr) { if(disp->driver.vdb_wr) {
disp->driver.vdb_wr((uint8_t*)vdb_p->buf, vdb_width, x, y, color, opa); disp->driver.vdb_wr((uint8_t *)vdb_p->buf, vdb_width, x, y, color, opa);
} else { } else {
lv_color_t * vdb_px_p = vdb_p->buf + y * vdb_width + x; lv_color_t * vdb_px_p = vdb_p->buf + y * vdb_width + x;
if(opa == LV_OPA_COVER) { if(opa == LV_OPA_COVER) {
@@ -238,7 +238,7 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
uint8_t letter_w = lv_font_get_real_width(font_p, letter); uint8_t letter_w = lv_font_get_real_width(font_p, letter);
uint8_t letter_h = lv_font_get_height(font_p); uint8_t letter_h = lv_font_get_height(font_p);
uint8_t bpp = lv_font_get_bpp(font_p, letter); /*Bit per pixel (1,2, 4 or 8)*/ uint8_t bpp = lv_font_get_bpp(font_p, letter); /*Bit per pixel (1,2, 4 or 8)*/
uint8_t * bpp_opa_table; const uint8_t * bpp_opa_table;
uint8_t mask_init; uint8_t mask_init;
uint8_t mask; uint8_t mask;
@@ -323,7 +323,7 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
} }
if(disp->driver.vdb_wr) { if(disp->driver.vdb_wr) {
disp->driver.vdb_wr((uint8_t*)vdb_p->buf, vdb_width, disp->driver.vdb_wr((uint8_t *)vdb_p->buf, vdb_width,
(col + pos_x) - vdb_p->area.x1, (row + pos_y) - vdb_p->area.y1, (col + pos_x) - vdb_p->area.x1, (row + pos_y) - vdb_p->area.y1,
color, px_opa); color, px_opa);
} else { } else {
@@ -416,8 +416,8 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
lv_coord_t col; lv_coord_t col;
for(row = masked_a.y1; row <= masked_a.y2; row++) { for(row = masked_a.y1; row <= masked_a.y2; row++) {
for(col = 0; col < map_useful_w; col++) { for(col = 0; col < map_useful_w; col++) {
lv_color_t px_color = (lv_color_t) *((lv_color_t *)&map_p[(uint32_t)col * px_size_byte]); lv_color_t px_color = (lv_color_t) * ((lv_color_t *)&map_p[(uint32_t)col * px_size_byte]);
disp->driver.vdb_wr((uint8_t*)vdb_p->buf, vdb_width, col + masked_a.x1, row, px_color, opa); disp->driver.vdb_wr((uint8_t *)vdb_p->buf, vdb_width, col + masked_a.x1, row, px_color, opa);
} }
map_p += map_width * px_size_byte; /*Next row on the map*/ map_p += map_width * px_size_byte; /*Next row on the map*/
} }
@@ -480,7 +480,7 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
} }
/*Handle custom VDB write is present*/ /*Handle custom VDB write is present*/
if(disp->driver.vdb_wr) { if(disp->driver.vdb_wr) {
disp->driver.vdb_wr((uint8_t*)vdb_p->buf, vdb_width, col + masked_a.x1, row, recolored_px, opa_result); disp->driver.vdb_wr((uint8_t *)vdb_p->buf, vdb_width, col + masked_a.x1, row, recolored_px, opa_result);
} }
/*Normal native VDB write*/ /*Normal native VDB write*/
else { else {
@@ -490,7 +490,7 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
} else { } else {
/*Handle custom VDB write is present*/ /*Handle custom VDB write is present*/
if(disp->driver.vdb_wr) { if(disp->driver.vdb_wr) {
disp->driver.vdb_wr((uint8_t*)vdb_p->buf, vdb_width, col + masked_a.x1, row, px_color, opa_result); disp->driver.vdb_wr((uint8_t *)vdb_p->buf, vdb_width, col + masked_a.x1, row, px_color, opa_result);
} }
/*Normal native VDB write*/ /*Normal native VDB write*/
else { else {
@@ -548,7 +548,7 @@ static void sw_color_fill(lv_area_t * mem_area, lv_color_t * mem, const lv_area_
if(disp->driver.vdb_wr) { if(disp->driver.vdb_wr) {
for(col = fill_area->x1; col <= fill_area->x2; col++) { for(col = fill_area->x1; col <= fill_area->x2; col++) {
for(row = fill_area->y1; row <= fill_area->y2; row++) { for(row = fill_area->y1; row <= fill_area->y2; row++) {
disp->driver.vdb_wr((uint8_t*)mem, mem_width, col, row, color, opa); disp->driver.vdb_wr((uint8_t *)mem, mem_width, col, row, color, opa);
} }
} }
} else { } else {

View File

@@ -505,11 +505,9 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
lv_point_t p; lv_point_t p;
if(sign == LV_SIGNAL_CLEANUP) { if(sign == LV_SIGNAL_CLEANUP) {
lv_mem_free(ext->button_areas); lv_mem_free(ext->button_areas);
} } else if(sign == LV_SIGNAL_STYLE_CHG || sign == LV_SIGNAL_CORD_CHG) {
else if(sign == LV_SIGNAL_STYLE_CHG || sign == LV_SIGNAL_CORD_CHG) {
lv_btnm_set_map(btnm, ext->map_p); lv_btnm_set_map(btnm, ext->map_p);
} } else if(sign == LV_SIGNAL_PRESSING) {
else if(sign == LV_SIGNAL_PRESSING) {
uint16_t btn_pr; uint16_t btn_pr;
/*Search the pressed area*/ /*Search the pressed area*/
lv_indev_get_point(param, &p); lv_indev_get_point(param, &p);
@@ -549,8 +547,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
} }
} }
} }
} } else if(sign == LV_SIGNAL_RELEASED) {
else if(sign == LV_SIGNAL_RELEASED) {
if(ext->btn_id_pr != LV_BTNM_PR_NONE) { if(ext->btn_id_pr != LV_BTNM_PR_NONE) {
if(ext->action) { if(ext->action) {
uint16_t txt_i = get_button_text(btnm, ext->btn_id_pr); uint16_t txt_i = get_button_text(btnm, ext->btn_id_pr);
@@ -592,18 +589,16 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
ext->btn_id_pr = LV_BTNM_PR_NONE; ext->btn_id_pr = LV_BTNM_PR_NONE;
#endif #endif
} }
} } else if(sign == LV_SIGNAL_PRESS_LOST || sign == LV_SIGNAL_DEFOCUS) {
else if(sign == LV_SIGNAL_PRESS_LOST || sign == LV_SIGNAL_DEFOCUS) {
ext->btn_id_pr = LV_BTNM_PR_NONE; ext->btn_id_pr = LV_BTNM_PR_NONE;
lv_obj_invalidate(btnm); lv_obj_invalidate(btnm);
} } else if(sign == LV_SIGNAL_FOCUS) {
else if(sign == LV_SIGNAL_FOCUS) {
#if USE_LV_GROUP #if USE_LV_GROUP
lv_indev_t * indev = lv_indev_get_act(); lv_indev_t * indev = lv_indev_get_act();
if(lv_obj_is_focused(btnm) && lv_indev_get_type(indev) == LV_INDEV_TYPE_POINTER) { if(lv_obj_is_focused(btnm) && lv_indev_get_type(indev) == LV_INDEV_TYPE_POINTER) {
lv_point_t p; lv_point_t p1;
lv_indev_get_point(indev, &p); lv_indev_get_point(indev, &p1);
uint16_t btn_i = get_button_from_point(btnm, &p); uint16_t btn_i = get_button_from_point(btnm, &p1);
ext->btn_id_pr = btn_i; ext->btn_id_pr = btn_i;
} else { } else {
ext->btn_id_pr = 0; ext->btn_id_pr = 0;
@@ -612,8 +607,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
ext->btn_id_pr = 0; ext->btn_id_pr = 0;
#endif #endif
lv_obj_invalidate(btnm); lv_obj_invalidate(btnm);
} } else if(sign == LV_SIGNAL_CONTROLL) {
else if(sign == LV_SIGNAL_CONTROLL) {
char c = *((char *)param); char c = *((char *)param);
if(c == LV_GROUP_KEY_RIGHT) { if(c == LV_GROUP_KEY_RIGHT) {
if(ext->btn_id_pr == LV_BTNM_PR_NONE) ext->btn_id_pr = 0; if(ext->btn_id_pr == LV_BTNM_PR_NONE) ext->btn_id_pr = 0;
@@ -624,8 +618,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
if(ext->btn_id_pr == LV_BTNM_PR_NONE) ext->btn_id_pr = 0; if(ext->btn_id_pr == LV_BTNM_PR_NONE) ext->btn_id_pr = 0;
if(ext->btn_id_pr > 0) ext->btn_id_pr--; if(ext->btn_id_pr > 0) ext->btn_id_pr--;
lv_obj_invalidate(btnm); lv_obj_invalidate(btnm);
} } else if(c == LV_GROUP_KEY_DOWN) {
else if(c == LV_GROUP_KEY_DOWN) {
lv_style_t * style = lv_btnm_get_style(btnm, LV_BTNM_STYLE_BG); lv_style_t * style = lv_btnm_get_style(btnm, LV_BTNM_STYLE_BG);
/*Find the area below the the current*/ /*Find the area below the the current*/
if(ext->btn_id_pr == LV_BTNM_PR_NONE) { if(ext->btn_id_pr == LV_BTNM_PR_NONE) {
@@ -645,8 +638,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
if(area_below < ext->btn_cnt) ext->btn_id_pr = area_below; if(area_below < ext->btn_cnt) ext->btn_id_pr = area_below;
} }
lv_obj_invalidate(btnm); lv_obj_invalidate(btnm);
} } else if(c == LV_GROUP_KEY_UP) {
else if(c == LV_GROUP_KEY_UP) {
lv_style_t * style = lv_btnm_get_style(btnm, LV_BTNM_STYLE_BG); lv_style_t * style = lv_btnm_get_style(btnm, LV_BTNM_STYLE_BG);
/*Find the area below the the current*/ /*Find the area below the the current*/
if(ext->btn_id_pr == LV_BTNM_PR_NONE) { if(ext->btn_id_pr == LV_BTNM_PR_NONE) {
@@ -666,8 +658,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
} }
lv_obj_invalidate(btnm); lv_obj_invalidate(btnm);
} } else if(c == LV_GROUP_KEY_ENTER) {
else if(c == LV_GROUP_KEY_ENTER) {
if(ext->action != NULL) { if(ext->action != NULL) {
uint16_t txt_i = get_button_text(btnm, ext->btn_id_pr); uint16_t txt_i = get_button_text(btnm, ext->btn_id_pr);
if(txt_i != LV_BTNM_PR_NONE) { if(txt_i != LV_BTNM_PR_NONE) {
@@ -675,12 +666,10 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
} }
} }
} }
} } else if(sign == LV_SIGNAL_GET_EDITABLE) {
else if(sign == LV_SIGNAL_GET_EDITABLE) {
bool * editable = (bool *)param; bool * editable = (bool *)param;
*editable = true; *editable = true;
} } else if(sign == LV_SIGNAL_GET_TYPE) {
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/ for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/

View File

@@ -140,8 +140,7 @@ void lv_img_set_src(lv_obj_t * img, const void * src_img)
/*Save the source*/ /*Save the source*/
if(src_type == LV_IMG_SRC_VARIABLE) { if(src_type == LV_IMG_SRC_VARIABLE) {
ext->src = src_img; ext->src = src_img;
} } else if(src_type == LV_IMG_SRC_FILE || src_type == LV_IMG_SRC_SYMBOL) {
else if(src_type == LV_IMG_SRC_FILE || src_type == LV_IMG_SRC_SYMBOL) {
/* If the new and the old src are the same then it was only a refresh.*/ /* If the new and the old src are the same then it was only a refresh.*/
if(ext->src != src_img) { if(ext->src != src_img) {
lv_mem_free(ext->src); lv_mem_free(ext->src);
@@ -151,9 +150,7 @@ void lv_img_set_src(lv_obj_t * img, const void * src_img)
strcpy(new_str, src_img); strcpy(new_str, src_img);
ext->src = new_str; ext->src = new_str;
} }
} } else if(src_type == LV_IMG_SRC_SYMBOL) {
if(src_type == LV_IMG_SRC_SYMBOL) {
/*`lv_img_dsc_get_info` couldn't set the with and height of a font so set it here*/ /*`lv_img_dsc_get_info` couldn't set the with and height of a font so set it here*/
lv_style_t * style = lv_img_get_style(img); lv_style_t * style = lv_img_get_style(img);
lv_point_t size; lv_point_t size;
@@ -278,12 +275,9 @@ static bool lv_img_design(lv_obj_t * img, const lv_area_t * mask, lv_design_mode
} }
} else if(ext->src_type == LV_IMG_SRC_SYMBOL) { } else if(ext->src_type == LV_IMG_SRC_SYMBOL) {
lv_draw_label(&coords, mask, style, opa_scale, ext->src, LV_TXT_FLAG_NONE, NULL); lv_draw_label(&coords, mask, style, opa_scale, ext->src, LV_TXT_FLAG_NONE, NULL);
} else { } else {
/*Trigger the error handler of image drawer*/ /*Trigger the error handler of image drawer*/
lv_draw_img(&img->coords, mask, NULL, style, opa_scale); lv_draw_img(&img->coords, mask, NULL, style, opa_scale);
} }
} }