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

Merge branch 'master' into dev-7.0

This commit is contained in:
Gabor Kiss-Vamosi 2020-02-25 15:33:58 +01:00
commit d7c59c3158
3 changed files with 16 additions and 3 deletions

View File

@ -128,6 +128,7 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver)
memset(&disp->inv_area_joined, 0, sizeof(disp->inv_area_joined));
memset(&disp->inv_areas, 0, sizeof(disp->inv_areas));
lv_ll_init(&disp->scr_ll, sizeof(lv_obj_t));
disp->last_activity_time = 0;
if(disp_def == NULL) disp_def = disp;

View File

@ -28,6 +28,11 @@ extern "C" {
#define LV_MATH_ABS(x) ((x) > 0 ? (x) : (-(x)))
#define LV_IS_SIGNED(t) (((t)(-1)) < ((t) 0))
#define LV_UMAX_OF(t) (((0x1ULL << ((sizeof(t) * 8ULL) - 1ULL)) - 1ULL) | (0xFULL << ((sizeof(t) * 8ULL) - 4ULL)))
#define LV_SMAX_OF(t) (((0x1ULL << ((sizeof(t) * 8ULL) - 1ULL)) - 1ULL) | (0x7ULL << ((sizeof(t) * 8ULL) - 4ULL)))
#define LV_MAX_OF(t) ((unsigned long) (LV_IS_SIGNED(t) ? LV_SMAX_OF(t) : LV_UMAX_OF(t)))
#define LV_TRIGO_SIN_MAX 32767
#define LV_TRIGO_SHIFT 15 /**< >> LV_TRIGO_SHIFT to normalize*/

View File

@ -8,6 +8,7 @@
*********************/
#include "lv_txt.h"
#include "lv_math.h"
#include "lv_log.h"
/*********************
* DEFINES
@ -107,8 +108,14 @@ void lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t *
/*Calc. the height and longest line*/
while(text[line_start] != '\0') {
new_line_start += lv_txt_get_next_line(&text[line_start], font, letter_space, max_width, flag);
size_res->y += letter_height;
size_res->y += line_space;
if ((unsigned long)size_res->y + (unsigned long)letter_height + (unsigned long)line_space > LV_MAX_OF(lv_coord_t)) {
LV_LOG_WARN("lv_txt_get_size: integer overflow while calculating text height");
return;
} else {
size_res->y += letter_height;
size_res->y += line_space;
}
/*Calculate the the longest line*/
lv_coord_t act_line_length = lv_txt_get_width(&text[line_start], new_line_start - line_start, font, letter_space, flag);
@ -117,7 +124,7 @@ void lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t *
line_start = new_line_start;
}
/*Ma ke the text one line taller if the last character is '\n' or '\r'*/
/*Make the text one line taller if the last character is '\n' or '\r'*/
if((line_start != 0) && (text[line_start - 1] == '\n' || text[line_start - 1] == '\r')) {
size_res->y += letter_height + line_space;
}