From a4ed5369c2f4a00dc29ce7112b28dfec36fd5db3 Mon Sep 17 00:00:00 2001 From: embig71 <65016302+embig71@users.noreply.github.com> Date: Fri, 8 May 2020 19:48:20 +0300 Subject: [PATCH 1/4] Correct computation from #1490 for vertically oriented slider (#1492) --- src/lv_objx/lv_slider.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lv_objx/lv_slider.c b/src/lv_objx/lv_slider.c index 4f151f4e8..e6f437387 100644 --- a/src/lv_objx/lv_slider.c +++ b/src/lv_objx/lv_slider.c @@ -598,15 +598,16 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par } } else { /*Vertical slider*/ + /*Invert the value: smaller value means higher*/ if(ext->knob_in == 0) { lv_coord_t y1 = slider->coords.y1; - lv_coord_t minv = ext->bar.min_value; - lv_coord_t maxv = ext->bar.max_value; + lv_coord_t minv = ext->bar.max_value; + lv_coord_t maxv = ext->bar.min_value; tmp = (((int32_t)p.y - y1) * (maxv - minv) + h / 2) / h + minv; } else { lv_coord_t y1 = slider->coords.y1; - lv_coord_t minv = ext->bar.min_value; - lv_coord_t maxv = ext->bar.max_value; + lv_coord_t minv = ext->bar.max_value; + lv_coord_t maxv = ext->bar.min_value; lv_coord_t kh = w; tmp = (((int32_t)p.y - y1 - kh / 2) * (maxv - minv) + (h - kh) / 2) / (h - kh) + minv; } From 61bafdb37fb4dc85204b969d883910f0d9a26b23 Mon Sep 17 00:00:00 2001 From: Kowalski Dark Date: Sat, 9 May 2020 00:49:11 +0800 Subject: [PATCH 2/4] Fix typos in header comment (#1493) --- src/lv_misc/lv_txt.c | 2 +- src/lv_misc/lv_txt.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lv_misc/lv_txt.c b/src/lv_misc/lv_txt.c index 9de132e98..0bc693be6 100644 --- a/src/lv_misc/lv_txt.c +++ b/src/lv_misc/lv_txt.c @@ -83,7 +83,7 @@ uint32_t (*lv_txt_get_encoded_length)(const char *) = lv_txt_iso8859_ * Get size of a text * @param size_res pointer to a 'point_t' variable to store the result * @param text pointer to a text - * @param font pinter to font of the text + * @param font pointer to font of the text * @param letter_space letter space of the text * @param txt.line_space line space of the text * @param flags settings for the text from 'txt_flag_t' enum diff --git a/src/lv_misc/lv_txt.h b/src/lv_misc/lv_txt.h index 6dbce5d44..06c8d20e8 100644 --- a/src/lv_misc/lv_txt.h +++ b/src/lv_misc/lv_txt.h @@ -66,7 +66,7 @@ typedef uint8_t lv_txt_cmd_state_t; * Get size of a text * @param size_res pointer to a 'point_t' variable to store the result * @param text pointer to a text - * @param font pinter to font of the text + * @param font pointer to font of the text * @param letter_space letter space of the text * @param line_space line space of the text * @param flags settings for the text from 'txt_flag_t' enum From f00d17b496b161c0511951e9f8559be69721e900 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 14 May 2020 11:14:34 +0200 Subject: [PATCH 3/4] update the comments of lv_draw_label --- src/lv_draw/lv_draw_label.c | 6 +++++- src/lv_draw/lv_draw_label.h | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lv_draw/lv_draw_label.c b/src/lv_draw/lv_draw_label.c index bf75411da..6bfe3b5c0 100644 --- a/src/lv_draw/lv_draw_label.c +++ b/src/lv_draw/lv_draw_label.c @@ -43,6 +43,7 @@ static uint8_t hex_char_to_num(char hex); * GLOBAL FUNCTIONS **********************/ + /** * Write a text * @param coords coordinates of the label @@ -52,7 +53,10 @@ static uint8_t hex_char_to_num(char hex); * @param txt 0 terminated text to write * @param flag settings for the text from 'txt_flag_t' enum * @param offset text offset in x and y direction (NULL if unused) - * @param sel make the text selected in the range by drawing a background there + * @param sel_start start index of selected area (`LV_DRAW_LABEL_NO_TXT_SEL` if none) + * @param hint pointer to a `lv_draw_label_hint_t` variable. + * It is managed by the drawer to speed up the drawing of very long texts (thousands of lines). + * @param bidi_dir base direction of the text */ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale, const char * txt, lv_txt_flag_t flag, lv_point_t * offset, lv_draw_label_txt_sel_t * sel, diff --git a/src/lv_draw/lv_draw_label.h b/src/lv_draw/lv_draw_label.h index 6dc4d6464..2271b9427 100644 --- a/src/lv_draw/lv_draw_label.h +++ b/src/lv_draw/lv_draw_label.h @@ -62,7 +62,9 @@ typedef struct { * @param txt 0 terminated text to write * @param flag settings for the text from 'txt_flag_t' enum * @param offset text offset in x and y direction (NULL if unused) - * @param sel_start start index of selected area (`LV_LABEL_TXT_SEL_OFF` if none) + * @param sel_start start index of selected area (`LV_DRAW_LABEL_NO_TXT_SEL` if none) + * @param hint pointer to a `lv_draw_label_hint_t` variable. + * It is managed by the drawer to speed up the drawing of very long texts (thousands of lines). * @param bidi_dir base direction of the text */ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale, From 7ac9388aed612c0cff91de92e3004cdfd9679629 Mon Sep 17 00:00:00 2001 From: Bill Hargen <26309498+BillHargen@users.noreply.github.com> Date: Fri, 15 May 2020 13:42:50 -0400 Subject: [PATCH 4/4] Fix #1498: lv_label_set_text() crash (#1499) This routine tried to optimize a special case of setting the label text to the same address as previously set, but it did not consider whether the prior set was static and tried to realloc non-allocated memory. --- src/lv_objx/lv_label.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lv_objx/lv_label.c b/src/lv_objx/lv_label.c index b8ebdf9a5..c7d0ca765 100644 --- a/src/lv_objx/lv_label.c +++ b/src/lv_objx/lv_label.c @@ -188,7 +188,7 @@ void lv_label_set_text(lv_obj_t * label, const char * text) LV_ASSERT_STR(text); - if(ext->text == text) { + if(ext->text == text && ext->static_txt == 0) { /*If set its own text then reallocate it (maybe its size changed)*/ ext->text = lv_mem_realloc(ext->text, strlen(ext->text) + 1); LV_ASSERT_MEM(ext->text);