1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

merge master

This commit is contained in:
Gabor Kiss-Vamosi 2019-12-19 14:38:36 +01:00
commit 51e827776f
9 changed files with 33 additions and 28 deletions

View File

@ -85,7 +85,7 @@ lv_img_cache_entry_t * lv_img_cache_open(const void * src, const lv_style_t * st
bool match = false;
lv_img_src_t src_type = lv_img_src_get_type(cache[i].dec_dsc.src);
if(src_type == LV_IMG_SRC_VARIABLE) {
if(cache[i].dec_dsc.src == src) match = true;
if(cache[i].dec_dsc.src == src && cache[i].dec_dsc.style == style) match = true;
} else if(src_type == LV_IMG_SRC_FILE) {
if(strcmp(cache[i].dec_dsc.src, src) == 0) match = true;
}

View File

@ -104,9 +104,9 @@ enum {
# define LV_COLOR_GET_B1(c) (c).ch.blue
# define LV_COLOR_GET_A1(c) 1
# define LV_COLOR_SET_R8(c, v) (c).ch.red = (uint8_t)((v) & 0x7);
# define LV_COLOR_SET_G8(c, v) (c).ch.green = (uint8_t)((v) & 0x7);
# define LV_COLOR_SET_B8(c, v) (c).ch.blue = (uint8_t)((v) & 0x3);
# define LV_COLOR_SET_R8(c, v) (c).ch.red = (uint8_t)(v) & 0x7U;
# define LV_COLOR_SET_G8(c, v) (c).ch.green = (uint8_t)(v) & 0x7U;
# define LV_COLOR_SET_B8(c, v) (c).ch.blue = (uint8_t)(v) & 0x3U;
# define LV_COLOR_SET_A8(c, v) do {} while(0)
# define LV_COLOR_GET_R8(c) (c).ch.red
@ -114,10 +114,10 @@ enum {
# define LV_COLOR_GET_B8(c) (c).ch.blue
# define LV_COLOR_GET_A8(c) 0xFF
# define LV_COLOR_SET_R16(c, v) (c).ch.red = (uint8_t)(((uint8_t)(v)) & 0x1F);
# define LV_COLOR_SET_G16(c, v) (c).ch.green = (uint8_t)((v) & 0x3F);
# define LV_COLOR_SET_R16(c, v) (c).ch.red = (uint8_t)(v) & 0x1FU;
# define LV_COLOR_SET_G16(c, v) (c).ch.green = (uint8_t)(v) & 0x3FU;
# define LV_COLOR_SET_G16_SWAP(c, v) {(c).ch.green_h = (uint8_t)(((v) >> 3) & 0x7); (c).ch.green_l = (uint8_t)((v) & 0x7);}
# define LV_COLOR_SET_B16(c, v) (c).ch.blue = (uint8_t)((v) & 0x1F);
# define LV_COLOR_SET_B16(c, v) (c).ch.blue = (uint8_t)(v) & 0x1FU;
# define LV_COLOR_SET_A16(c, v) do {} while(0)
# define LV_COLOR_GET_R16(c) (c).ch.red
@ -532,14 +532,14 @@ static inline uint8_t lv_color_brightness(lv_color_t color)
/* The most simple macro to create a color from R,G and B values */
#if LV_COLOR_DEPTH == 1
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){.full = (b8 >> 7 | g8 >> 7 | r8 >> 7)})
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){.full = ((b8 >> 7) | (g8 >> 7) | (r8 >> 7))})
#elif LV_COLOR_DEPTH == 8
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{(uint8_t)(b8 >> 6), (uint8_t)(g8 >> 5), (uint8_t)(r8 >> 5)}})
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{(b8 >> 6) & 0x3U, (g8 >> 5) & 0x7U, (r8 >> 5) & 0x7U}})
#elif LV_COLOR_DEPTH == 16
#if LV_COLOR_16_SWAP == 0
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{(uint16_t)(b8 >> 3), (uint16_t)(g8 >> 2), (uint16_t)(r8 >> 3)}})
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{(b8 >> 3) & 0x1FU, (g8 >> 2) & 0x3FU, (r8 >> 3) & 0x1FU}})
#else
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{((uint16_t)(g8 >> 5), (uint16_t)(r8 >> 3), (uint16_t)(b8 >> 3), (uint16_t)((g8 >> 2) & 0x7)}})
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{(g8 >> 5) & 0x7U, (r8 >> 3) & 0x1FU, (b8 >> 3) & 0x1FU, (g8 >> 2) & 0x7U}})
#endif
#elif LV_COLOR_DEPTH == 32
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8, g8, r8, 0xff}}) /*Fix 0xff alpha*/

View File

@ -527,11 +527,11 @@ static void ent_trunc(lv_mem_ent_t * e, size_t size)
uint8_t * e_data = &e->first_data;
lv_mem_ent_t * after_new_e = (lv_mem_ent_t *)&e_data[size];
after_new_e->header.s.used = 0;
after_new_e->header.s.d_size = e->header.s.d_size - size - sizeof(lv_mem_header_t);
after_new_e->header.s.d_size = (uint32_t)e->header.s.d_size - size - sizeof(lv_mem_header_t);
}
/* Set the new size for the original entry */
e->header.s.d_size = size;
e->header.s.d_size = (uint32_t)size;
}
#endif

View File

@ -200,8 +200,12 @@ static uint16_t lv_txt_get_next_word(const char * txt, const lv_font_t * font,
letter_w = lv_font_get_glyph_width(font, letter, letter_next);
cur_w += letter_w;
if(letter_w > 0) {
cur_w += letter_space;
}
/* Test if this character fits within max_width */
if(break_index == NO_BREAK_FOUND && cur_w > max_width) {
if(break_index == NO_BREAK_FOUND && (cur_w - letter_space) > max_width) {
break_index = i;
break_letter_count = word_len - 1;
/* break_index is now pointing at the character that doesn't fit */
@ -219,9 +223,6 @@ static uint16_t lv_txt_get_next_word(const char * txt, const lv_font_t * font,
/* Update the output width */
if( word_w_ptr != NULL && break_index == NO_BREAK_FOUND ) *word_w_ptr = cur_w;
if(letter_w > 0) {
cur_w += letter_space;
}
i = i_next;
i_next = i_next_next;

View File

@ -18,7 +18,7 @@ extern "C" {
* DEFINES
*********************/
// Check windows
#ifdef __WIN64
#ifdef _WIN64
#define LV_ARCH_64
#endif

View File

@ -206,7 +206,7 @@ uint8_t lv_gauge_get_label_count(const lv_obj_t * gauge);
* @param gauge pointer to a gauge object
* @return number of the scale units
*/
static inline uint8_t lv_gauge_get_line_count(const lv_obj_t * gauge)
static inline uint16_t lv_gauge_get_line_count(const lv_obj_t * gauge)
{
return lv_lmeter_get_line_count(gauge);
}

View File

@ -328,7 +328,7 @@ static lv_design_res_t lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * cli
coords.y1 = imgbtn->coords.y1;
coords.x2 = coords.x1 + header.w - 1;
coords.y2 = coords.y1 + header.h - 1;
lv_draw_img(&coords, clip_area, src, style, 0, LV_IMG_ZOOM_NONE, false, opa_scale);
lv_draw_img(&coords, clip_area, src, style, 0, NULL, LV_IMG_ZOOM_NONE, false, opa_scale);
}
src = ext->img_src_right[state];
@ -339,7 +339,7 @@ static lv_design_res_t lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * cli
coords.y1 = imgbtn->coords.y1;
coords.x2 = imgbtn->coords.x2;
coords.y2 = imgbtn->coords.y1 + header.h - 1;
lv_draw_img(&coords, clip_area, src, style, 0, LV_IMG_ZOOM_NONE, false, opa_scale);
lv_draw_img(&coords, clip_area, src, style, 0, NULL, LV_IMG_ZOOM_NONE, false, opa_scale);
}
src = ext->img_src_mid[state];
@ -364,7 +364,7 @@ static lv_design_res_t lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * cli
coords.y2 = imgbtn->coords.y1 + header.h - 1;
for(i = 0; i < obj_w - right_w - left_w; i += header.w) {
lv_draw_img(&coords, &clip_center_area, src, style, 0, LV_IMG_ZOOM_NONE, false, opa_scale);
lv_draw_img(&coords, &clip_center_area, src, style, 0, NULL, LV_IMG_ZOOM_NONE, false, opa_scale);
coords.x1 = coords.x2 + 1;
coords.x2 += header.w;
}

View File

@ -153,16 +153,16 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy)
ext->scrl = lv_cont_create(new_page, copy_ext->scrl);
lv_obj_set_signal_cb(ext->scrl, lv_page_scrollable_signal);
lv_page_set_sb_mode(new_page, copy_ext->sb.mode);
/* Add the signal function only if 'scrolling' is created
* because everything has to be ready before any signal is received*/
lv_obj_set_signal_cb(new_page, lv_page_signal);
lv_obj_set_design_cb(new_page, lv_page_design);
lv_page_set_style(new_page, LV_PAGE_STYLE_BG, lv_page_get_style(copy, LV_PAGE_STYLE_BG));
lv_page_set_style(new_page, LV_PAGE_STYLE_SCRL, lv_page_get_style(copy, LV_PAGE_STYLE_SCRL));
lv_page_set_style(new_page, LV_PAGE_STYLE_SB, lv_page_get_style(copy, LV_PAGE_STYLE_SB));
/* Add the signal function only if 'scrolling' is created
* because everything has to be ready before any signal is received*/
lv_obj_set_signal_cb(new_page, lv_page_signal);
lv_obj_set_design_cb(new_page, lv_page_design);
lv_page_set_sb_mode(new_page, copy_ext->sb.mode);
/*Refresh the style with new signal function*/
lv_obj_refresh_style(new_page);

View File

@ -409,11 +409,15 @@ static void lv_spinbox_updatevalue(lv_obj_t * spinbox)
char buf[LV_SPINBOX_MAX_DIGIT_COUNT + 8];
memset(buf, 0, sizeof(buf));
char * buf_p = buf;
uint8_t cur_shift_left = 0;
if (ext->range_min < 0) { // hide sign if there are only positive values
/*Add the sign*/
(*buf_p) = ext->value >= 0 ? '+' : '-';
buf_p++;
} else {
/*Cursor need shift to left*/
cur_shift_left++;
}
int32_t i;
@ -471,7 +475,7 @@ static void lv_spinbox_updatevalue(lv_obj_t * spinbox)
if(cur_pos > intDigits) cur_pos++; /*Skip teh decimal point*/
cur_pos += ext->digit_padding_left;
cur_pos += (ext->digit_padding_left - cur_shift_left);
lv_ta_set_cursor_pos(spinbox, cur_pos);
}