prepare to release v7.7.0

This commit is contained in:
Gabor Kiss-Vamosi
2020-10-20 13:32:57 +02:00
parent 64c68ec25b
commit 6fb4235c66
20 changed files with 206 additions and 186 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "lvgl",
"version": "7.6.1",
"version": "7.7.0",
"keywords": "graphics, gui, embedded, tft, lvgl",
"description": "Graphics library to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint. It offers anti-aliasing, opacity, and animations using only one frame buffer.",
"repository": {

View File

@@ -1,5 +1,5 @@
name=lvgl
version=7.6.1
version=7.7.0
author=kisvegabor
maintainer=kisvegabor,embeddedt,pete-pjb
sentence=Full-featured Graphics Library for Embedded Systems

2
lvgl.h
View File

@@ -17,7 +17,7 @@ extern "C" {
#define LVGL_VERSION_MAJOR 7
#define LVGL_VERSION_MINOR 7
#define LVGL_VERSION_PATCH 0
#define LVGL_VERSION_INFO "dev"
#define LVGL_VERSION_INFO ""
/*********************
* INCLUDES

View File

@@ -478,7 +478,11 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
/*1: Use PXP for CPU off-load on NXP RTxxx platforms */
#ifndef LV_USE_GPU_NXP_PXP
#define LV_USE_GPU_NXP_PXP 0
# ifdef CONFIG_LV_USE_GPU_NXP_PXP
# define LV_USE_GPU_NXP_PXP CONFIG_LV_USE_GPU_NXP_PXP
# else
# define LV_USE_GPU_NXP_PXP 0
# endif
#endif
/*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c)
@@ -487,12 +491,20 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
*0: lv_gpu_nxp_pxp_init() has to be called manually before lv_init()
* */
#ifndef LV_USE_GPU_NXP_PXP_AUTO_INIT
#define LV_USE_GPU_NXP_PXP_AUTO_INIT 0
# ifdef CONFIG_LV_USE_GPU_NXP_PXP_AUTO_INIT
# define LV_USE_GPU_NXP_PXP_AUTO_INIT CONFIG_LV_USE_GPU_NXP_PXP_AUTO_INIT
# else
# define LV_USE_GPU_NXP_PXP_AUTO_INIT 0
# endif
#endif
/*1: Use VG-Lite for CPU offload on NXP RTxxx platforms */
#ifndef LV_USE_GPU_NXP_VG_LITE
#define LV_USE_GPU_NXP_VG_LITE 0
# ifdef CONFIG_LV_USE_GPU_NXP_VG_LITE
# define LV_USE_GPU_NXP_VG_LITE CONFIG_LV_USE_GPU_NXP_VG_LITE
# else
# define LV_USE_GPU_NXP_VG_LITE 0
# endif
#endif
/* 1: Enable file system (might be required for images */
@@ -621,7 +633,11 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
/* Required alignment size for buffers */
#ifndef LV_ATTRIBUTE_MEM_ALIGN_SIZE
#define LV_ATTRIBUTE_MEM_ALIGN_SIZE
# ifdef CONFIG_LV_ATTRIBUTE_MEM_ALIGN_SIZE
# define LV_ATTRIBUTE_MEM_ALIGN_SIZE CONFIG_LV_ATTRIBUTE_MEM_ALIGN_SIZE
# else
# define LV_ATTRIBUTE_MEM_ALIGN_SIZE
# endif
#endif
/* With size optimization (-Os) the compiler might not align data to
@@ -1874,7 +1890,15 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
# define LV_TABLE_COL_MAX 12
# endif
#endif
#ifndef LV_TABLE_CELL_STYLE_CNT
# ifdef CONFIG_LV_TABLE_CELL_STYLE_CNT
# define LV_TABLE_CELL_STYLE_CNT CONFIG_LV_TABLE_CELL_STYLE_CNT
# else
# define LV_TABLE_CELL_STYLE_CNT 4
# endif
#endif
#endif
/*Tab (dependencies: lv_page, lv_btnm)*/
#ifndef LV_USE_TABVIEW

View File

@@ -3526,8 +3526,8 @@ void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint8_t part, lv_draw_label_dsc_
draw_dsc->font = lv_obj_get_style_text_font(obj, part);
if(draw_dsc->sel_start != LV_DRAW_LABEL_NO_TXT_SEL && draw_dsc->sel_end != LV_DRAW_LABEL_NO_TXT_SEL) {
draw_dsc->sel_color = lv_obj_get_style_text_sel_color(obj, part);
draw_dsc->sel_bg_color = lv_obj_get_style_text_sel_bg_color(obj, part);
draw_dsc->sel_color = lv_obj_get_style_text_sel_color(obj, part);
draw_dsc->sel_bg_color = lv_obj_get_style_text_sel_bg_color(obj, part);
}
#if LV_USE_BIDI

View File

@@ -757,7 +757,7 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col
if(opa > LV_OPA_MAX) {
#if LV_USE_GPU_NXP_PXP
if (lv_area_get_size(draw_area) >= GPU_NXP_PXP_BLIT_SIZE_LIMIT) {
if(lv_area_get_size(draw_area) >= GPU_NXP_PXP_BLIT_SIZE_LIMIT) {
lv_gpu_nxp_pxp_blit(disp_buf_first, disp_w, map_buf_first, map_w, draw_area_w, draw_area_h, opa);
return;
}

View File

@@ -14,7 +14,7 @@
#include "../lv_misc/lv_mem.h"
#include "../lv_misc/lv_math.h"
#if LV_USE_GPU_STM32_DMA2D
#include "../lv_gpu/lv_gpu_stm32_dma2d.h"
#include "../lv_gpu/lv_gpu_stm32_dma2d.h"
#elif LV_USE_GPU_NXP_PXP
#include "../lv_gpu/lv_gpu_nxp_pxp.h"
#endif

View File

@@ -51,7 +51,7 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_blur_corner(lv_coord_t size, lv_coord_t
static void draw_value_str(const lv_area_t * coords, const lv_area_t * clip, const lv_draw_rect_dsc_t * dsc);
#endif
static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * area_outer, const lv_area_t * clip,
lv_coord_t radius, bool radius_is_in, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
lv_coord_t radius, bool radius_is_in, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
LV_ATTRIBUTE_FAST_MEM static inline lv_color_t grad_get(const lv_draw_rect_dsc_t * dsc, lv_coord_t s, lv_coord_t i);
/**********************
@@ -410,7 +410,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv
area_inner.y2 -= ((dsc->border_side & LV_BORDER_SIDE_BOTTOM) ? dsc->border_width : - (dsc->border_width + rout));
if(dsc->border_side == LV_BORDER_SIDE_FULL) {
draw_full_border(&area_inner, coords, clip, dsc->radius, false, dsc->border_color, dsc->border_opa, dsc->border_blend_mode);
draw_full_border(&area_inner, coords, clip, dsc->radius, false, dsc->border_color, dsc->border_opa,
dsc->border_blend_mode);
}
else {
lv_opa_t opa = dsc->border_opa;
@@ -1347,7 +1348,8 @@ static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * are
/*Get the outer area*/
rout = rin + border_width;
} else {
}
else {
rout = radius;
int32_t short_side = LV_MATH_MIN(coords_out_w, coords_out_h);
if(rout > short_side >> 1) rout = short_side >> 1;

View File

@@ -7,7 +7,7 @@
******************************************************************************/
#ifndef LV_FONT_MONTSERRAT_10
#define LV_FONT_MONTSERRAT_10 1
#define LV_FONT_MONTSERRAT_10 1
#endif
#if LV_FONT_MONTSERRAT_10
@@ -1126,8 +1126,7 @@ static const uint16_t unicode_list_1[] = {
};
/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] =
{
static const lv_font_fmt_txt_cmap_t cmaps[] = {
{
.range_start = 32, .range_length = 95, .glyph_id_start = 1,
.unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY
@@ -1144,8 +1143,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] =
/*Map glyph_ids to kern left classes*/
static const uint8_t kern_left_class_mapping[] =
{
static const uint8_t kern_left_class_mapping[] = {
0, 0, 1, 2, 0, 3, 4, 5,
2, 6, 7, 8, 9, 10, 9, 10,
11, 12, 0, 13, 14, 15, 16, 17,
@@ -1169,8 +1167,7 @@ static const uint8_t kern_left_class_mapping[] =
};
/*Map glyph_ids to kern right classes*/
static const uint8_t kern_right_class_mapping[] =
{
static const uint8_t kern_right_class_mapping[] = {
0, 0, 1, 2, 0, 3, 4, 5,
2, 6, 7, 8, 9, 10, 9, 10,
11, 12, 13, 14, 15, 16, 17, 12,
@@ -1194,8 +1191,7 @@ static const uint8_t kern_right_class_mapping[] =
};
/*Kern values between classes*/
static const int8_t kern_class_values[] =
{
static const int8_t kern_class_values[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 2, 0, 0, 0,
0, 1, 0, 0, 0, 0, 0, 0,
@@ -1574,8 +1570,7 @@ static const int8_t kern_class_values[] =
/*Collect the kern class' data in one place*/
static const lv_font_fmt_txt_kern_classes_t kern_classes =
{
static const lv_font_fmt_txt_kern_classes_t kern_classes = {
.class_pair_values = kern_class_values,
.left_class_mapping = kern_left_class_mapping,
.right_class_mapping = kern_right_class_mapping,

View File

@@ -7,7 +7,7 @@
******************************************************************************/
#ifndef LV_FONT_MONTSERRAT_8
#define LV_FONT_MONTSERRAT_8 1
#define LV_FONT_MONTSERRAT_8 1
#endif
#if LV_FONT_MONTSERRAT_8
@@ -918,8 +918,7 @@ static const uint16_t unicode_list_1[] = {
};
/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] =
{
static const lv_font_fmt_txt_cmap_t cmaps[] = {
{
.range_start = 32, .range_length = 95, .glyph_id_start = 1,
.unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY
@@ -936,8 +935,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] =
/*Map glyph_ids to kern left classes*/
static const uint8_t kern_left_class_mapping[] =
{
static const uint8_t kern_left_class_mapping[] = {
0, 0, 1, 2, 0, 3, 4, 5,
2, 6, 7, 8, 9, 10, 9, 10,
11, 12, 0, 13, 14, 15, 16, 17,
@@ -961,8 +959,7 @@ static const uint8_t kern_left_class_mapping[] =
};
/*Map glyph_ids to kern right classes*/
static const uint8_t kern_right_class_mapping[] =
{
static const uint8_t kern_right_class_mapping[] = {
0, 0, 1, 2, 0, 3, 4, 5,
2, 6, 7, 8, 9, 10, 9, 10,
11, 12, 13, 14, 15, 16, 17, 12,
@@ -986,8 +983,7 @@ static const uint8_t kern_right_class_mapping[] =
};
/*Kern values between classes*/
static const int8_t kern_class_values[] =
{
static const int8_t kern_class_values[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0,
0, 1, 0, 0, 0, 0, 0, 0,
@@ -1366,8 +1362,7 @@ static const int8_t kern_class_values[] =
/*Collect the kern class' data in one place*/
static const lv_font_fmt_txt_kern_classes_t kern_classes =
{
static const lv_font_fmt_txt_kern_classes_t kern_classes = {
.class_pair_values = kern_class_values,
.left_class_mapping = kern_left_class_mapping,
.right_class_mapping = kern_right_class_mapping,

View File

@@ -131,7 +131,7 @@ lv_res_t lv_gpu_nxp_vglite_fill(lv_color_t * dest_buf, lv_coord_t dest_width, lv
err |= vg_lite_init_path(&path, VG_LITE_S16, VG_LITE_LOW, sizeof(path_data), path_data,
fill_area->x1, fill_area->y1, fill_area->x2 + 1, fill_area->y2 + 1);
fill_area->x1, fill_area->y1, fill_area->x2 + 1, fill_area->y2 + 1);
if(err != VG_LITE_SUCCESS) {
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
LV_LOG_ERROR("vg_lite_init_path() failed.");
@@ -194,9 +194,9 @@ lv_res_t lv_gpu_nxp_vglite_blit(lv_gpu_nxp_vglite_blit_info_t * blit)
return LV_RES_OK; /* Nothing to BLIT */
}
if (!blit) {
/* Wrong parameter */
return LV_RES_INV;
if(!blit) {
/* Wrong parameter */
return LV_RES_INV;
}
/* Wrap src/dst buffer into VG-Lite buffer */
@@ -230,8 +230,8 @@ lv_res_t lv_gpu_nxp_vglite_blit(lv_gpu_nxp_vglite_blit_info_t * blit)
uint32_t color;
vg_lite_blend_t blend;
if(blit->opa >= LV_OPA_MAX) {
color = 0x0;
blend = VG_LITE_BLEND_NONE;
color = 0x0;
blend = VG_LITE_BLEND_NONE;
}
else {
color = ((blit->opa) << 24) | ((blit->opa) << 16) | ((blit->opa) << 8) | (blit->opa);

View File

@@ -1264,21 +1264,20 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
break;
#endif
#if LV_USE_TABLE
case LV_THEME_TABLE:
{
list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
case LV_THEME_TABLE: {
list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
int idx = 1; /* start value should be 1, not zero, since cell styles
int idx = 1; /* start value should be 1, not zero, since cell styles
start at 1 due to presence of LV_TABLE_PART_BG=0
in the enum (lv_table.h) */
/* declaring idx outside loop to work with older compilers */
for (;idx <= LV_TABLE_CELL_STYLE_CNT; idx ++ ) {
list = lv_obj_get_style_list(obj, idx);
_lv_style_list_add_style(list, &styles->table_cell);
/* declaring idx outside loop to work with older compilers */
for(; idx <= LV_TABLE_CELL_STYLE_CNT; idx ++) {
list = lv_obj_get_style_list(obj, idx);
_lv_style_list_add_style(list, &styles->table_cell);
}
break;
}
break;
}
#endif
#if LV_USE_WIN

View File

@@ -888,22 +888,21 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
break;
#endif
#if LV_USE_TABLE
case LV_THEME_TABLE:
{
list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
case LV_THEME_TABLE: {
list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
int idx = 1; /* start value should be 1, not zero, since cell styles
int idx = 1; /* start value should be 1, not zero, since cell styles
start at 1 due to presence of LV_TABLE_PART_BG=0
in the enum (lv_table.h) */
/* declaring idx outside loop to work with older compilers */
for (; idx <= LV_TABLE_CELL_STYLE_CNT; idx ++ ) {
list = lv_obj_get_style_list(obj, idx);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->no_radius);
/* declaring idx outside loop to work with older compilers */
for(; idx <= LV_TABLE_CELL_STYLE_CNT; idx ++) {
list = lv_obj_get_style_list(obj, idx);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->no_radius);
}
break;
}
break;
}
#endif
#if LV_USE_WIN

View File

@@ -727,21 +727,20 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
break;
#endif
#if LV_USE_TABLE
case LV_THEME_TABLE:
{
list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
case LV_THEME_TABLE: {
list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
int idx = 1; /* start value should be 1, not zero, since cell styles
int idx = 1; /* start value should be 1, not zero, since cell styles
start at 1 due to presence of LV_TABLE_PART_BG=0
in the enum (lv_table.h) */
/* declaring idx outside loop to work with older compilers */
for (; idx <= LV_TABLE_CELL_STYLE_CNT; idx ++ ) {
list = lv_obj_get_style_list(obj, idx);
_lv_style_list_add_style(list, &styles->bg);
/* declaring idx outside loop to work with older compilers */
for(; idx <= LV_TABLE_CELL_STYLE_CNT; idx ++) {
list = lv_obj_get_style_list(obj, idx);
_lv_style_list_add_style(list, &styles->bg);
}
break;
}
break;
}
#endif
#if LV_USE_WIN

View File

@@ -651,9 +651,9 @@ static lv_coord_t get_header_height(lv_obj_t * calendar)
{
const lv_font_t * font = lv_obj_get_style_text_font(calendar, LV_CALENDAR_PART_HEADER);
lv_style_int_t top = lv_obj_get_style_margin_top(calendar, LV_CALENDAR_PART_HEADER) +
lv_obj_get_style_pad_top(calendar, LV_CALENDAR_PART_HEADER);
lv_obj_get_style_pad_top(calendar, LV_CALENDAR_PART_HEADER);
lv_style_int_t bottom = lv_obj_get_style_margin_bottom(calendar, LV_CALENDAR_PART_HEADER) +
lv_obj_get_style_pad_bottom(calendar, LV_CALENDAR_PART_HEADER);
lv_obj_get_style_pad_bottom(calendar, LV_CALENDAR_PART_HEADER);
return lv_font_get_line_height(font) + top + bottom;
}
@@ -690,7 +690,7 @@ static void draw_header(lv_obj_t * calendar, const lv_area_t * mask)
header_area.x2 = calendar->coords.x2;
header_area.y1 = calendar->coords.y1 + lv_obj_get_style_margin_top(calendar, LV_CALENDAR_PART_HEADER);
header_area.y2 = header_area.y1 + lv_obj_get_style_pad_top(calendar, LV_CALENDAR_PART_HEADER) +
lv_font_get_line_height(font) + lv_obj_get_style_pad_bottom(calendar, LV_CALENDAR_PART_HEADER);
lv_font_get_line_height(font) + lv_obj_get_style_pad_bottom(calendar, LV_CALENDAR_PART_HEADER);
lv_draw_rect_dsc_t header_rect_dsc;
lv_draw_rect_dsc_init(&header_rect_dsc);

View File

@@ -658,12 +658,12 @@ void lv_chart_set_series_axis(lv_obj_t * chart, lv_chart_series_t * ser, lv_char
*/
void lv_chart_set_cursor_point(lv_obj_t * chart, lv_chart_cursor_t * cursor, lv_point_t * point)
{
LV_ASSERT_NULL(cursor);
LV_UNUSED(chart);
LV_ASSERT_NULL(cursor);
LV_UNUSED(chart);
cursor->point.x = point->x;
cursor->point.y = point->y;
lv_chart_refresh(chart);
cursor->point.x = point->x;
cursor->point.y = point->y;
lv_chart_refresh(chart);
}
/*=====================
@@ -787,42 +787,43 @@ uint16_t lv_chart_get_nearest_index_from_coord(lv_obj_t * chart, lv_coord_t x)
*/
lv_coord_t lv_chart_get_x_from_index(lv_obj_t * chart, lv_chart_series_t * ser, uint16_t id)
{
LV_ASSERT_NULL(chart);
LV_ASSERT_NULL(ser);
LV_ASSERT_NULL(chart);
LV_ASSERT_NULL(ser);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(id >= ext->point_cnt) {
LV_LOG_WARN("Invalid index: %d", id);
return 0;
}
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(id >= ext->point_cnt) {
LV_LOG_WARN("Invalid index: %d", id);
return 0;
}
lv_area_t series_area;
lv_chart_get_series_area(chart, &series_area);
lv_area_t series_area;
lv_chart_get_series_area(chart, &series_area);
lv_coord_t w = lv_area_get_width(&series_area);
lv_coord_t w = lv_area_get_width(&series_area);
lv_coord_t x = 0;
lv_coord_t x = 0;
if(ext->type & LV_CHART_TYPE_LINE) {
x = (w * id) / (ext->point_cnt - 1);
} else if(ext->type & LV_CHART_TYPE_COLUMN) {
lv_coord_t col_w = w / ((_lv_ll_get_len(&ext->series_ll) + 1) * ext->point_cnt); /* Suppose + 1 series as separator*/
lv_chart_series_t * itr_ser = NULL;
lv_style_int_t col_space = lv_obj_get_style_pad_inner(chart, LV_CHART_PART_SERIES);
if(ext->type & LV_CHART_TYPE_LINE) {
x = (w * id) / (ext->point_cnt - 1);
}
else if(ext->type & LV_CHART_TYPE_COLUMN) {
lv_coord_t col_w = w / ((_lv_ll_get_len(&ext->series_ll) + 1) * ext->point_cnt); /* Suppose + 1 series as separator*/
lv_chart_series_t * itr_ser = NULL;
lv_style_int_t col_space = lv_obj_get_style_pad_inner(chart, LV_CHART_PART_SERIES);
x = (int32_t)((int32_t)w * id) / ext->point_cnt;
x += col_w / 2; /*Start offset*/
x = (int32_t)((int32_t)w * id) / ext->point_cnt;
x += col_w / 2; /*Start offset*/
_LV_LL_READ_BACK(ext->series_ll, itr_ser) {
if(itr_ser == ser) break;
x += col_w;
}
_LV_LL_READ_BACK(ext->series_ll, itr_ser) {
if(itr_ser == ser) break;
x += col_w;
}
x += (col_w - col_space) / 2;
}
x += (col_w - col_space) / 2;
}
return x;
return x;
}
/**
@@ -835,25 +836,25 @@ lv_coord_t lv_chart_get_x_from_index(lv_obj_t * chart, lv_chart_series_t * ser,
*/
lv_coord_t lv_chart_get_y_from_index(lv_obj_t * chart, lv_chart_series_t * ser, uint16_t id)
{
LV_ASSERT_NULL(chart);
LV_ASSERT_NULL(ser);
LV_ASSERT_NULL(chart);
LV_ASSERT_NULL(ser);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(id >= ext->point_cnt) {
LV_LOG_WARN("Invalid index: %d", id);
return 0;
}
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(id >= ext->point_cnt) {
LV_LOG_WARN("Invalid index: %d", id);
return 0;
}
lv_area_t series_area;
lv_chart_get_series_area(chart, &series_area);
lv_area_t series_area;
lv_chart_get_series_area(chart, &series_area);
lv_coord_t h = lv_area_get_height(&series_area);
lv_coord_t h = lv_area_get_height(&series_area);
int32_t y = (int32_t)((int32_t)ser->points[id] - ext->ymin[ser->y_axis]) * h;
y = y / (ext->ymax[ser->y_axis] - ext->ymin[ser->y_axis]);
y = h - y;
int32_t y = (int32_t)((int32_t)ser->points[id] - ext->ymin[ser->y_axis]) * h;
y = y / (ext->ymax[ser->y_axis] - ext->ymin[ser->y_axis]);
y = h - y;
return (lv_coord_t)y;
return (lv_coord_t)y;
}
/**
@@ -1327,55 +1328,55 @@ static void draw_cursors(lv_obj_t * chart, const lv_area_t * series_area, const
/*Go through all cursor lines*/
_LV_LL_READ_BACK(ext->cursors_ll, cursor) {
line_dsc.color = cursor->color;
point_dsc.bg_color = cursor->color;
line_dsc.color = cursor->color;
point_dsc.bg_color = cursor->color;
if(cursor->axes & LV_CHART_CURSOR_RIGHT) {
p1.x = series_area->x1 + cursor->point.x;
p1.y = series_area->y1 + cursor->point.y;
p2.x = series_area->x2;
p2.y = p1.y;
lv_draw_line(&p1, &p2, &series_mask, &line_dsc);
}
if(cursor->axes & LV_CHART_CURSOR_RIGHT) {
p1.x = series_area->x1 + cursor->point.x;
p1.y = series_area->y1 + cursor->point.y;
p2.x = series_area->x2;
p2.y = p1.y;
lv_draw_line(&p1, &p2, &series_mask, &line_dsc);
}
if(cursor->axes & LV_CHART_CURSOR_UP) {
if(cursor->axes & LV_CHART_CURSOR_UP) {
p1.x = series_area->x1 + cursor->point.x;
p1.y = series_area->y1;
p2.x = p1.x;
p2.y = series_area->y1 + cursor->point.y;
lv_draw_line(&p1, &p2, &series_mask, &line_dsc);
}
p1.x = series_area->x1 + cursor->point.x;
p1.y = series_area->y1;
p2.x = p1.x;
p2.y = series_area->y1 + cursor->point.y;
lv_draw_line(&p1, &p2, &series_mask, &line_dsc);
}
if(cursor->axes & LV_CHART_CURSOR_LEFT) {
p1.x = series_area->x1;
p1.y = series_area->y1 + cursor->point.y;
p2.x = p1.x + cursor->point.x;
p2.y = p1.y;
lv_draw_line(&p1, &p2, &series_mask, &line_dsc);
}
if(cursor->axes & LV_CHART_CURSOR_LEFT) {
p1.x = series_area->x1;
p1.y = series_area->y1 + cursor->point.y;
p2.x = p1.x + cursor->point.x;
p2.y = p1.y;
lv_draw_line(&p1, &p2, &series_mask, &line_dsc);
}
if(cursor->axes & LV_CHART_CURSOR_DOWN) {
if(cursor->axes & LV_CHART_CURSOR_DOWN) {
p1.x = series_area->x1 + cursor->point.x;
p1.y = series_area->y1 + cursor->point.y;
p2.x = p1.x;
p2.y = series_area->y2;
lv_draw_line(&p1, &p2, &series_mask, &line_dsc);
}
p1.x = series_area->x1 + cursor->point.x;
p1.y = series_area->y1 + cursor->point.y;
p2.x = p1.x;
p2.y = series_area->y2;
lv_draw_line(&p1, &p2, &series_mask, &line_dsc);
}
if(point_radius) {
lv_area_t point_area;
if(point_radius) {
lv_area_t point_area;
point_area.x1 = series_area->x1 + cursor->point.x - point_radius;
point_area.x2 = series_area->x1 + cursor->point.x + point_radius;
point_area.x1 = series_area->x1 + cursor->point.x - point_radius;
point_area.x2 = series_area->x1 + cursor->point.x + point_radius;
point_area.y1 = series_area->y1 + cursor->point.y - point_radius;
point_area.y2 = series_area->y1 + cursor->point.y + point_radius;
point_area.y1 = series_area->y1 + cursor->point.y - point_radius;
point_area.y2 = series_area->y1 + cursor->point.y + point_radius;
/*Don't limit to `series_mask` to get full circles on the ends*/
lv_draw_rect(&point_area, clip_area, &point_dsc);
}
/*Don't limit to `series_mask` to get full circles on the ends*/
lv_draw_rect(&point_area, clip_area, &point_dsc);
}
}
@@ -1620,7 +1621,9 @@ static void draw_y_ticks(lv_obj_t * chart, const lv_area_t * series_area, const
/* set the area at some distance of the major tick len left of the tick */
/* changed to explicit member initialization to allow compilation as c++ */
lv_area_t a; a.y1 = p2.y - size.y / 2; a.y2 = p2.y + size.y / 2;
lv_area_t a;
a.y1 = p2.y - size.y / 2;
a.y2 = p2.y + size.y / 2;
if(which_axis == LV_CHART_AXIS_PRIMARY_Y) {
a.x1 = p2.x - size.x - label_dist;

View File

@@ -63,7 +63,7 @@ typedef uint8_t lv_chart_axis_t;
enum {
LV_CHART_CURSOR_NONE = 0x00,
LV_CHART_CURSOR_RIGHT = 0x01,
LV_CHART_CURSOR_RIGHT = 0x01,
LV_CHART_CURSOR_UP = 0x02,
LV_CHART_CURSOR_LEFT = 0x04,
LV_CHART_CURSOR_DOWN = 0x08

View File

@@ -571,7 +571,8 @@ static void lv_cont_layout_pretty(lv_obj_t * cont)
if(lv_obj_get_base_dir(cont) == LV_BIDI_DIR_RTL) {
align = LV_ALIGN_IN_TOP_RIGHT;
inv = -1;
} else {
}
else {
align = LV_ALIGN_IN_TOP_LEFT;
inv = 1;
}
@@ -582,7 +583,7 @@ static void lv_cont_layout_pretty(lv_obj_t * cont)
switch(type) {
case LV_LAYOUT_PRETTY_TOP:
lv_obj_align(child_tmp, cont, align,
inv * (act_x + mleft),
inv * (act_x + mleft),
act_y + lv_obj_get_style_margin_top(child_tmp, LV_OBJ_PART_MAIN));
break;
case LV_LAYOUT_PRETTY_MID:

View File

@@ -180,10 +180,10 @@ void lv_table_set_cell_value(lv_obj_t * table, uint16_t row, uint16_t col, const
_lv_txt_ap_proc(txt, &ext->cell_data[cell][1]);
#else
ext->cell_data[cell] = lv_mem_realloc(ext->cell_data[cell], strlen(txt) + 2); /*+1: trailing '\0; +1: format byte*/
LV_ASSERT_MEM(ext->cell_data[cell]);
if(ext->cell_data[cell] == NULL) return;
LV_ASSERT_MEM(ext->cell_data[cell]);
if(ext->cell_data[cell] == NULL) return;
strcpy(ext->cell_data[cell] + 1, txt); /*+1 to skip the format byte*/
strcpy(ext->cell_data[cell] + 1, txt); /*+1 to skip the format byte*/
#endif
ext->cell_data[cell][0] = format.format_byte;
@@ -238,12 +238,12 @@ void lv_table_set_cell_value_fmt(lv_obj_t * table, uint16_t row, uint16_t col, c
}
va_list ap, ap2;
va_start(ap, fmt);
va_copy(ap2, ap);
va_start(ap, fmt);
va_copy(ap2, ap);
/*Allocate space for the new text by using trick from C99 standard section 7.19.6.12 */
uint32_t len = lv_vsnprintf(NULL, 0, fmt, ap);
va_end(ap);
/*Allocate space for the new text by using trick from C99 standard section 7.19.6.12 */
uint32_t len = lv_vsnprintf(NULL, 0, fmt, ap);
va_end(ap);
#if LV_USE_ARABIC_PERSIAN_CHARS
/*Put together the text according to the format string*/
@@ -878,7 +878,8 @@ static lv_design_res_t lv_table_design(lv_obj_t * table, const lv_area_t * clip_
if(rtl) {
cell_area.x2 = cell_area.x1 - 1;
cell_area.x1 = cell_area.x2 - ext->col_w[col] + 1;
} else {
}
else {
cell_area.x1 = cell_area.x2 + 1;
cell_area.x2 = cell_area.x1 + ext->col_w[col] - 1;
}
@@ -1066,10 +1067,11 @@ static lv_style_list_t * lv_table_get_style(lv_obj_t * table, uint8_t part)
/* Because of the presence of LV_TABLE_PART_BG, LV_TABLE_PART_CELL<i> has an integer value
of <i>. This comes in useful to extend above code with more cell types as follows */
if ( part == LV_TABLE_PART_BG ) {
return &table->style_list;
} else if (part >= 1 && part <= LV_TABLE_CELL_STYLE_CNT ) {
return &ext->cell_style[part-1];
if(part == LV_TABLE_PART_BG) {
return &table->style_list;
}
else if(part >= 1 && part <= LV_TABLE_CELL_STYLE_CNT) {
return &ext->cell_style[part - 1];
}
return NULL;

View File

@@ -71,7 +71,8 @@ typedef struct {
lv_coord_t * row_h;
lv_style_list_t cell_style[LV_TABLE_CELL_STYLE_CNT];
lv_coord_t col_w[LV_TABLE_COL_MAX];
uint16_t cell_types : LV_TABLE_CELL_STYLE_CNT; /*Keep track which cell types exists to avoid dealing with unused ones*/
uint16_t cell_types :
LV_TABLE_CELL_STYLE_CNT; /*Keep track which cell types exists to avoid dealing with unused ones*/
} lv_table_ext_t;
/*Parts of the table*/