1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-02-04 07:13:00 +08:00

Merge pull request #405 from aenchevich/dev-5.2

Fixing some compile-time errors and warning (on mipsel-gcc 4.6)
This commit is contained in:
Gabor Kiss-Vamosi 2018-09-14 12:19:20 +02:00 committed by GitHub
commit 071343da5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 295 additions and 321 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*/
} }
@ -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);
@ -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");
@ -504,14 +490,12 @@ static lv_res_t lv_img_decoder_read_line(lv_coord_t x, lv_coord_t y, lv_coord_t
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");

View File

@ -246,7 +246,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;

View File

@ -10,11 +10,14 @@
extern "C" { extern "C" {
#endif #endif
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h"
#else
#include "../../lv_conf.h" #include "../../lv_conf.h"
#endif
#if USE_LV_FILESYSTEM #if USE_LV_FILESYSTEM

View File

@ -13,7 +13,11 @@ extern "C" {
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h"
#else
#include "../../lv_conf.h" #include "../../lv_conf.h"
#endif
#include <stdint.h> #include <stdint.h>
/********************* /*********************

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);
} }
} }