run code formatter
This commit is contained in:
@@ -24,11 +24,27 @@
|
||||
--preserve-date
|
||||
--formatted
|
||||
--exclude=lv_conf_internal.h
|
||||
--exclude=../src/lv_font/lv_font_roboto_12.c
|
||||
--exclude=../src/lv_font/lv_font_roboto_12_subpx.c
|
||||
--exclude=../src/lv_font/lv_font_roboto_16.c
|
||||
--exclude=../src/lv_font/lv_font_roboto_22.c
|
||||
--exclude=../src/lv_font/lv_font_roboto_28.c
|
||||
--exclude=../src/lv_font/lv_font_roboto_28_compressed.c
|
||||
--exclude=../src/lv_font/lv_font_unscii_8.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_12.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_14.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_16.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_18.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_20.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_22.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_24.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_26.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_28.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_30.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_32.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_34.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_36.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_38.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_40.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_42.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_44.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_46.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_48.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_12_subpx.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_28_compressed.c
|
||||
--exclude=../src/lv_font/lv_font_simsun_16_cjk.c
|
||||
--exclude=../src/lv_font/lv_font_dejavu_16_persian_hebrew.c
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ extern "C" {
|
||||
* V6.0 COMPATIBILITY
|
||||
*--------------------*/
|
||||
|
||||
static inline void lv_task_once(lv_task_t *task)
|
||||
static inline void lv_task_once(lv_task_t * task)
|
||||
{
|
||||
lv_task_set_repeat_count(task, 1);
|
||||
}
|
||||
|
||||
@@ -338,8 +338,8 @@ static void lv_refr_areas(void)
|
||||
int32_t last_i = 0;
|
||||
for(i = disp_refr->inv_p - 1; i >= 0; i--) {
|
||||
if(disp_refr->inv_area_joined[i] == 0) {
|
||||
last_i = i;
|
||||
break;
|
||||
last_i = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,8 +350,8 @@ static void lv_refr_areas(void)
|
||||
/*Refresh the unjoined areas*/
|
||||
if(disp_refr->inv_area_joined[i] == 0) {
|
||||
|
||||
if(i == last_i) disp_refr->driver.buffer->last_area = 1;
|
||||
disp_refr->driver.buffer->last_part = 0;
|
||||
if(i == last_i) disp_refr->driver.buffer->last_area = 1;
|
||||
disp_refr->driver.buffer->last_part = 0;
|
||||
lv_refr_area(&disp_refr->inv_areas[i]);
|
||||
|
||||
if(disp_refr->driver.monitor_cb) px_num += lv_area_get_size(&disp_refr->inv_areas[i]);
|
||||
|
||||
@@ -513,26 +513,26 @@ void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void
|
||||
attr_goal.full = (prop >> 8) & 0xFFU;
|
||||
|
||||
if(attr_found.bits.state == attr_goal.bits.state) {
|
||||
lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &p, sizeof(const void * ));
|
||||
lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &p, sizeof(const void *));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*Add new property if not exists yet*/
|
||||
uint8_t new_prop_size = (sizeof(lv_style_property_t) + sizeof(const void * ));
|
||||
uint8_t new_prop_size = (sizeof(lv_style_property_t) + sizeof(const void *));
|
||||
lv_style_property_t end_mark = _LV_STYLE_CLOSEING_PROP;
|
||||
uint8_t end_mark_size = sizeof(end_mark);
|
||||
|
||||
uint16_t size = lv_style_get_mem_size(style);
|
||||
if(size == 0) size += end_mark_size;
|
||||
|
||||
size += sizeof(lv_style_property_t) + sizeof(const void * );
|
||||
size += sizeof(lv_style_property_t) + sizeof(const void *);
|
||||
style->map = lv_mem_realloc(style->map, size);
|
||||
LV_ASSERT_MEM(style->map);
|
||||
if(style == NULL) return;
|
||||
|
||||
lv_memcpy_small(style->map + size - new_prop_size - end_mark_size, &prop, sizeof(lv_style_property_t));
|
||||
lv_memcpy_small(style->map + size - sizeof(const void * ) - end_mark_size, &p, sizeof(const void * ));
|
||||
lv_memcpy_small(style->map + size - sizeof(const void *) - end_mark_size, &p, sizeof(const void *));
|
||||
lv_memcpy_small(style->map + size - end_mark_size, &end_mark, sizeof(end_mark));
|
||||
}
|
||||
|
||||
|
||||
@@ -31,9 +31,10 @@ static void fill_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, con
|
||||
lv_color_t color, lv_opa_t opa,
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
||||
lv_color_t color, lv_opa_t opa,
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res);
|
||||
LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_color_t * disp_buf,
|
||||
const lv_area_t * draw_area,
|
||||
lv_color_t color, lv_opa_t opa,
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res);
|
||||
|
||||
static void fill_blended(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
||||
lv_color_t color, lv_opa_t opa,
|
||||
@@ -43,9 +44,10 @@ static void map_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, cons
|
||||
const lv_area_t * map_area, const lv_color_t * map_buf, lv_opa_t opa,
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
||||
const lv_area_t * map_area, const lv_color_t * map_buf, lv_opa_t opa,
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res);
|
||||
LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_color_t * disp_buf,
|
||||
const lv_area_t * draw_area,
|
||||
const lv_area_t * map_area, const lv_color_t * map_buf, lv_opa_t opa,
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res);
|
||||
|
||||
static void map_blended(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
||||
const lv_area_t * map_area, const lv_color_t * map_buf, lv_opa_t opa,
|
||||
@@ -72,13 +74,13 @@ static inline lv_color_t color_blend_true_color_subtractive(lv_color_t fg, lv_co
|
||||
|
||||
|
||||
#define FILL_NORMAL_MASK_PX_SCR_TRANSP(out_x, color) \
|
||||
if(*mask_tmp_x) { \
|
||||
if(*mask_tmp_x == LV_OPA_COVER) disp_buf_tmp[out_x] = color; \
|
||||
else if(disp->driver.screen_transp) lv_color_mix_with_alpha(disp_buf_tmp[out_x], disp_buf_tmp[out_x].ch.alpha, \
|
||||
color, *mask_tmp_x, &disp_buf_tmp[out_x], &disp_buf_tmp[out_x].ch.alpha); \
|
||||
else disp_buf_tmp[out_x] = lv_color_mix(color, disp_buf_tmp[out_x], *mask_tmp_x); \
|
||||
} \
|
||||
mask_tmp_x++;
|
||||
if(*mask_tmp_x) { \
|
||||
if(*mask_tmp_x == LV_OPA_COVER) disp_buf_tmp[out_x] = color; \
|
||||
else if(disp->driver.screen_transp) lv_color_mix_with_alpha(disp_buf_tmp[out_x], disp_buf_tmp[out_x].ch.alpha, \
|
||||
color, *mask_tmp_x, &disp_buf_tmp[out_x], &disp_buf_tmp[out_x].ch.alpha); \
|
||||
else disp_buf_tmp[out_x] = lv_color_mix(color, disp_buf_tmp[out_x], *mask_tmp_x); \
|
||||
} \
|
||||
mask_tmp_x++;
|
||||
|
||||
|
||||
#define MAP_NORMAL_MASK_PX(x) \
|
||||
@@ -89,13 +91,13 @@ static inline lv_color_t color_blend_true_color_subtractive(lv_color_t fg, lv_co
|
||||
mask_tmp_x++;
|
||||
|
||||
#define MAP_NORMAL_MASK_PX_SCR_TRANSP(x) \
|
||||
if(*mask_tmp_x) { \
|
||||
if(*mask_tmp_x == LV_OPA_COVER) disp_buf_tmp[x] = map_buf_tmp[x]; \
|
||||
else if(disp->driver.screen_transp) lv_color_mix_with_alpha(disp_buf_tmp[x], disp_buf_tmp[x].ch.alpha, \
|
||||
map_buf_tmp[x], *mask_tmp_x, &disp_buf_tmp[x], &disp_buf_tmp[x].ch.alpha); \
|
||||
else disp_buf_tmp[x] = lv_color_mix(map_buf_tmp[x], disp_buf_tmp[x], *mask_tmp_x); \
|
||||
} \
|
||||
mask_tmp_x++;
|
||||
if(*mask_tmp_x) { \
|
||||
if(*mask_tmp_x == LV_OPA_COVER) disp_buf_tmp[x] = map_buf_tmp[x]; \
|
||||
else if(disp->driver.screen_transp) lv_color_mix_with_alpha(disp_buf_tmp[x], disp_buf_tmp[x].ch.alpha, \
|
||||
map_buf_tmp[x], *mask_tmp_x, &disp_buf_tmp[x], &disp_buf_tmp[x].ch.alpha); \
|
||||
else disp_buf_tmp[x] = lv_color_mix(map_buf_tmp[x], disp_buf_tmp[x], *mask_tmp_x); \
|
||||
} \
|
||||
mask_tmp_x++;
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
@@ -116,8 +118,8 @@ mask_tmp_x++;
|
||||
* @param mode blend mode from `lv_blend_mode_t`
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_blend_fill(const lv_area_t * clip_area, const lv_area_t * fill_area,
|
||||
lv_color_t color, lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa,
|
||||
lv_blend_mode_t mode)
|
||||
lv_color_t color, lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa,
|
||||
lv_blend_mode_t mode)
|
||||
{
|
||||
static int asd = 0;
|
||||
asd++;
|
||||
@@ -181,9 +183,10 @@ LV_ATTRIBUTE_FAST_MEM void lv_blend_fill(const lv_area_t * clip_area, const lv_a
|
||||
* @param opa overall opacity in 0x00..0xff range
|
||||
* @param mode blend mode from `lv_blend_mode_t`
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_blend_map(const lv_area_t * clip_area, const lv_area_t * map_area, const lv_color_t * map_buf,
|
||||
lv_opa_t * mask, lv_draw_mask_res_t mask_res,
|
||||
lv_opa_t opa, lv_blend_mode_t mode)
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_blend_map(const lv_area_t * clip_area, const lv_area_t * map_area,
|
||||
const lv_color_t * map_buf,
|
||||
lv_opa_t * mask, lv_draw_mask_res_t mask_res,
|
||||
lv_opa_t opa, lv_blend_mode_t mode)
|
||||
{
|
||||
/*Do not draw transparent things*/
|
||||
if(opa < LV_OPA_MIN) return;
|
||||
@@ -287,9 +290,10 @@ static void fill_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, con
|
||||
* LV_MASK_RES_TRANSP: the mask has only 0x00 values (full transparent),
|
||||
* LV_MASK_RES_CHANGED: the mask has mixed values
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
||||
lv_color_t color, lv_opa_t opa,
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res)
|
||||
LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_color_t * disp_buf,
|
||||
const lv_area_t * draw_area,
|
||||
lv_color_t color, lv_opa_t opa,
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res)
|
||||
{
|
||||
|
||||
#if LV_USE_GPU
|
||||
@@ -642,9 +646,10 @@ static void map_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, cons
|
||||
* LV_MASK_RES_TRANSP: the mask has only 0x00 values (full transparent),
|
||||
* LV_MASK_RES_CHANGED: the mask has mixed values
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
||||
const lv_area_t * map_area, const lv_color_t * map_buf, lv_opa_t opa,
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res)
|
||||
LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_color_t * disp_buf,
|
||||
const lv_area_t * draw_area,
|
||||
const lv_area_t * map_area, const lv_color_t * map_buf, lv_opa_t opa,
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res)
|
||||
{
|
||||
|
||||
/*Get the width of the `disp_area` it will be used to go to the next line*/
|
||||
@@ -688,10 +693,10 @@ 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_STM32_DMA2D
|
||||
if(lv_area_get_size(draw_area) >= 240) {
|
||||
lv_gpu_stm32_dma2d_copy(disp_buf_first, disp_w, map_buf_first, map_w, draw_area_w, draw_area_h);
|
||||
return;
|
||||
}
|
||||
if(lv_area_get_size(draw_area) >= 240) {
|
||||
lv_gpu_stm32_dma2d_copy(disp_buf_first, disp_w, map_buf_first, map_w, draw_area_w, draw_area_h);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*Software rendering*/
|
||||
@@ -703,13 +708,13 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col
|
||||
}
|
||||
else {
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
if(lv_area_get_size(draw_area) >= 240) {
|
||||
lv_gpu_stm32_dma2d_blend(disp_buf_first, disp_w, map_buf_first, opa, map_w, draw_area_w, draw_area_h);
|
||||
return;
|
||||
}
|
||||
if(lv_area_get_size(draw_area) >= 240) {
|
||||
lv_gpu_stm32_dma2d_blend(disp_buf_first, disp_w, map_buf_first, opa, map_w, draw_area_w, draw_area_h);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*Software rendering*/
|
||||
/*Software rendering*/
|
||||
|
||||
for(y = 0; y < draw_area_h; y++) {
|
||||
for(x = 0; x < draw_area_w; x++) {
|
||||
@@ -746,9 +751,9 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col
|
||||
#else
|
||||
for(x = 0; x < draw_area_w && ((lv_uintptr_t)mask_tmp_x & 0x3); x++) {
|
||||
#if LV_COLOR_SCREEN_TRANSP
|
||||
MAP_NORMAL_MASK_PX_SCR_TRANSP(x)
|
||||
MAP_NORMAL_MASK_PX_SCR_TRANSP(x)
|
||||
#else
|
||||
MAP_NORMAL_MASK_PX(x)
|
||||
MAP_NORMAL_MASK_PX(x)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -37,11 +37,12 @@ typedef uint8_t lv_blend_mode_t;
|
||||
**********************/
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_blend_fill(const lv_area_t * clip_area, const lv_area_t * fill_area, lv_color_t color,
|
||||
lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa, lv_blend_mode_t mode);
|
||||
lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa, lv_blend_mode_t mode);
|
||||
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_blend_map(const lv_area_t * clip_area, const lv_area_t * map_area, const lv_color_t * map_buf,
|
||||
lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa, lv_blend_mode_t mode);
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_blend_map(const lv_area_t * clip_area, const lv_area_t * map_area,
|
||||
const lv_color_t * map_buf,
|
||||
lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa, lv_blend_mode_t mode);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -27,12 +27,14 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * mask, const void * src,
|
||||
lv_draw_img_dsc_t * draw_dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * mask,
|
||||
const void * src,
|
||||
lv_draw_img_dsc_t * draw_dsc);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area, const uint8_t * map_p,
|
||||
lv_draw_img_dsc_t * draw_dsc,
|
||||
bool chroma_key, bool alpha_byte);
|
||||
LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area,
|
||||
const uint8_t * map_p,
|
||||
lv_draw_img_dsc_t * draw_dsc,
|
||||
bool chroma_key, bool alpha_byte);
|
||||
|
||||
static void show_error(const lv_area_t * coords, const lv_area_t * clip_area, const char * msg);
|
||||
|
||||
@@ -230,8 +232,9 @@ lv_img_src_t lv_img_src_get_type(const void * src)
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * mask, const void * src,
|
||||
lv_draw_img_dsc_t * draw_dsc)
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * mask,
|
||||
const void * src,
|
||||
lv_draw_img_dsc_t * draw_dsc)
|
||||
{
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return LV_RES_OK;
|
||||
|
||||
@@ -335,8 +338,9 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords,
|
||||
* @param zoom zoom factor
|
||||
* @param antialias anti-alias transformations (rotate, zoom) or not
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area, const uint8_t * map_p,
|
||||
lv_draw_img_dsc_t * draw_dsc, bool chroma_key, bool alpha_byte)
|
||||
LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area,
|
||||
const uint8_t * map_p,
|
||||
lv_draw_img_dsc_t * draw_dsc, bool chroma_key, bool alpha_byte)
|
||||
{
|
||||
/* Use the clip area as draw area*/
|
||||
lv_area_t draw_area;
|
||||
@@ -403,7 +407,8 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
int32_t disp_w = lv_area_get_width(disp_area);
|
||||
lv_color_t * disp_buf = vdb->buf_act;
|
||||
lv_color_t * disp_buf_first = disp_buf + disp_w * draw_area.y1 + draw_area.x1;
|
||||
lv_gpu_stm32_dma2d_blend(disp_buf_first, disp_w, (const lv_color_t *)map_buf_tmp, draw_dsc->opa, map_w, draw_area_w, draw_area_h);
|
||||
lv_gpu_stm32_dma2d_blend(disp_buf_first, disp_w, (const lv_color_t *)map_buf_tmp, draw_dsc->opa, map_w, draw_area_w,
|
||||
draw_area_h);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -479,7 +484,8 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
}
|
||||
|
||||
lv_draw_mask_res_t mask_res;
|
||||
mask_res = (alpha_byte || chroma_key || draw_dsc->angle || draw_dsc->zoom != LV_IMG_ZOOM_NONE) ? LV_DRAW_MASK_RES_CHANGED : LV_DRAW_MASK_RES_FULL_COVER;
|
||||
mask_res = (alpha_byte || chroma_key || draw_dsc->angle ||
|
||||
draw_dsc->zoom != LV_IMG_ZOOM_NONE) ? LV_DRAW_MASK_RES_CHANGED : LV_DRAW_MASK_RES_FULL_COVER;
|
||||
|
||||
|
||||
/*Prepare the `mask_buf`if there are other masks*/
|
||||
@@ -502,7 +508,8 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
if(px_opa < LV_OPA_MIN) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
mask_buf[px_i] = 0xFF;
|
||||
}
|
||||
|
||||
@@ -569,7 +576,8 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
blend_area.y2 = blend_area.y1;
|
||||
|
||||
px_i = 0;
|
||||
mask_res = (alpha_byte || chroma_key || draw_dsc->angle || draw_dsc->zoom != LV_IMG_ZOOM_NONE) ? LV_DRAW_MASK_RES_CHANGED : LV_DRAW_MASK_RES_FULL_COVER;
|
||||
mask_res = (alpha_byte || chroma_key || draw_dsc->angle ||
|
||||
draw_dsc->zoom != LV_IMG_ZOOM_NONE) ? LV_DRAW_MASK_RES_CHANGED : LV_DRAW_MASK_RES_FULL_COVER;
|
||||
|
||||
/*Prepare the `mask_buf`if there are other masks*/
|
||||
if(other_mask_cnt) {
|
||||
|
||||
@@ -32,10 +32,12 @@ typedef uint8_t cmd_state_t;
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
LV_ATTRIBUTE_FAST_MEM static void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area, const lv_font_t * font_p,
|
||||
uint32_t letter, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g, const lv_area_t * clip_area,
|
||||
const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
|
||||
LV_ATTRIBUTE_FAST_MEM static void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area,
|
||||
const lv_font_t * font_p,
|
||||
uint32_t letter, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g,
|
||||
const lv_area_t * clip_area,
|
||||
const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
|
||||
static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g, const lv_area_t * clip_area,
|
||||
const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
|
||||
|
||||
@@ -54,30 +56,31 @@ const uint8_t _lv_bpp1_opa_table[2] = {0, 255}; /*Opacity mapping with
|
||||
const uint8_t _lv_bpp2_opa_table[4] = {0, 85, 170, 255}; /*Opacity mapping with bpp = 2*/
|
||||
|
||||
const uint8_t _lv_bpp3_opa_table[8] = {0, 36, 73, 109, /*Opacity mapping with bpp = 3*/
|
||||
146, 182, 219, 255};
|
||||
146, 182, 219, 255
|
||||
};
|
||||
|
||||
const uint8_t _lv_bpp4_opa_table[16] = {0, 17, 34, 51, /*Opacity mapping with bpp = 4*/
|
||||
68, 85, 102, 119,
|
||||
136, 153, 170, 187,
|
||||
204, 221, 238, 255
|
||||
};
|
||||
68, 85, 102, 119,
|
||||
136, 153, 170, 187,
|
||||
204, 221, 238, 255
|
||||
};
|
||||
const uint8_t _lv_bpp8_opa_table[256] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
|
||||
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
|
||||
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
|
||||
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
|
||||
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
|
||||
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
|
||||
128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
|
||||
144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
|
||||
160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
|
||||
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
|
||||
192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
|
||||
208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
|
||||
224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
|
||||
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
|
||||
};
|
||||
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
|
||||
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
|
||||
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
|
||||
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
|
||||
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
|
||||
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
|
||||
128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
|
||||
144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
|
||||
160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
|
||||
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
|
||||
192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
|
||||
208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
|
||||
224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
|
||||
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
|
||||
};
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
@@ -107,7 +110,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc)
|
||||
* @param txt `\0` terminated text to write
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, lv_draw_label_dsc_t * dsc,
|
||||
const char * txt, lv_draw_label_hint_t * hint)
|
||||
const char * txt, lv_draw_label_hint_t * hint)
|
||||
{
|
||||
|
||||
if(dsc->opa <= LV_OPA_MIN) return;
|
||||
@@ -390,9 +393,10 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
||||
* @param color color of letter
|
||||
* @param opa opacity of letter (0..255)
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM static void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area, const lv_font_t * font_p,
|
||||
uint32_t letter,
|
||||
lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode)
|
||||
LV_ATTRIBUTE_FAST_MEM static void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area,
|
||||
const lv_font_t * font_p,
|
||||
uint32_t letter,
|
||||
lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode)
|
||||
{
|
||||
if(opa < LV_OPA_MIN) return;
|
||||
if(opa > LV_OPA_MAX) opa = LV_OPA_COVER;
|
||||
@@ -443,8 +447,9 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_letter(const lv_point_t * pos_p, const
|
||||
}
|
||||
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g, const lv_area_t * clip_area,
|
||||
const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode)
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g,
|
||||
const lv_area_t * clip_area,
|
||||
const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode)
|
||||
{
|
||||
const uint8_t * bpp_opa_table_p;
|
||||
uint32_t bitmask_init;
|
||||
|
||||
@@ -74,7 +74,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc);
|
||||
* @param txt `\0` terminated text to write
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, lv_draw_label_dsc_t * dsc,
|
||||
const char * txt, lv_draw_label_hint_t * hint);
|
||||
const char * txt, lv_draw_label_hint_t * hint);
|
||||
|
||||
/***********************
|
||||
* GLOBAL VARIABLES
|
||||
|
||||
@@ -24,12 +24,15 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, const lv_point_t * point2,
|
||||
const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const lv_point_t * point2,
|
||||
const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const lv_point_t * point2,
|
||||
const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -60,7 +63,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc)
|
||||
* @param opa_scale scale down all opacities by the factor
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_line(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc)
|
||||
lv_draw_line_dsc_t * dsc)
|
||||
{
|
||||
if(dsc->width == 0) return;
|
||||
if(dsc->opa <= LV_OPA_MIN) return;
|
||||
@@ -115,8 +118,9 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_line(const lv_point_t * point1, const lv_poin
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc)
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const lv_point_t * point2,
|
||||
const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc)
|
||||
{
|
||||
lv_opa_t opa = dsc->opa;
|
||||
|
||||
@@ -215,8 +219,9 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const
|
||||
}
|
||||
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc)
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const lv_point_t * point2,
|
||||
const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc)
|
||||
{
|
||||
lv_opa_t opa = dsc->opa;
|
||||
|
||||
@@ -309,8 +314,9 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const
|
||||
}
|
||||
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc)
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, const lv_point_t * point2,
|
||||
const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc)
|
||||
{
|
||||
/*Keep the great y in p1*/
|
||||
lv_point_t p1;
|
||||
@@ -447,8 +453,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, cons
|
||||
}
|
||||
else {
|
||||
lv_blend_fill(&fill_area, clip,
|
||||
dsc->color, mask_buf, LV_DRAW_MASK_RES_CHANGED, dsc->opa,
|
||||
dsc->blend_mode);
|
||||
dsc->color, mask_buf, LV_DRAW_MASK_RES_CHANGED, dsc->opa,
|
||||
dsc->blend_mode);
|
||||
|
||||
fill_area.y1 = fill_area.y2 + 1;
|
||||
fill_area.y2 = fill_area.y1;
|
||||
@@ -460,9 +466,9 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, cons
|
||||
/*Flush the last part*/
|
||||
if(fill_area.y1 != fill_area.y2) {
|
||||
fill_area.y2--;
|
||||
lv_blend_fill( &fill_area, clip,
|
||||
dsc->color, mask_buf, LV_DRAW_MASK_RES_CHANGED, dsc->opa,
|
||||
dsc->blend_mode);
|
||||
lv_blend_fill(&fill_area, clip,
|
||||
dsc->color, mask_buf, LV_DRAW_MASK_RES_CHANGED, dsc->opa,
|
||||
dsc->blend_mode);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ typedef struct {
|
||||
* @param opa_scale scale down all opacities by the factor
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_line(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * mask,
|
||||
lv_draw_line_dsc_t * dsc);
|
||||
lv_draw_line_dsc_t * dsc);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc);
|
||||
|
||||
|
||||
@@ -31,21 +31,28 @@ typedef struct {
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_line(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * param);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_radius_param_t * param);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_angle_param_t * param);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_fade(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_fade_param_t * param);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_map(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_map_param_t * param);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_line(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * param);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_radius_param_t * param);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_angle_param_t * param);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_fade(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_fade_param_t * param);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_map(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_map_param_t * param);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_flat(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_flat(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static inline lv_opa_t mask_mix(lv_opa_t mask_act, lv_opa_t mask_new);
|
||||
LV_ATTRIBUTE_FAST_MEM static inline void sqrt_approx(lv_sqrt_res_t * q, lv_sqrt_res_t * ref, uint32_t x);
|
||||
@@ -99,7 +106,8 @@ int16_t lv_draw_mask_add(void * param, void * custom_id)
|
||||
* - `LV_DRAW_MASK_RES_FULL_COVER`: the whole line is fully visible. `mask_buf` is unchanged
|
||||
* - `LV_DRAW_MASK_RES_CHANGED`: `mask_buf` has changed, it shows the desired opacity of each pixel in the given line
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len)
|
||||
LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len)
|
||||
{
|
||||
bool changed = false;
|
||||
lv_draw_mask_common_dsc_t * dsc;
|
||||
@@ -425,8 +433,9 @@ void lv_draw_mask_map_init(lv_draw_mask_map_param_t * param, const lv_area_t * c
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_line(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p)
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_line(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p)
|
||||
{
|
||||
/*Make to points relative to the vertex*/
|
||||
abs_y -= p->origo.y;
|
||||
@@ -484,8 +493,9 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_line(lv_opa_t * mas
|
||||
return res;
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_flat(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p)
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_flat(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p)
|
||||
{
|
||||
int32_t y_at_x;
|
||||
y_at_x = (int32_t)((int32_t)p->yx_steep * abs_x) >> 10;
|
||||
@@ -600,8 +610,9 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_flat(lv_opa_t * mask_b
|
||||
return LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p)
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p)
|
||||
{
|
||||
int32_t k;
|
||||
int32_t x_at_y;
|
||||
@@ -742,8 +753,9 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_
|
||||
}
|
||||
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_angle_param_t * p)
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_angle_param_t * p)
|
||||
{
|
||||
int32_t rel_y = abs_y - p->cfg.vertex_p.y;
|
||||
int32_t rel_x = abs_x - p->cfg.vertex_p.x;
|
||||
@@ -881,8 +893,9 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * ma
|
||||
}
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_radius_param_t * p)
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_radius_param_t * p)
|
||||
{
|
||||
bool outer = p->cfg.outer;
|
||||
int32_t radius = p->cfg.radius;
|
||||
@@ -890,7 +903,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
lv_area_copy(&rect, &p->cfg.rect);
|
||||
|
||||
if(outer == false) {
|
||||
if(abs_y < rect.y1 || abs_y >rect.y2) {
|
||||
if(abs_y < rect.y1 || abs_y > rect.y2) {
|
||||
return LV_DRAW_MASK_RES_TRANSP;
|
||||
}
|
||||
}
|
||||
@@ -961,11 +974,12 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
if(y == p->y_prev) {
|
||||
x0.f = p->y_prev_x.f;
|
||||
x0.i = p->y_prev_x.i;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lv_sqrt(r2 - (y * y), &x0, sqrt_mask);
|
||||
}
|
||||
lv_sqrt(r2 - ((y - 1) * (y - 1)), &x1, sqrt_mask);
|
||||
p->y_prev = y-1;
|
||||
p->y_prev = y - 1;
|
||||
p->y_prev_x.f = x1.f;
|
||||
p->y_prev_x.i = x1.i;
|
||||
}
|
||||
@@ -978,7 +992,8 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
if((y - 1) == p->y_prev) {
|
||||
x1.f = p->y_prev_x.f;
|
||||
x1.i = p->y_prev_x.i;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lv_sqrt(r2 - ((y - 1) * (y - 1)), &x1, sqrt_mask);
|
||||
}
|
||||
|
||||
@@ -1130,8 +1145,9 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
}
|
||||
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_fade(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_fade_param_t * p)
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_fade(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_fade_param_t * p)
|
||||
{
|
||||
if(abs_y < p->cfg.coords.y1) return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
if(abs_y > p->cfg.coords.y2) return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
@@ -1175,8 +1191,9 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_fade(lv_opa_t * mas
|
||||
}
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_map(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_map_param_t * p)
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_map(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_map_param_t * p)
|
||||
{
|
||||
/*Handle out of the mask cases*/
|
||||
if(abs_y < p->cfg.coords.y1) return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
@@ -1229,7 +1246,7 @@ LV_ATTRIBUTE_FAST_MEM static inline void sqrt_approx(lv_sqrt_res_t * q, lv_sqrt_
|
||||
x = x << 8; /*Upscale for extra precision*/
|
||||
|
||||
uint32_t raw = (ref->i << 4) + (ref->f >> 4);
|
||||
uint32_t raw2 = raw*raw;
|
||||
uint32_t raw2 = raw * raw;
|
||||
|
||||
int32_t d = x - raw2;
|
||||
d = (int32_t)d / (int32_t)(2 * raw) + raw;
|
||||
|
||||
@@ -57,8 +57,9 @@ enum {
|
||||
* A common callback type for every mask type.
|
||||
* Used internally by the library.
|
||||
*/
|
||||
typedef lv_draw_mask_res_t (*lv_draw_mask_xcb_t)(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
void * p);
|
||||
typedef lv_draw_mask_res_t (*lv_draw_mask_xcb_t)(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len,
|
||||
void * p);
|
||||
|
||||
typedef uint8_t lv_draw_mask_line_side_t;
|
||||
|
||||
@@ -183,7 +184,8 @@ int16_t lv_draw_mask_add(void * param, void * custom_id);
|
||||
* - `LV_DRAW_MASK_RES_FULL_COVER`: the whole line is fully visible. `mask_buf` is unchanged
|
||||
* - `LV_DRAW_MASK_RES_CHANGED`: `mask_buf` has changed, it shows the desired opacity of each pixel in the given line
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len);
|
||||
LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len);
|
||||
|
||||
/**
|
||||
* Remove a mask with a given ID
|
||||
|
||||
@@ -29,13 +29,16 @@
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv_area_t * clip,
|
||||
lv_draw_rect_dsc_t * dsc);
|
||||
static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static inline lv_color_t grad_get(lv_draw_rect_dsc_t * dsc, lv_coord_t s, lv_coord_t i);
|
||||
#if LV_USE_SHADOW
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coords, uint16_t * sh_buf, lv_coord_t s, lv_coord_t r);
|
||||
LV_ATTRIBUTE_FAST_MEM static void shadow_blur_corner(lv_coord_t size, lv_coord_t sw, uint16_t * sh_ups_buf);
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip,
|
||||
lv_draw_rect_dsc_t * dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coords, uint16_t * sh_buf, lv_coord_t s,
|
||||
lv_coord_t r);
|
||||
LV_ATTRIBUTE_FAST_MEM static void shadow_blur_corner(lv_coord_t size, lv_coord_t sw, uint16_t * sh_ups_buf);
|
||||
#endif
|
||||
static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc);
|
||||
static void draw_value(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc);
|
||||
@@ -44,9 +47,9 @@ static void draw_value(const lv_area_t * coords, const lv_area_t * clip, lv_draw
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
#if LV_USE_SHADOW && LV_SHADOW_CACHE_SIZE
|
||||
static uint8_t sh_cache[LV_SHADOW_CACHE_SIZE * LV_SHADOW_CACHE_SIZE];
|
||||
static int32_t sh_cache_size = -1;
|
||||
static int32_t sh_cache_r = -1;
|
||||
static uint8_t sh_cache[LV_SHADOW_CACHE_SIZE * LV_SHADOW_CACHE_SIZE];
|
||||
static int32_t sh_cache_size = -1;
|
||||
static int32_t sh_cache_r = -1;
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
@@ -346,7 +349,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
||||
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc)
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv_area_t * clip,
|
||||
lv_draw_rect_dsc_t * dsc)
|
||||
{
|
||||
if(dsc->border_opa <= LV_OPA_MIN) return;
|
||||
if(dsc->border_width == 0) return;
|
||||
@@ -575,7 +579,8 @@ LV_ATTRIBUTE_FAST_MEM static inline lv_color_t grad_get(lv_draw_rect_dsc_t * dsc
|
||||
}
|
||||
|
||||
#if LV_USE_SHADOW
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc)
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip,
|
||||
lv_draw_rect_dsc_t * dsc)
|
||||
{
|
||||
/*Check whether the shadow is visible*/
|
||||
if(dsc->shadow_width == 0) return;
|
||||
@@ -650,7 +655,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
/*Use the cache if available*/
|
||||
sh_buf = lv_mem_buf_get(corner_size * corner_size);
|
||||
lv_memcpy(sh_buf, sh_cache, corner_size * corner_size);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
/*A larger buffer is required for calculation */
|
||||
sh_buf = lv_mem_buf_get(corner_size * corner_size * sizeof(uint16_t));
|
||||
shadow_draw_corner_buf(&sh_rect_area, (uint16_t *)sh_buf, dsc->shadow_width, r_sh);
|
||||
@@ -717,7 +723,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
|
||||
lv_blend_fill(clip, &fa, dsc->shadow_color, mask_buf,
|
||||
mask_res, opa, dsc->shadow_blend_mode);
|
||||
mask_res, opa, dsc->shadow_blend_mode);
|
||||
fa.y1++;
|
||||
fa.y2++;
|
||||
sh_buf_tmp += corner_size;
|
||||
@@ -754,7 +760,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
|
||||
lv_blend_fill(clip, &fa, dsc->shadow_color, mask_buf,
|
||||
mask_res, opa, dsc->shadow_blend_mode);
|
||||
mask_res, opa, dsc->shadow_blend_mode);
|
||||
fa.y1--;
|
||||
fa.y2--;
|
||||
sh_buf_tmp += corner_size;
|
||||
@@ -789,13 +795,14 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
|
||||
if(simple_mode) {
|
||||
mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
mask_res = lv_draw_mask_apply(mask_buf, fa.x1, fa.y1, w);
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
|
||||
lv_blend_fill(clip, &fa,
|
||||
dsc->shadow_color, mask_buf, mask_res, dsc->shadow_opa, dsc->shadow_blend_mode);
|
||||
dsc->shadow_color, mask_buf, mask_res, dsc->shadow_opa, dsc->shadow_blend_mode);
|
||||
fa.y1++;
|
||||
fa.y2++;
|
||||
}
|
||||
@@ -842,7 +849,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
|
||||
lv_blend_fill(clip, &fa, dsc->shadow_color, mask_buf,
|
||||
mask_res, opa, dsc->shadow_blend_mode);
|
||||
mask_res, opa, dsc->shadow_blend_mode);
|
||||
fa.y1++;
|
||||
fa.y2++;
|
||||
sh_buf_tmp += corner_size;
|
||||
@@ -878,7 +885,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
|
||||
lv_blend_fill(clip, &fa, dsc->shadow_color, mask_buf,
|
||||
mask_res, opa, dsc->shadow_blend_mode);
|
||||
mask_res, opa, dsc->shadow_blend_mode);
|
||||
fa.y1--;
|
||||
fa.y2--;
|
||||
sh_buf_tmp += corner_size;
|
||||
@@ -911,13 +918,14 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
lv_memcpy(mask_buf, sh_buf_tmp, w);
|
||||
if(simple_mode) {
|
||||
mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
mask_res = lv_draw_mask_apply(mask_buf, fa.x1, fa.y1, w);
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
|
||||
lv_blend_fill(clip, &fa,
|
||||
dsc->shadow_color, mask_buf, mask_res, dsc->shadow_opa, dsc->shadow_blend_mode);
|
||||
dsc->shadow_color, mask_buf, mask_res, dsc->shadow_opa, dsc->shadow_blend_mode);
|
||||
fa.y1++;
|
||||
fa.y2++;
|
||||
}
|
||||
@@ -951,7 +959,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
|
||||
if(simple_mode) {
|
||||
mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
mask_res = lv_draw_mask_apply(mask_buf, fa.x1, fa.y1, w);
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
@@ -990,7 +999,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
lv_memset(mask_buf, opa_tmp, w);
|
||||
if(simple_mode) {
|
||||
mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
mask_res = lv_draw_mask_apply(mask_buf, fa.x1, fa.y1, w);
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
@@ -1024,7 +1034,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
|
||||
lv_blend_fill(clip, &fa, dsc->shadow_color, mask_buf,
|
||||
mask_res, LV_OPA_COVER, dsc->shadow_blend_mode);
|
||||
mask_res, LV_OPA_COVER, dsc->shadow_blend_mode);
|
||||
fa.y1++;
|
||||
fa.y2++;
|
||||
}
|
||||
@@ -1042,7 +1052,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
* @param sw shadow width
|
||||
* @param r radius
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coords, uint16_t * sh_buf, lv_coord_t sw, lv_coord_t r)
|
||||
LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coords, uint16_t * sh_buf, lv_coord_t sw,
|
||||
lv_coord_t r)
|
||||
{
|
||||
int32_t sw_ori = sw;
|
||||
int32_t size = sw_ori + r;
|
||||
|
||||
@@ -672,7 +672,7 @@ static inline bool transform_anti_alias(lv_img_transform_dsc_t * dsc)
|
||||
lv_memcpy_small(&c01, &src_u8[dsc->tmp.pxi + dsc->tmp.px_size * xn], sizeof(lv_color_t));
|
||||
lv_memcpy_small(&c10, &src_u8[dsc->tmp.pxi + dsc->cfg.src_w * dsc->tmp.px_size * yn], sizeof(lv_color_t));
|
||||
lv_memcpy_small(&c11, &src_u8[dsc->tmp.pxi + dsc->cfg.src_w * dsc->tmp.px_size * yn + dsc->tmp.px_size * xn],
|
||||
sizeof(lv_color_t));
|
||||
sizeof(lv_color_t));
|
||||
if(dsc->tmp.has_alpha) {
|
||||
a10 = src_u8[dsc->tmp.pxi + dsc->tmp.px_size * xn + dsc->tmp.px_size - 1];
|
||||
a01 = src_u8[dsc->tmp.pxi + dsc->cfg.src_w * dsc->tmp.px_size * yn + dsc->tmp.px_size - 1];
|
||||
|
||||
@@ -17,21 +17,21 @@
|
||||
*********************/
|
||||
|
||||
#if LV_COLOR_16_SWAP
|
||||
#error "Can't use DMA2D with LV_COLOR_16_SWAP 1"
|
||||
#error "Can't use DMA2D with LV_COLOR_16_SWAP 1"
|
||||
#endif
|
||||
|
||||
#if LV_COLOR_DEPTH == 8
|
||||
#error "Can't use DMA2D with LV_COLOR_DEPTH == 8"
|
||||
#error "Can't use DMA2D with LV_COLOR_DEPTH == 8"
|
||||
#endif
|
||||
|
||||
#if LV_COLOR_DEPTH == 16
|
||||
#define DMA2D_OUTPUT_FORMAT DMA2D_OUTPUT_RGB565
|
||||
#define DMA2D_INPUT_FORMAT DMA2D_INPUT_RGB565
|
||||
#define DMA2D_OUTPUT_FORMAT DMA2D_OUTPUT_RGB565
|
||||
#define DMA2D_INPUT_FORMAT DMA2D_INPUT_RGB565
|
||||
#elif LV_COLOR_DEPTH == 32
|
||||
#define DMA2D_OUTPUT_FORMAT DMA2D_OUTPUT_ARGB8888
|
||||
#define DMA2D_INPUT_FORMAT DMA2D_INPUT_ARGB8888
|
||||
#define DMA2D_OUTPUT_FORMAT DMA2D_OUTPUT_ARGB8888
|
||||
#define DMA2D_INPUT_FORMAT DMA2D_INPUT_ARGB8888
|
||||
#else
|
||||
/*Can't use GPU with other formats*/
|
||||
/*Can't use GPU with other formats*/
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
@@ -96,7 +96,8 @@ void lv_gpu_stm32_dma2d_fill(lv_color_t * buf, lv_coord_t buf_w, lv_color_t colo
|
||||
* @param fill_h height to fill in pixels
|
||||
* @note `buf_w - fill_w` is offset to the next line after fill
|
||||
*/
|
||||
void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t color, const lv_opa_t * mask, lv_opa_t opa, lv_coord_t fill_w, lv_coord_t fill_h)
|
||||
void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t color, const lv_opa_t * mask,
|
||||
lv_opa_t opa, lv_coord_t fill_w, lv_coord_t fill_h)
|
||||
{
|
||||
invalidate_cache();
|
||||
|
||||
@@ -124,7 +125,7 @@ void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t
|
||||
HAL_DMA2D_Init(&hdma2d);
|
||||
HAL_DMA2D_ConfigLayer(&hdma2d, 0);
|
||||
HAL_DMA2D_ConfigLayer(&hdma2d, 1);
|
||||
HAL_DMA2D_BlendingStart(&hdma2d, (uint32_t) mask, (uint32_t) buf, (uint32_t)buf, fill_w, fill_h);
|
||||
HAL_DMA2D_BlendingStart(&hdma2d, (uint32_t) mask, (uint32_t) buf, (uint32_t)buf, fill_w, fill_h);
|
||||
dma2d_wait();
|
||||
}
|
||||
|
||||
@@ -138,7 +139,8 @@ void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t
|
||||
* @param copy_h height of the area to copy in pixels
|
||||
* @note `map_w - fill_w` is offset to the next line after copy
|
||||
*/
|
||||
void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h)
|
||||
void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_coord_t map_w,
|
||||
lv_coord_t copy_w, lv_coord_t copy_h)
|
||||
{
|
||||
invalidate_cache();
|
||||
|
||||
@@ -173,7 +175,8 @@ void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_
|
||||
* @param copy_h height of the area to copy in pixels
|
||||
* @note `map_w - fill_w` is offset to the next line after copy
|
||||
*/
|
||||
void lv_gpu_stm32_dma2d_blend(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_opa_t opa, lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h)
|
||||
void lv_gpu_stm32_dma2d_blend(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_opa_t opa,
|
||||
lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h)
|
||||
{
|
||||
invalidate_cache();
|
||||
|
||||
|
||||
@@ -37,7 +37,8 @@ extern "C" {
|
||||
* @param fill_h height to fill in pixels
|
||||
* @note `buf_w - fill_w` is offset to the next line after fill
|
||||
*/
|
||||
void lv_gpu_stm32_dma2d_fill(lv_color_t * buf, lv_coord_t buf_w, lv_color_t color, lv_coord_t fill_w, lv_coord_t fill_h);
|
||||
void lv_gpu_stm32_dma2d_fill(lv_color_t * buf, lv_coord_t buf_w, lv_color_t color, lv_coord_t fill_w,
|
||||
lv_coord_t fill_h);
|
||||
|
||||
|
||||
/**
|
||||
@@ -51,7 +52,8 @@ void lv_gpu_stm32_dma2d_fill(lv_color_t * buf, lv_coord_t buf_w, lv_color_t colo
|
||||
* @param fill_h height to fill in pixels
|
||||
* @note `buf_w - fill_w` is offset to the next line after fill
|
||||
*/
|
||||
void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t color, const lv_opa_t * mask, lv_opa_t opa, lv_coord_t fill_w, lv_coord_t fill_h);
|
||||
void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t color, const lv_opa_t * mask,
|
||||
lv_opa_t opa, lv_coord_t fill_w, lv_coord_t fill_h);
|
||||
|
||||
/**
|
||||
* Copy a map (typically RGB image) to a buffer
|
||||
@@ -63,7 +65,8 @@ void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t
|
||||
* @param copy_h height of the area to copy in pixels
|
||||
* @note `map_w - fill_w` is offset to the next line after copy
|
||||
*/
|
||||
void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h);
|
||||
void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_coord_t map_w,
|
||||
lv_coord_t copy_w, lv_coord_t copy_h);
|
||||
/**
|
||||
* Blend a map (e.g. ARGB image or RGB image with opacity) to a buffer
|
||||
* @param buf a buffer where `map` should be copied
|
||||
@@ -75,7 +78,8 @@ void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_
|
||||
* @param copy_h height of the area to copy in pixels
|
||||
* @note `map_w - fill_w` is offset to the next line after copy
|
||||
*/
|
||||
void lv_gpu_stm32_dma2d_blend(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_opa_t opa, lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h);
|
||||
void lv_gpu_stm32_dma2d_blend(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_opa_t opa,
|
||||
lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h);
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -52,10 +52,12 @@ typedef struct {
|
||||
void * buf_act;
|
||||
uint32_t size; /*In pixel count*/
|
||||
lv_area_t area;
|
||||
volatile int flushing; /*1: flushing is in progress. (It can't be a bitfield because when it's cleared from IRQ Read-Modify-Write issue might occur)*/
|
||||
volatile int flushing_last; /*1: It was the last chunk to flush. (It can't be a bitfield because when it's cleared from IRQ Read-Modify-Write issue might occur)*/
|
||||
volatile uint32_t last_area :1; /*1: the last area is being rendered*/
|
||||
volatile uint32_t last_part :1; /*1: the last part of the current area is being rendered*/
|
||||
volatile int
|
||||
flushing; /*1: flushing is in progress. (It can't be a bitfield because when it's cleared from IRQ Read-Modify-Write issue might occur)*/
|
||||
volatile int
|
||||
flushing_last; /*1: It was the last chunk to flush. (It can't be a bitfield because when it's cleared from IRQ Read-Modify-Write issue might occur)*/
|
||||
volatile uint32_t last_area : 1; /*1: the last area is being rendered*/
|
||||
volatile uint32_t last_part : 1; /*1: the last part of the current area is being rendered*/
|
||||
} lv_disp_buf_t;
|
||||
|
||||
/**
|
||||
@@ -84,7 +86,7 @@ typedef struct _disp_drv_t {
|
||||
/** DPI (dot per inch) of the display.
|
||||
* Set to `LV_DPI` from `lv_Conf.h` by default.
|
||||
*/
|
||||
uint32_t dpi :10;
|
||||
uint32_t dpi : 10;
|
||||
|
||||
/** MANDATORY: Write the internal buffer (VDB) to the display. 'lv_disp_flush_ready()' has to be
|
||||
* called when finished */
|
||||
@@ -163,7 +165,7 @@ typedef enum {
|
||||
LV_DISP_SIZE_MEDIUM,
|
||||
LV_DISP_SIZE_LARGE,
|
||||
LV_DISP_SIZE_EXTRA_LARGE,
|
||||
}lv_disp_size_t;
|
||||
} lv_disp_size_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
||||
@@ -49,10 +49,10 @@ struct _lv_anim_path_t;
|
||||
/** Get the current value during an animation*/
|
||||
typedef lv_anim_value_t (*lv_anim_path_cb_t)(const struct _lv_anim_path_t *, const struct _lv_anim_t *);
|
||||
|
||||
typedef struct _lv_anim_path_t{
|
||||
typedef struct _lv_anim_path_t {
|
||||
lv_anim_path_cb_t cb;
|
||||
void * user_data;
|
||||
}lv_anim_path_t;
|
||||
} lv_anim_path_t;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -40,30 +40,47 @@
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_color_fill(lv_color_t * buf, lv_color_t color, uint32_t px_num)
|
||||
{
|
||||
while(px_num > 16) {
|
||||
*buf = color; buf++;
|
||||
*buf = color; buf++;
|
||||
*buf = color; buf++;
|
||||
*buf = color; buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
|
||||
*buf = color; buf++;
|
||||
*buf = color; buf++;
|
||||
*buf = color; buf++;
|
||||
*buf = color; buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
|
||||
*buf = color; buf++;
|
||||
*buf = color; buf++;
|
||||
*buf = color; buf++;
|
||||
*buf = color; buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
|
||||
*buf = color; buf++;
|
||||
*buf = color; buf++;
|
||||
*buf = color; buf++;
|
||||
*buf = color; buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
|
||||
px_num -= 16;
|
||||
}
|
||||
while(px_num ) {
|
||||
*buf = color; buf++;
|
||||
while(px_num) {
|
||||
*buf = color;
|
||||
buf++;
|
||||
px_num --;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -506,8 +506,9 @@ LV_ATTRIBUTE_FAST_MEM static inline lv_color_t lv_color_mix_premult(uint16_t * p
|
||||
* @param res_color the result color
|
||||
* @param res_opa the result opacity
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM static inline void lv_color_mix_with_alpha(lv_color_t bg_color, lv_opa_t bg_opa, lv_color_t fg_color, lv_opa_t fg_opa,
|
||||
lv_color_t * res_color, lv_opa_t * res_opa)
|
||||
LV_ATTRIBUTE_FAST_MEM static inline void lv_color_mix_with_alpha(lv_color_t bg_color, lv_opa_t bg_opa,
|
||||
lv_color_t fg_color, lv_opa_t fg_opa,
|
||||
lv_color_t * res_color, lv_opa_t * res_opa)
|
||||
{
|
||||
/* Pick the foreground if it's fully opaque or the Background is fully transparent*/
|
||||
if(fg_opa >= LV_OPA_MAX || bg_opa <= LV_OPA_MIN) {
|
||||
|
||||
@@ -120,12 +120,12 @@ LV_ATTRIBUTE_FAST_MEM void lv_sqrt(uint32_t x, lv_sqrt_res_t * q, uint32_t mask)
|
||||
// http://ww1.microchip.com/...en/AppNotes/91040a.pdf
|
||||
do {
|
||||
trial = root + mask;
|
||||
if ((uint32_t)trial * trial <= x) root = trial;
|
||||
if((uint32_t)trial * trial <= x) root = trial;
|
||||
mask = mask >> 1;
|
||||
} while(mask);
|
||||
|
||||
q->i = (uint32_t) root >> 4;
|
||||
q->f = (uint32_t) (root & 0xf) << 4;
|
||||
q->f = (uint32_t)(root & 0xf) << 4;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -238,7 +238,8 @@ void lv_mem_free(const void * data)
|
||||
}
|
||||
e_next = ent_get_next(e_next);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
full_defrag_cnt = 0;
|
||||
lv_mem_defrag();
|
||||
|
||||
@@ -385,7 +386,7 @@ lv_res_t lv_mem_test(void)
|
||||
if(e->header.s.d_size > LV_MEM_SIZE) {
|
||||
return LV_RES_INV;
|
||||
}
|
||||
uint8_t * e8 = (uint8_t*) e;
|
||||
uint8_t * e8 = (uint8_t *) e;
|
||||
if(e8 + e->header.s.d_size > work_mem + LV_MEM_SIZE) {
|
||||
return LV_RES_INV;
|
||||
}
|
||||
@@ -429,7 +430,8 @@ void lv_mem_monitor(lv_mem_monitor_t * mon_p)
|
||||
if(mon_p->free_size > 0) {
|
||||
mon_p->frag_pct = (uint32_t)mon_p->free_biggest_size * 100U / mon_p->free_size;
|
||||
mon_p->frag_pct = 100 - mon_p->frag_pct;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
mon_p->frag_pct = 0; /*no fragmentation if all the RAM is used*/
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -153,7 +153,9 @@ LV_ATTRIBUTE_FAST_MEM static inline void * lv_memcpy_small(void * dst, const voi
|
||||
const uint8_t * s8 = (const uint8_t *)src;
|
||||
|
||||
while(len) {
|
||||
*d8 = *s8; d8++; s8++;
|
||||
*d8 = *s8;
|
||||
d8++;
|
||||
s8++;
|
||||
len--;
|
||||
}
|
||||
|
||||
|
||||
@@ -341,7 +341,7 @@ void lv_task_ready(lv_task_t * task)
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the number of times a task will repeat.
|
||||
* Set the number of times a task will repeat.
|
||||
* @param task pointer to a lv_task.
|
||||
* @param repeat_count -1 : infinity; 0 : stop ; n>0: residual times
|
||||
*/
|
||||
@@ -404,7 +404,7 @@ static bool lv_task_exec(lv_task_t * task)
|
||||
}
|
||||
if(task->repeat_count == 0) {
|
||||
lv_task_del(task);
|
||||
}
|
||||
}
|
||||
}
|
||||
exec = true;
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ void lv_task_set_period(lv_task_t * task, uint32_t period);
|
||||
void lv_task_ready(lv_task_t * task);
|
||||
|
||||
/**
|
||||
* Set the number of times a task will repeat.
|
||||
* Set the number of times a task will repeat.
|
||||
* @param task pointer to a lv_task.
|
||||
* @param repeat_count -1 : infinity; 0 : stop ; n>0: residual times
|
||||
*/
|
||||
|
||||
@@ -31,59 +31,59 @@ static uint32_t lv_ap_get_char_index(uint16_t c);
|
||||
**********************/
|
||||
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
|
||||
const ap_chars_map_t ap_chars_map[]={
|
||||
/* {Key Offset, End, Beginning, Middle, Isolated, {conjunction}} */
|
||||
{1 , 0xFE84, -1, 0, -1, {1, 0}}, // أ
|
||||
{2 , 0xFE86, -1, 0, -1, {1, 0}}, // ؤ
|
||||
{3 , 0xFE88, -1, 0, -1, {1, 0}}, // ﺇ
|
||||
{4 , 0xFE8A, 1, 2, -1, {1, 0}}, // ئ
|
||||
{5 , 0xFE8E, -1, 0, -1, {1, 0}}, // آ
|
||||
{6 , 0xFE90, 1, 2, -1, {1, 1}}, // ب
|
||||
{92 , 0xFB57, 1, 2, -1, {1, 1}}, // پ
|
||||
{8 , 0xFE96, 1, 2, -1, {1, 1}}, // ت
|
||||
{9 , 0xFE9A, 1, 2, -1, {1, 1}}, // ث
|
||||
{10 , 0xFE9E, 1, 2, -1, {1, 1}}, // ج
|
||||
{100, 0xFB7B, 1, 2, -1, {1, 1}}, // چ
|
||||
{11 , 0xFEA2, 1, 2, -1, {1, 1}}, // ح
|
||||
{12 , 0xFEA6, 1, 2, -1, {1, 1}}, // خ
|
||||
{13 , 0xFEAA, -1, 0, -1, {1, 0}}, // د
|
||||
{14 , 0xFEAC, -1, 0, -1, {1, 0}}, // ذ
|
||||
{15 , 0xFEAE, -1, 0, -1, {1, 0}}, // ر
|
||||
{16 , 0xFEB0, -1, 0, -1, {1, 0}}, // ز
|
||||
{118, 0xFB8B, -1, 0, -1, {1, 0}}, // ژ
|
||||
{17 , 0xFEB2, 1, 2, -1, {1, 1}}, // س
|
||||
{18 , 0xFEB6, 1, 2, -1, {1, 1}}, // ش
|
||||
{19 , 0xFEBA, 1, 2, -1, {1, 1}}, // ص
|
||||
{20 , 0xFEBE, 1, 2, -1, {1, 1}}, // ض
|
||||
{21 , 0xFEC2, 1, 2, -1, {1, 1}}, // ط
|
||||
{22 , 0xFEC6, 1, 2, -1, {1, 1}}, // ظ
|
||||
{23 , 0xFECA, 1, 2, -1, {1, 1}}, // ع
|
||||
{24 , 0xFECE, 1, 2, -1, {1, 1}}, // غ
|
||||
{31 , 0xFED2, 1, 2, -1, {1, 1}}, // ف
|
||||
{32 , 0xFED6, 1, 2, -1, {1, 1}}, // ق
|
||||
{135, 0xFB8F, 1, 2, -1, {1, 1}}, // ک
|
||||
{33, 0xFEDA, 1, 2, -1, {1, 1}}, // ﻙ
|
||||
{141, 0xFB93, 1, 2, -1, {1, 1}}, // گ
|
||||
{34 , 0xFEDE, 1, 2, -1, {1, 1}}, // ل
|
||||
{35 , 0xFEE2, 1, 2, -1, {1, 1}}, // م
|
||||
{36 , 0xFEE6, 1, 2, -1, {1, 1}}, // ن
|
||||
{38 , 0xFEEE, -1, 0, -1, {1, 0}}, // و
|
||||
{37 , 0xFEEA, 1, 2, -1, {1, 1}}, // ه
|
||||
{39 , 0xFBFD, 1, 2, -1, {1, 1}}, // ي
|
||||
{40 , 0xFEF2, 1, 2, -1, {1, 1}}, // ي
|
||||
{170 , 0xFBFD, 1, 2, -1, {1, 1}}, // ی
|
||||
{7 , 0xFE94, 1, 2, -1, {1, 0}}, // ة
|
||||
{206, 0x06F0, 1, 2, -1, {0, 0}}, // ۰
|
||||
{207, 0x06F1, 0, 0, 0, {0, 0}}, // ۱
|
||||
{208, 0x06F2, 0, 0, 0, {0, 0}}, // ۲
|
||||
{209, 0x06F3, 0, 0, 0, {0, 0}}, // ۳
|
||||
{210, 0x06F4, 0, 0, 0, {0, 0}}, // ۴
|
||||
{211, 0x06F5, 0, 0, 0, {0, 0}}, // ۵
|
||||
{212, 0x06F6, 0, 0, 0, {0, 0}}, // ۶
|
||||
{213, 0x06F7, 0, 0, 0, {0, 0}}, // ۷
|
||||
{214, 0x06F8, 0, 0, 0, {0, 0}}, // ۸
|
||||
{215, 0x06F9, 0, 0, 0, {0, 0}}, // ۹
|
||||
LV_AP_END_CHARS_LIST
|
||||
const ap_chars_map_t ap_chars_map[] = {
|
||||
/* {Key Offset, End, Beginning, Middle, Isolated, {conjunction}} */
|
||||
{1, 0xFE84, -1, 0, -1, {1, 0}}, // أ
|
||||
{2, 0xFE86, -1, 0, -1, {1, 0}}, // ؤ
|
||||
{3, 0xFE88, -1, 0, -1, {1, 0}}, // ﺇ
|
||||
{4, 0xFE8A, 1, 2, -1, {1, 0}}, // ئ
|
||||
{5, 0xFE8E, -1, 0, -1, {1, 0}}, // آ
|
||||
{6, 0xFE90, 1, 2, -1, {1, 1}}, // ب
|
||||
{92, 0xFB57, 1, 2, -1, {1, 1}}, // پ
|
||||
{8, 0xFE96, 1, 2, -1, {1, 1}}, // ت
|
||||
{9, 0xFE9A, 1, 2, -1, {1, 1}}, // ث
|
||||
{10, 0xFE9E, 1, 2, -1, {1, 1}}, // ج
|
||||
{100, 0xFB7B, 1, 2, -1, {1, 1}}, // چ
|
||||
{11, 0xFEA2, 1, 2, -1, {1, 1}}, // ح
|
||||
{12, 0xFEA6, 1, 2, -1, {1, 1}}, // خ
|
||||
{13, 0xFEAA, -1, 0, -1, {1, 0}}, // د
|
||||
{14, 0xFEAC, -1, 0, -1, {1, 0}}, // ذ
|
||||
{15, 0xFEAE, -1, 0, -1, {1, 0}}, // ر
|
||||
{16, 0xFEB0, -1, 0, -1, {1, 0}}, // ز
|
||||
{118, 0xFB8B, -1, 0, -1, {1, 0}}, // ژ
|
||||
{17, 0xFEB2, 1, 2, -1, {1, 1}}, // س
|
||||
{18, 0xFEB6, 1, 2, -1, {1, 1}}, // ش
|
||||
{19, 0xFEBA, 1, 2, -1, {1, 1}}, // ص
|
||||
{20, 0xFEBE, 1, 2, -1, {1, 1}}, // ض
|
||||
{21, 0xFEC2, 1, 2, -1, {1, 1}}, // ط
|
||||
{22, 0xFEC6, 1, 2, -1, {1, 1}}, // ظ
|
||||
{23, 0xFECA, 1, 2, -1, {1, 1}}, // ع
|
||||
{24, 0xFECE, 1, 2, -1, {1, 1}}, // غ
|
||||
{31, 0xFED2, 1, 2, -1, {1, 1}}, // ف
|
||||
{32, 0xFED6, 1, 2, -1, {1, 1}}, // ق
|
||||
{135, 0xFB8F, 1, 2, -1, {1, 1}}, // ک
|
||||
{33, 0xFEDA, 1, 2, -1, {1, 1}}, // ﻙ
|
||||
{141, 0xFB93, 1, 2, -1, {1, 1}}, // گ
|
||||
{34, 0xFEDE, 1, 2, -1, {1, 1}}, // ل
|
||||
{35, 0xFEE2, 1, 2, -1, {1, 1}}, // م
|
||||
{36, 0xFEE6, 1, 2, -1, {1, 1}}, // ن
|
||||
{38, 0xFEEE, -1, 0, -1, {1, 0}}, // و
|
||||
{37, 0xFEEA, 1, 2, -1, {1, 1}}, // ه
|
||||
{39, 0xFBFD, 1, 2, -1, {1, 1}}, // ي
|
||||
{40, 0xFEF2, 1, 2, -1, {1, 1}}, // ي
|
||||
{170, 0xFBFD, 1, 2, -1, {1, 1}}, // ی
|
||||
{7, 0xFE94, 1, 2, -1, {1, 0}}, // ة
|
||||
{206, 0x06F0, 1, 2, -1, {0, 0}}, // ۰
|
||||
{207, 0x06F1, 0, 0, 0, {0, 0}}, // ۱
|
||||
{208, 0x06F2, 0, 0, 0, {0, 0}}, // ۲
|
||||
{209, 0x06F3, 0, 0, 0, {0, 0}}, // ۳
|
||||
{210, 0x06F4, 0, 0, 0, {0, 0}}, // ۴
|
||||
{211, 0x06F5, 0, 0, 0, {0, 0}}, // ۵
|
||||
{212, 0x06F6, 0, 0, 0, {0, 0}}, // ۶
|
||||
{213, 0x06F7, 0, 0, 0, {0, 0}}, // ۷
|
||||
{214, 0x06F8, 0, 0, 0, {0, 0}}, // ۸
|
||||
{215, 0x06F9, 0, 0, 0, {0, 0}}, // ۹
|
||||
LV_AP_END_CHARS_LIST
|
||||
};
|
||||
/**********************
|
||||
* MACROS
|
||||
@@ -92,7 +92,8 @@ const ap_chars_map_t ap_chars_map[]={
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
uint32_t lv_txt_ap_calc_bytes_cnt(const char * txt){
|
||||
uint32_t lv_txt_ap_calc_bytes_cnt(const char * txt)
|
||||
{
|
||||
uint32_t txt_length = 0;
|
||||
uint32_t chars_cnt = 0;
|
||||
uint32_t current_ap_idx = 0;
|
||||
@@ -101,33 +102,33 @@ uint32_t lv_txt_ap_calc_bytes_cnt(const char * txt){
|
||||
|
||||
txt_length = lv_txt_get_encoded_length(txt);
|
||||
|
||||
i=0;
|
||||
j=0;
|
||||
while(i<txt_length){
|
||||
ch_enc = lv_txt_encoded_next(txt, &j);
|
||||
current_ap_idx = lv_ap_get_char_index(ch_enc);
|
||||
i = 0;
|
||||
j = 0;
|
||||
while(i < txt_length) {
|
||||
ch_enc = lv_txt_encoded_next(txt, &j);
|
||||
current_ap_idx = lv_ap_get_char_index(ch_enc);
|
||||
|
||||
if(current_ap_idx != LV_UNDEF_ARABIC_PERSIAN_CHARS)
|
||||
ch_enc = ap_chars_map[current_ap_idx].char_end_form;
|
||||
|
||||
if(ch_enc <=0x7F)
|
||||
chars_cnt++;
|
||||
else if(ch_enc <=0x7FFF)
|
||||
chars_cnt+=2;
|
||||
else
|
||||
chars_cnt+=3;
|
||||
if(ch_enc <= 0x7F)
|
||||
chars_cnt++;
|
||||
else if(ch_enc <= 0x7FFF)
|
||||
chars_cnt += 2;
|
||||
else
|
||||
chars_cnt += 3;
|
||||
|
||||
i++;
|
||||
i++;
|
||||
}
|
||||
|
||||
return chars_cnt + 1;
|
||||
}
|
||||
|
||||
|
||||
void lv_txt_ap_proc(const char * txt,char * txt_out)
|
||||
void lv_txt_ap_proc(const char * txt, char * txt_out)
|
||||
{
|
||||
uint32_t txt_length=0;
|
||||
uint32_t index_current,idx_next,idx_previous,i,j;
|
||||
uint32_t txt_length = 0;
|
||||
uint32_t index_current, idx_next, idx_previous, i, j;
|
||||
uint32_t * ch_enc;
|
||||
char * txt_out_temp;
|
||||
|
||||
@@ -135,68 +136,72 @@ void lv_txt_ap_proc(const char * txt,char * txt_out)
|
||||
|
||||
ch_enc = (uint32_t *)lv_mem_alloc(sizeof(uint32_t) * (txt_length + 1));
|
||||
|
||||
i=0;
|
||||
j=0;
|
||||
while(j<txt_length)
|
||||
ch_enc[j++] = lv_txt_encoded_next(txt, &i);
|
||||
i = 0;
|
||||
j = 0;
|
||||
while(j < txt_length)
|
||||
ch_enc[j++] = lv_txt_encoded_next(txt, &i);
|
||||
|
||||
ch_enc[j] = 0;
|
||||
|
||||
i=0;
|
||||
i = 0;
|
||||
idx_previous = LV_UNDEF_ARABIC_PERSIAN_CHARS;
|
||||
while(i<txt_length){
|
||||
while(i < txt_length) {
|
||||
index_current = lv_ap_get_char_index(ch_enc[i]);
|
||||
idx_next = lv_ap_get_char_index(ch_enc[i+1]);
|
||||
idx_next = lv_ap_get_char_index(ch_enc[i + 1]);
|
||||
|
||||
if(index_current == LV_UNDEF_ARABIC_PERSIAN_CHARS)
|
||||
{
|
||||
i++;
|
||||
idx_previous = LV_UNDEF_ARABIC_PERSIAN_CHARS;
|
||||
continue;
|
||||
if(index_current == LV_UNDEF_ARABIC_PERSIAN_CHARS) {
|
||||
i++;
|
||||
idx_previous = LV_UNDEF_ARABIC_PERSIAN_CHARS;
|
||||
continue;
|
||||
}
|
||||
|
||||
uint8_t conjunction_to_previuse = (i==0 || idx_previous == LV_UNDEF_ARABIC_PERSIAN_CHARS) ? 0 : ap_chars_map[idx_previous].ap_chars_conjunction.conj_to_next;
|
||||
uint8_t conjunction_to_next = ((i==txt_length-1) || idx_next == LV_UNDEF_ARABIC_PERSIAN_CHARS) ? 0 : ap_chars_map[idx_next].ap_chars_conjunction.conj_to_previous;
|
||||
uint8_t conjunction_to_previuse = (i == 0 ||
|
||||
idx_previous == LV_UNDEF_ARABIC_PERSIAN_CHARS) ? 0 : ap_chars_map[idx_previous].ap_chars_conjunction.conj_to_next;
|
||||
uint8_t conjunction_to_next = ((i == txt_length - 1) ||
|
||||
idx_next == LV_UNDEF_ARABIC_PERSIAN_CHARS) ? 0 : ap_chars_map[idx_next].ap_chars_conjunction.conj_to_previous;
|
||||
|
||||
if(conjunction_to_previuse && conjunction_to_next)
|
||||
ch_enc[i] = ap_chars_map[index_current].char_end_form+ap_chars_map[index_current].char_middle_form_offset;
|
||||
ch_enc[i] = ap_chars_map[index_current].char_end_form + ap_chars_map[index_current].char_middle_form_offset;
|
||||
else if(!conjunction_to_previuse && conjunction_to_next)
|
||||
ch_enc[i] = ap_chars_map[index_current].char_end_form+ap_chars_map[index_current].char_begining_form_offset;
|
||||
ch_enc[i] = ap_chars_map[index_current].char_end_form + ap_chars_map[index_current].char_begining_form_offset;
|
||||
else if(conjunction_to_previuse && !conjunction_to_next)
|
||||
ch_enc[i] = ap_chars_map[index_current].char_end_form;
|
||||
ch_enc[i] = ap_chars_map[index_current].char_end_form;
|
||||
else
|
||||
ch_enc[i] = ap_chars_map[index_current].char_end_form+ap_chars_map[index_current].char_isolated_form_offset;
|
||||
ch_enc[i] = ap_chars_map[index_current].char_end_form + ap_chars_map[index_current].char_isolated_form_offset;
|
||||
idx_previous = index_current;
|
||||
i++;
|
||||
}
|
||||
|
||||
txt_out_temp = txt_out;
|
||||
i=0;
|
||||
i = 0;
|
||||
|
||||
while(i<txt_length){
|
||||
if((ch_enc[i]) <=0x7F){
|
||||
*(txt_out_temp++) = ch_enc[i];
|
||||
}else if(ch_enc[i] <=0x7FFF){
|
||||
*(txt_out_temp++) = 0xC0 | ((ch_enc[i]>>6) & 0x3F);
|
||||
*(txt_out_temp++) = 0x80 | (ch_enc[i] & 0x3F);
|
||||
}else {
|
||||
*(txt_out_temp++) = 0xE0 | ((ch_enc[i]>>12) & 0x3F);
|
||||
*(txt_out_temp++) = 0x80 | ((ch_enc[i]>>6) & 0x3F);
|
||||
*(txt_out_temp++) = 0x80 | (ch_enc[i] & 0x3F);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
*(txt_out_temp) = '\0';
|
||||
lv_mem_free(ch_enc);
|
||||
while(i < txt_length) {
|
||||
if((ch_enc[i]) <= 0x7F) {
|
||||
*(txt_out_temp++) = ch_enc[i];
|
||||
}
|
||||
else if(ch_enc[i] <= 0x7FFF) {
|
||||
*(txt_out_temp++) = 0xC0 | ((ch_enc[i] >> 6) & 0x3F);
|
||||
*(txt_out_temp++) = 0x80 | (ch_enc[i] & 0x3F);
|
||||
}
|
||||
else {
|
||||
*(txt_out_temp++) = 0xE0 | ((ch_enc[i] >> 12) & 0x3F);
|
||||
*(txt_out_temp++) = 0x80 | ((ch_enc[i] >> 6) & 0x3F);
|
||||
*(txt_out_temp++) = 0x80 | (ch_enc[i] & 0x3F);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
*(txt_out_temp) = '\0';
|
||||
lv_mem_free(ch_enc);
|
||||
}
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static uint32_t lv_ap_get_char_index(uint16_t c){
|
||||
for(uint8_t i=0;ap_chars_map[i].char_end_form;i++){
|
||||
static uint32_t lv_ap_get_char_index(uint16_t c)
|
||||
{
|
||||
for(uint8_t i = 0; ap_chars_map[i].char_end_form; i++) {
|
||||
if(c == (ap_chars_map[i].char_offset + LV_AP_ALPHABET_BASE_CODE))
|
||||
return i;
|
||||
return i;
|
||||
}
|
||||
return LV_UNDEF_ARABIC_PERSIAN_CHARS;
|
||||
}
|
||||
|
||||
@@ -24,21 +24,19 @@ extern "C" {
|
||||
|
||||
#define LV_UNDEF_ARABIC_PERSIAN_CHARS (UINT32_MAX)
|
||||
#define LV_AP_ALPHABET_BASE_CODE 0x0622
|
||||
#define LV_AP_END_CHARS_LIST {0,0,0,0,0,{0,0}}
|
||||
#define LV_AP_END_CHARS_LIST {0,0,0,0,0,{0,0}}
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
uint8_t char_offset;
|
||||
uint16_t char_end_form;
|
||||
int8_t char_begining_form_offset;
|
||||
int8_t char_middle_form_offset;
|
||||
int8_t char_isolated_form_offset;
|
||||
struct
|
||||
{
|
||||
uint8_t conj_to_previous;
|
||||
uint8_t conj_to_next;
|
||||
struct {
|
||||
uint8_t conj_to_previous;
|
||||
uint8_t conj_to_next;
|
||||
} ap_chars_conjunction;
|
||||
} ap_chars_map_t;
|
||||
|
||||
@@ -46,7 +44,7 @@ typedef struct
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
uint32_t lv_txt_ap_calc_bytes_cnt(const char * txt);
|
||||
void lv_txt_ap_proc(const char * txt,char * txt_out);
|
||||
void lv_txt_ap_proc(const char * txt, char * txt_out);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -19,7 +19,7 @@ extern "C" {
|
||||
*********************/
|
||||
|
||||
#if __STDC_VERSION__ >= 199901L // If c99 or newer, use stdint.h to determine arch size
|
||||
#include <stdint.h>
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ extern "C" {
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
@@ -53,8 +53,8 @@ typedef uint8_t lv_res_t;
|
||||
|
||||
|
||||
|
||||
#if __STDC_VERSION__ >= 199901L
|
||||
// If c99 or newer, use the definition of uintptr_t directly from <stdint.h>
|
||||
#if __STDC_VERSION__ >= 199901L
|
||||
// If c99 or newer, use the definition of uintptr_t directly from <stdint.h>
|
||||
typedef uintptr_t lv_uintptr_t;
|
||||
|
||||
#else
|
||||
|
||||
@@ -85,7 +85,7 @@ char * lv_utils_num_to_str(int32_t num, char * buf)
|
||||
*/
|
||||
char * lv_utils_num_to_str_fixed(int32_t num, int32_t decimals, char * buf, size_t bufsize)
|
||||
{
|
||||
lv_snprintf(buf, bufsize, "%0*d", decimals+1, num);
|
||||
lv_snprintf(buf, bufsize, "%0*d", decimals + 1, num);
|
||||
if(decimals > 0)
|
||||
lv_txt_ins(buf, strlen(buf) - decimals, decimal_separator);
|
||||
return buf;
|
||||
|
||||
@@ -57,7 +57,8 @@ static lv_style_t opa_cover;
|
||||
* @return a pointer to reference this theme later
|
||||
*/
|
||||
lv_theme_t * lv_theme_empty_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags,
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, const lv_font_t * font_title)
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
|
||||
const lv_font_t * font_title)
|
||||
{
|
||||
lv_style_init(&opa_cover);
|
||||
lv_style_set_bg_opa(&opa_cover, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
|
||||
@@ -42,7 +42,8 @@ extern "C" {
|
||||
* @return a pointer to reference this theme later
|
||||
*/
|
||||
lv_theme_t * lv_theme_empty_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags,
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, const lv_font_t * font_title);
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
|
||||
const lv_font_t * font_title);
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -146,9 +146,9 @@ static lv_style_t pad_small;
|
||||
|
||||
#if LV_USE_PAGE
|
||||
static lv_style_t sb;
|
||||
#if LV_USE_ANIMATION
|
||||
static lv_style_t edge_flash;
|
||||
#endif
|
||||
#if LV_USE_ANIMATION
|
||||
static lv_style_t edge_flash;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if LV_USE_ROLLER
|
||||
@@ -236,7 +236,8 @@ static void basic_init(void)
|
||||
lv_style_set_bg_color(&bg_click, LV_STATE_PRESSED | LV_STATE_CHECKED, COLOR_BG_PR_CHK);
|
||||
lv_style_set_bg_color(&bg_click, LV_STATE_DISABLED, COLOR_BG_DIS);
|
||||
lv_style_set_border_width(&bg_click, LV_STATE_CHECKED, 0);
|
||||
lv_style_set_border_color(&bg_click, LV_STATE_FOCUSED | LV_STATE_PRESSED, lv_color_darken(theme.color_primary, LV_OPA_20));
|
||||
lv_style_set_border_color(&bg_click, LV_STATE_FOCUSED | LV_STATE_PRESSED, lv_color_darken(theme.color_primary,
|
||||
LV_OPA_20));
|
||||
lv_style_set_border_color(&bg_click, LV_STATE_PRESSED, COLOR_BG_BORDER_PR);
|
||||
lv_style_set_border_color(&bg_click, LV_STATE_CHECKED, COLOR_BG_BORDER_CHK);
|
||||
lv_style_set_border_color(&bg_click, LV_STATE_PRESSED | LV_STATE_CHECKED, COLOR_BG_BORDER_CHK_PR);
|
||||
@@ -577,7 +578,7 @@ static void cpicker_init(void)
|
||||
lv_style_set_border_color(&cpicker_indic, LV_STATE_DEFAULT, LV_COLOR_GRAY);
|
||||
lv_style_set_border_color(&cpicker_indic, LV_STATE_FOCUSED, theme.color_primary);
|
||||
lv_style_set_border_color(&cpicker_indic, LV_STATE_EDITED, theme.color_secondary);
|
||||
lv_style_set_pad_left(&cpicker_indic, LV_STATE_DEFAULT,LV_DPX(13));
|
||||
lv_style_set_pad_left(&cpicker_indic, LV_STATE_DEFAULT, LV_DPX(13));
|
||||
lv_style_set_pad_right(&cpicker_indic, LV_STATE_DEFAULT, LV_DPX(13));
|
||||
lv_style_set_pad_top(&cpicker_indic, LV_STATE_DEFAULT, LV_DPX(13));
|
||||
lv_style_set_pad_bottom(&cpicker_indic, LV_STATE_DEFAULT, LV_DPX(13));
|
||||
@@ -643,7 +644,7 @@ static void page_init(void)
|
||||
#if LV_USE_PAGE
|
||||
style_init_reset(&sb);
|
||||
lv_style_set_bg_opa(&sb, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
lv_style_set_bg_color(&sb, LV_STATE_DEFAULT, (IS_LIGHT ? lv_color_hex(0xcccfd1) : lv_color_hex(0x777f85)));
|
||||
lv_style_set_bg_color(&sb, LV_STATE_DEFAULT, (IS_LIGHT ? lv_color_hex(0xcccfd1) : lv_color_hex(0x777f85)));
|
||||
lv_style_set_radius(&sb, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
|
||||
lv_style_set_size(&sb, LV_STATE_DEFAULT, LV_DPX(7));
|
||||
lv_style_set_pad_right(&sb, LV_STATE_DEFAULT, LV_DPX(7));
|
||||
@@ -850,11 +851,12 @@ static void win_init(void)
|
||||
* @return a pointer to reference this theme later
|
||||
*/
|
||||
lv_theme_t * lv_theme_material_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags,
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, const lv_font_t * font_title)
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
|
||||
const lv_font_t * font_title)
|
||||
{
|
||||
|
||||
theme.color_primary = color_primary;
|
||||
theme.color_secondary= color_secondary;
|
||||
theme.color_secondary = color_secondary;
|
||||
theme.font_small = font_small;
|
||||
theme.font_normal = font_normal;
|
||||
theme.font_subtitle = font_subtitle;
|
||||
|
||||
@@ -24,7 +24,7 @@ typedef enum {
|
||||
LV_THEME_MATERIAL_FLAG_DARK = 0x01,
|
||||
LV_THEME_MATERIAL_FLAG_LIGHT = 0x02,
|
||||
LV_THEME_MATERIAL_FLAG_NO_TRANSITION = 0x10,
|
||||
}lv_theme_material_flag_t;
|
||||
} lv_theme_material_flag_t;
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@@ -46,7 +46,8 @@ typedef enum {
|
||||
* @return a pointer to reference this theme later
|
||||
*/
|
||||
lv_theme_t * lv_theme_material_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags,
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, const lv_font_t * font_title);
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
|
||||
const lv_font_t * font_title);
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -45,43 +45,43 @@ static lv_style_t style_pad_small;
|
||||
static lv_style_t style_pad_inner;
|
||||
|
||||
#if LV_USE_ARC
|
||||
static lv_style_t style_arc_bg, style_arc_indic;
|
||||
static lv_style_t style_arc_bg, style_arc_indic;
|
||||
#endif
|
||||
|
||||
#if LV_USE_LIST
|
||||
static lv_style_t style_list_btn;
|
||||
static lv_style_t style_list_btn;
|
||||
#endif
|
||||
|
||||
#if LV_USE_CALENDAR
|
||||
static lv_style_t style_calendar_date;
|
||||
static lv_style_t style_calendar_date;
|
||||
#endif
|
||||
|
||||
#if LV_USE_CHART
|
||||
static lv_style_t style_chart_series;
|
||||
static lv_style_t style_chart_series;
|
||||
#endif
|
||||
|
||||
#if LV_USE_LINEMETER
|
||||
static lv_style_t style_linemeter;
|
||||
static lv_style_t style_linemeter;
|
||||
#endif
|
||||
|
||||
#if LV_USE_GAUGE
|
||||
static lv_style_t style_gauge_needle, style_gauge_major;
|
||||
static lv_style_t style_gauge_needle, style_gauge_major;
|
||||
#endif
|
||||
|
||||
#if LV_USE_PAGE
|
||||
static lv_style_t style_sb;
|
||||
static lv_style_t style_sb;
|
||||
#endif
|
||||
|
||||
#if LV_USE_SPINNER
|
||||
static lv_style_t style_tick_line;
|
||||
static lv_style_t style_tick_line;
|
||||
#endif
|
||||
|
||||
#if LV_USE_TEXTAREA
|
||||
static lv_style_t style_ta_cursor;
|
||||
static lv_style_t style_ta_cursor;
|
||||
#endif
|
||||
|
||||
#if LV_USE_TABVIEW
|
||||
static lv_style_t style_tab_bg;
|
||||
static lv_style_t style_tab_bg;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -113,8 +113,8 @@ static void basic_init(void)
|
||||
lv_style_set_bg_color(&style_bg, LV_STATE_DEFAULT, BG_COLOR);
|
||||
lv_style_set_border_width(&style_bg, LV_STATE_DEFAULT, BORDER_WIDTH);
|
||||
lv_style_set_border_color(&style_bg, LV_STATE_DEFAULT, FG_COLOR);
|
||||
lv_style_set_line_width(&style_bg, LV_STATE_DEFAULT, LV_MATH_MAX(LV_DPI / 100 , 1));
|
||||
lv_style_set_scale_end_line_width(&style_bg, LV_STATE_DEFAULT, LV_MATH_MAX(LV_DPI / 100 , 1));
|
||||
lv_style_set_line_width(&style_bg, LV_STATE_DEFAULT, LV_MATH_MAX(LV_DPI / 100, 1));
|
||||
lv_style_set_scale_end_line_width(&style_bg, LV_STATE_DEFAULT, LV_MATH_MAX(LV_DPI / 100, 1));
|
||||
lv_style_set_line_color(&style_bg, LV_STATE_DEFAULT, FG_COLOR);
|
||||
lv_style_set_scale_grad_color(&style_bg, LV_STATE_DEFAULT, FG_COLOR);
|
||||
lv_style_set_scale_end_color(&style_bg, LV_STATE_DEFAULT, FG_COLOR);
|
||||
@@ -165,7 +165,7 @@ static void basic_init(void)
|
||||
lv_style_set_line_color(&style_fg_color, LV_STATE_DEFAULT, FG_COLOR);
|
||||
|
||||
lv_style_init(&style_big_line_space);
|
||||
lv_style_set_text_line_space(&style_big_line_space, LV_STATE_DEFAULT, LV_DPI/10);
|
||||
lv_style_set_text_line_space(&style_big_line_space, LV_STATE_DEFAULT, LV_DPI / 10);
|
||||
|
||||
lv_style_init(&style_pad_none);
|
||||
lv_style_set_pad_left(&style_pad_none, LV_STATE_DEFAULT, 0);
|
||||
@@ -236,7 +236,8 @@ static void calendar_init(void)
|
||||
lv_style_set_value_font(&style_calendar_date, LV_STATE_CHECKED, LV_THEME_DEFAULT_FONT_TITLE);
|
||||
lv_style_set_value_align(&style_calendar_date, LV_STATE_CHECKED, LV_ALIGN_IN_TOP_RIGHT);
|
||||
lv_style_set_value_color(&style_calendar_date, LV_STATE_CHECKED, FG_COLOR);
|
||||
lv_style_set_value_ofs_y(&style_calendar_date, LV_STATE_CHECKED, - lv_font_get_line_height(LV_THEME_DEFAULT_FONT_TITLE) / 4);
|
||||
lv_style_set_value_ofs_y(&style_calendar_date, LV_STATE_CHECKED,
|
||||
- lv_font_get_line_height(LV_THEME_DEFAULT_FONT_TITLE) / 4);
|
||||
lv_style_set_bg_color(&style_calendar_date, LV_STATE_CHECKED, BG_COLOR);
|
||||
lv_style_set_text_color(&style_calendar_date, LV_STATE_CHECKED, FG_COLOR);
|
||||
lv_style_set_value_color(&style_calendar_date, LV_STATE_CHECKED | LV_STATE_PRESSED, BG_COLOR);
|
||||
@@ -404,7 +405,7 @@ static void textarea_init(void)
|
||||
#if LV_USE_TEXTAREA
|
||||
lv_style_init(&style_ta_cursor);
|
||||
lv_style_set_bg_opa(&style_ta_cursor, LV_STATE_DEFAULT, LV_OPA_TRANSP);
|
||||
lv_style_set_border_width(&style_ta_cursor, LV_STATE_DEFAULT, LV_MATH_MAX(LV_DPI/100, 1));
|
||||
lv_style_set_border_width(&style_ta_cursor, LV_STATE_DEFAULT, LV_MATH_MAX(LV_DPI / 100, 1));
|
||||
lv_style_set_border_side(&style_ta_cursor, LV_STATE_DEFAULT, LV_BORDER_SIDE_LEFT);
|
||||
lv_style_set_border_color(&style_ta_cursor, LV_STATE_DEFAULT, FG_COLOR);
|
||||
|
||||
@@ -485,7 +486,8 @@ static void win_init(void)
|
||||
* @return a pointer to reference this theme later
|
||||
*/
|
||||
lv_theme_t * lv_theme_mono_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags,
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, const lv_font_t * font_title)
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
|
||||
const lv_font_t * font_title)
|
||||
{
|
||||
theme.color_primary = color_primary;
|
||||
theme.color_secondary = color_secondary;
|
||||
|
||||
@@ -42,7 +42,8 @@ extern "C" {
|
||||
* @return a pointer to reference this theme later
|
||||
*/
|
||||
lv_theme_t * lv_theme_mono_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags,
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, const lv_font_t * font_title);
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
|
||||
const lv_font_t * font_title);
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -334,7 +334,8 @@ static void win_init(void)
|
||||
* @return a pointer to reference this theme later
|
||||
*/
|
||||
lv_theme_t * lv_theme_template_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags,
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, const lv_font_t * font_title)
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
|
||||
const lv_font_t * font_title)
|
||||
{
|
||||
theme.color_primary = color_primary;
|
||||
theme.color_secondary = color_secondary;
|
||||
|
||||
@@ -42,7 +42,8 @@ extern "C" {
|
||||
* @return a pointer to reference this theme later
|
||||
*/
|
||||
lv_theme_t * lv_theme_template_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags,
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, const lv_font_t * font_title);
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
|
||||
const lv_font_t * font_title);
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -164,7 +164,7 @@ void lv_arc_set_end_angle(lv_obj_t * arc, uint16_t end)
|
||||
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
|
||||
|
||||
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
|
||||
|
||||
|
||||
if(end > (ext->arc_angle_start + 360)) end = ext->arc_angle_start + 360;
|
||||
|
||||
/*Too large move, the whole arc need to be invalidated anyway*/
|
||||
@@ -254,7 +254,7 @@ void lv_arc_set_bg_end_angle(lv_obj_t * arc, uint16_t end)
|
||||
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
|
||||
|
||||
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
|
||||
|
||||
|
||||
if(end > (ext->bg_angle_start + 360)) end = ext->bg_angle_start + 360;
|
||||
|
||||
/*Too large move, the whole arc need to be invalidated anyway*/
|
||||
@@ -288,7 +288,7 @@ void lv_arc_set_bg_angles(lv_obj_t * arc, uint16_t start, uint16_t end)
|
||||
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
|
||||
|
||||
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
|
||||
|
||||
|
||||
if(start > 360) start -= 360;
|
||||
if(end > (start + 360)) end = start + 360;
|
||||
|
||||
@@ -427,7 +427,8 @@ static lv_design_res_t lv_arc_design(lv_obj_t * arc, const lv_area_t * clip_area
|
||||
lv_draw_line_dsc_init(&arc_dsc);
|
||||
lv_obj_init_draw_line_dsc(arc, LV_ARC_PART_BG, &arc_dsc);
|
||||
|
||||
lv_draw_arc(x, y, r, ext->bg_angle_start + ext->rotation_angle, ext->bg_angle_end + ext->rotation_angle, clip_area, &arc_dsc);
|
||||
lv_draw_arc(x, y, r, ext->bg_angle_start + ext->rotation_angle, ext->bg_angle_end + ext->rotation_angle, clip_area,
|
||||
&arc_dsc);
|
||||
|
||||
lv_draw_line_dsc_init(&arc_dsc);
|
||||
lv_obj_init_draw_line_dsc(arc, LV_ARC_PART_INDIC, &arc_dsc);
|
||||
@@ -439,7 +440,8 @@ static lv_design_res_t lv_arc_design(lv_obj_t * arc, const lv_area_t * clip_area
|
||||
lv_coord_t bottom_indic = lv_obj_get_style_pad_bottom(arc, LV_ARC_PART_INDIC);
|
||||
r -= LV_MATH_MAX4(left_indic, right_indic, top_indic, bottom_indic);
|
||||
|
||||
lv_draw_arc(x, y, r, ext->arc_angle_start + ext->rotation_angle, ext->arc_angle_end + ext->rotation_angle, clip_area, &arc_dsc);
|
||||
lv_draw_arc(x, y, r, ext->arc_angle_start + ext->rotation_angle, ext->arc_angle_end + ext->rotation_angle, clip_area,
|
||||
&arc_dsc);
|
||||
}
|
||||
/*Post draw when the children are drawn*/
|
||||
else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
@@ -512,7 +514,7 @@ static void inv_arc_area(lv_obj_t * arc, uint16_t start_angle, uint16_t end_angl
|
||||
|
||||
start_angle += ext->rotation_angle;
|
||||
end_angle += ext->rotation_angle;
|
||||
|
||||
|
||||
if(start_angle >= 360) start_angle -= 360;
|
||||
if(end_angle >= 360) end_angle -= 360;
|
||||
|
||||
|
||||
@@ -652,24 +652,23 @@ void lv_canvas_fill_bg(lv_obj_t * canvas, lv_color_t color, lv_opa_t opa)
|
||||
lv_img_dsc_t * dsc = lv_canvas_get_img(canvas);
|
||||
|
||||
if(dsc->header.cf == LV_IMG_CF_INDEXED_1BIT) {
|
||||
uint32_t row_byte_cnt = (dsc->header.w + 7) >> 3;
|
||||
/*+8 skip the palette*/
|
||||
lv_memset((uint8_t*)dsc->data + 8, color.full ? 0xff : 0x00, row_byte_cnt * dsc->header.h);
|
||||
uint32_t row_byte_cnt = (dsc->header.w + 7) >> 3;
|
||||
/*+8 skip the palette*/
|
||||
lv_memset((uint8_t *)dsc->data + 8, color.full ? 0xff : 0x00, row_byte_cnt * dsc->header.h);
|
||||
}
|
||||
else if(dsc->header.cf == LV_IMG_CF_ALPHA_1BIT) {
|
||||
uint32_t row_byte_cnt = (dsc->header.w + 7) >> 3;
|
||||
lv_memset((uint8_t*)dsc->data, opa > LV_OPA_50 ? 0xff : 0x00, row_byte_cnt * dsc->header.h);
|
||||
uint32_t row_byte_cnt = (dsc->header.w + 7) >> 3;
|
||||
lv_memset((uint8_t *)dsc->data, opa > LV_OPA_50 ? 0xff : 0x00, row_byte_cnt * dsc->header.h);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
for(y = 0; y < dsc->header.h; y++) {
|
||||
for(x = 0; x < dsc->header.w; x++) {
|
||||
lv_img_buf_set_px_color(dsc, x, y, color);
|
||||
lv_img_buf_set_px_alpha(dsc, x, y, opa);
|
||||
}
|
||||
}
|
||||
else {
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
for(y = 0; y < dsc->header.h; y++) {
|
||||
for(x = 0; x < dsc->header.w; x++) {
|
||||
lv_img_buf_set_px_color(dsc, x, y, color);
|
||||
lv_img_buf_set_px_alpha(dsc, x, y, opa);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lv_obj_invalidate(canvas);
|
||||
|
||||
@@ -558,8 +558,8 @@ static void lv_cont_layout_pretty(lv_obj_t * cont)
|
||||
/*If there is only one object in the row then align it to the middle*/
|
||||
else if(obj_num == 1) {
|
||||
lv_obj_align(child_rs, cont, LV_ALIGN_IN_TOP_MID,
|
||||
0,
|
||||
act_y + lv_obj_get_style_margin_top(child_rs, LV_OBJ_PART_MAIN));
|
||||
0,
|
||||
act_y + lv_obj_get_style_margin_top(child_rs, LV_OBJ_PART_MAIN));
|
||||
}
|
||||
/*If there are two object in the row then align them proportionally*/
|
||||
else if(obj_num == 2 && 0) {
|
||||
@@ -571,27 +571,27 @@ static void lv_cont_layout_pretty(lv_obj_t * cont)
|
||||
switch(type) {
|
||||
case LV_LAYOUT_PRETTY_TOP:
|
||||
lv_obj_align(obj1, cont, LV_ALIGN_IN_TOP_LEFT,
|
||||
pad + lv_obj_get_style_margin_left(obj1, LV_OBJ_PART_MAIN),
|
||||
act_y + lv_obj_get_style_margin_top(obj1, LV_OBJ_PART_MAIN));
|
||||
pad + lv_obj_get_style_margin_left(obj1, LV_OBJ_PART_MAIN),
|
||||
act_y + lv_obj_get_style_margin_top(obj1, LV_OBJ_PART_MAIN));
|
||||
lv_obj_align(obj2, cont, LV_ALIGN_IN_TOP_RIGHT,
|
||||
-pad - lv_obj_get_style_margin_right(obj2, LV_OBJ_PART_MAIN),
|
||||
act_y + lv_obj_get_style_margin_top(obj2, LV_OBJ_PART_MAIN));
|
||||
-pad - lv_obj_get_style_margin_right(obj2, LV_OBJ_PART_MAIN),
|
||||
act_y + lv_obj_get_style_margin_top(obj2, LV_OBJ_PART_MAIN));
|
||||
break;
|
||||
case LV_LAYOUT_PRETTY_MID:
|
||||
lv_obj_align(obj1, cont, LV_ALIGN_IN_TOP_LEFT,
|
||||
pad + lv_obj_get_style_margin_left(obj1, LV_OBJ_PART_MAIN),
|
||||
act_y + (h_row - lv_obj_get_height(obj1)) / 2 + lv_obj_get_style_margin_top(obj1, LV_OBJ_PART_MAIN));
|
||||
pad + lv_obj_get_style_margin_left(obj1, LV_OBJ_PART_MAIN),
|
||||
act_y + (h_row - lv_obj_get_height(obj1)) / 2 + lv_obj_get_style_margin_top(obj1, LV_OBJ_PART_MAIN));
|
||||
lv_obj_align(obj2, cont, LV_ALIGN_IN_TOP_RIGHT,
|
||||
-pad - lv_obj_get_style_margin_right(obj2, LV_OBJ_PART_MAIN),
|
||||
act_y + (h_row - lv_obj_get_height(obj2)) / 2 + lv_obj_get_style_margin_top(obj2, LV_OBJ_PART_MAIN));
|
||||
-pad - lv_obj_get_style_margin_right(obj2, LV_OBJ_PART_MAIN),
|
||||
act_y + (h_row - lv_obj_get_height(obj2)) / 2 + lv_obj_get_style_margin_top(obj2, LV_OBJ_PART_MAIN));
|
||||
break;
|
||||
case LV_LAYOUT_PRETTY_BOTTOM:
|
||||
lv_obj_align(obj1, cont, LV_ALIGN_IN_TOP_LEFT,
|
||||
pad + lv_obj_get_style_margin_left(obj1, LV_OBJ_PART_MAIN),
|
||||
act_y + h_row - lv_obj_get_height(obj1) - lv_obj_get_style_margin_bottom(obj1, LV_OBJ_PART_MAIN));
|
||||
pad + lv_obj_get_style_margin_left(obj1, LV_OBJ_PART_MAIN),
|
||||
act_y + h_row - lv_obj_get_height(obj1) - lv_obj_get_style_margin_bottom(obj1, LV_OBJ_PART_MAIN));
|
||||
lv_obj_align(obj2, cont, LV_ALIGN_IN_TOP_RIGHT,
|
||||
-pad - lv_obj_get_style_margin_right(obj2, LV_OBJ_PART_MAIN),
|
||||
act_y + h_row - lv_obj_get_height(obj2) - lv_obj_get_style_margin_bottom(obj2, LV_OBJ_PART_MAIN));
|
||||
-pad - lv_obj_get_style_margin_right(obj2, LV_OBJ_PART_MAIN),
|
||||
act_y + h_row - lv_obj_get_height(obj2) - lv_obj_get_style_margin_bottom(obj2, LV_OBJ_PART_MAIN));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -718,8 +718,7 @@ static void lv_cont_refr_autofit(lv_obj_t * cont)
|
||||
LV_LL_READ(cont->child_ll, child_i) {
|
||||
if(lv_obj_get_hidden(child_i) != false) continue;
|
||||
|
||||
if(ext->fit_left != LV_FIT_PARENT)
|
||||
{
|
||||
if(ext->fit_left != LV_FIT_PARENT) {
|
||||
lv_style_int_t mleft = lv_obj_get_style_margin_left(child_i, LV_OBJ_PART_MAIN);
|
||||
tight_area.x1 = LV_MATH_MIN(tight_area.x1, child_i->coords.x1 - mleft);
|
||||
}
|
||||
|
||||
@@ -576,7 +576,7 @@ static void draw_rect_grad(lv_obj_t * cpicker, const lv_area_t * mask)
|
||||
|
||||
/*scale angle (hue/sat/val) to linear coordinate*/
|
||||
lv_coord_t xi = (i * grad_w) / 360;
|
||||
lv_coord_t xi2 = ((i+i_step) * grad_w) / 360;
|
||||
lv_coord_t xi2 = ((i + i_step) * grad_w) / 360;
|
||||
|
||||
rect_area.x1 = LV_MATH_MIN(grad_area.x1 + xi, grad_area.x1 + grad_w - i_step);
|
||||
rect_area.y1 = grad_area.y1;
|
||||
|
||||
@@ -631,7 +631,8 @@ void lv_dropdown_open(lv_obj_t * ddlist)
|
||||
/*There is more space on the top, so make it drop up*/
|
||||
dir = LV_DROPDOWN_DIR_UP;
|
||||
list_h = ddlist->coords.y1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
list_h = LV_VER_RES - ddlist->coords.y2;
|
||||
}
|
||||
}
|
||||
@@ -643,7 +644,8 @@ void lv_dropdown_open(lv_obj_t * ddlist)
|
||||
/*There is more space on the top, so make it drop up*/
|
||||
dir = LV_DROPDOWN_DIR_DOWN;
|
||||
list_h = LV_VER_RES - ddlist->coords.y2;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
list_h = ddlist->coords.y1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,53 +197,54 @@ void lv_gauge_set_value(lv_obj_t * gauge, uint8_t needle_id, int32_t value)
|
||||
int32_t old_value = ext->values[needle_id];
|
||||
ext->values[needle_id] = value;
|
||||
|
||||
// lv_obj_invalidate(gauge);
|
||||
// lv_obj_invalidate(gauge);
|
||||
|
||||
lv_style_int_t pad = lv_obj_get_style_pad_inner(gauge, LV_GAUGE_PART_NEEDLE);
|
||||
lv_style_int_t left = lv_obj_get_style_pad_left(gauge, LV_GAUGE_PART_MAIN);
|
||||
lv_style_int_t right = lv_obj_get_style_pad_right(gauge, LV_GAUGE_PART_MAIN);
|
||||
lv_style_int_t top = lv_obj_get_style_pad_top(gauge, LV_GAUGE_PART_MAIN);
|
||||
lv_coord_t r = (lv_obj_get_width(gauge) - left - right) / 2 - pad;
|
||||
lv_coord_t x_ofs = gauge->coords.x1 + r + left + pad;
|
||||
lv_coord_t y_ofs = gauge->coords.y1 + r + top + pad;
|
||||
uint16_t angle = lv_linemeter_get_scale_angle(gauge);
|
||||
int16_t angle_ofs = 90 + (360 - angle) / 2;
|
||||
lv_point_t p_mid;
|
||||
lv_point_t p_end;
|
||||
lv_coord_t needle_w;
|
||||
lv_coord_t r = (lv_obj_get_width(gauge) - left - right) / 2 - pad;
|
||||
lv_coord_t x_ofs = gauge->coords.x1 + r + left + pad;
|
||||
lv_coord_t y_ofs = gauge->coords.y1 + r + top + pad;
|
||||
uint16_t angle = lv_linemeter_get_scale_angle(gauge);
|
||||
int16_t angle_ofs = 90 + (360 - angle) / 2;
|
||||
lv_point_t p_mid;
|
||||
lv_point_t p_end;
|
||||
lv_coord_t needle_w;
|
||||
|
||||
if(ext->needle_img) {
|
||||
lv_img_header_t info;
|
||||
lv_img_decoder_get_info(ext->needle_img, &info);
|
||||
needle_w = info.h;
|
||||
} else {
|
||||
needle_w = lv_obj_get_style_line_width(gauge, LV_GAUGE_PART_NEEDLE);
|
||||
}
|
||||
if(ext->needle_img) {
|
||||
lv_img_header_t info;
|
||||
lv_img_decoder_get_info(ext->needle_img, &info);
|
||||
needle_w = info.h;
|
||||
}
|
||||
else {
|
||||
needle_w = lv_obj_get_style_line_width(gauge, LV_GAUGE_PART_NEEDLE);
|
||||
}
|
||||
|
||||
p_mid.x = x_ofs;
|
||||
p_mid.y = y_ofs;
|
||||
/*Calculate the end point of a needle*/
|
||||
int16_t needle_angle = (old_value - min) * angle / (max - min) + angle_ofs;
|
||||
p_mid.x = x_ofs;
|
||||
p_mid.y = y_ofs;
|
||||
/*Calculate the end point of a needle*/
|
||||
int16_t needle_angle = (old_value - min) * angle / (max - min) + angle_ofs;
|
||||
|
||||
p_end.y = (lv_trigo_sin(needle_angle) * r) / LV_TRIGO_SIN_MAX + y_ofs;
|
||||
p_end.x = (lv_trigo_sin(needle_angle + 90) * r) / LV_TRIGO_SIN_MAX + x_ofs;
|
||||
p_end.y = (lv_trigo_sin(needle_angle) * r) / LV_TRIGO_SIN_MAX + y_ofs;
|
||||
p_end.x = (lv_trigo_sin(needle_angle + 90) * r) / LV_TRIGO_SIN_MAX + x_ofs;
|
||||
|
||||
lv_area_t a;
|
||||
a.x1 = LV_MATH_MIN(p_mid.x, p_end.x) - needle_w;
|
||||
a.y1 = LV_MATH_MIN(p_mid.y, p_end.y) - needle_w;
|
||||
a.x2 = LV_MATH_MAX(p_mid.x, p_end.x) + needle_w;
|
||||
a.y2 = LV_MATH_MAX(p_mid.y, p_end.y) + needle_w;
|
||||
lv_obj_invalidate_area(gauge, &a);
|
||||
lv_area_t a;
|
||||
a.x1 = LV_MATH_MIN(p_mid.x, p_end.x) - needle_w;
|
||||
a.y1 = LV_MATH_MIN(p_mid.y, p_end.y) - needle_w;
|
||||
a.x2 = LV_MATH_MAX(p_mid.x, p_end.x) + needle_w;
|
||||
a.y2 = LV_MATH_MAX(p_mid.y, p_end.y) + needle_w;
|
||||
lv_obj_invalidate_area(gauge, &a);
|
||||
|
||||
needle_angle = (value - min) * angle / (max - min) + angle_ofs;
|
||||
p_end.y = (lv_trigo_sin(needle_angle) * r) / LV_TRIGO_SIN_MAX + y_ofs;
|
||||
p_end.x = (lv_trigo_sin(needle_angle + 90) * r) / LV_TRIGO_SIN_MAX + x_ofs;
|
||||
needle_angle = (value - min) * angle / (max - min) + angle_ofs;
|
||||
p_end.y = (lv_trigo_sin(needle_angle) * r) / LV_TRIGO_SIN_MAX + y_ofs;
|
||||
p_end.x = (lv_trigo_sin(needle_angle + 90) * r) / LV_TRIGO_SIN_MAX + x_ofs;
|
||||
|
||||
a.x1 = LV_MATH_MIN(p_mid.x, p_end.x);
|
||||
a.y1 = LV_MATH_MIN(p_mid.y, p_end.y);
|
||||
a.x2 = LV_MATH_MAX(p_mid.x, p_end.x);
|
||||
a.y2 = LV_MATH_MAX(p_mid.y, p_end.y);
|
||||
lv_obj_invalidate_area(gauge, &a);
|
||||
a.x1 = LV_MATH_MIN(p_mid.x, p_end.x);
|
||||
a.y1 = LV_MATH_MIN(p_mid.y, p_end.y);
|
||||
a.x2 = LV_MATH_MAX(p_mid.x, p_end.x);
|
||||
a.y2 = LV_MATH_MAX(p_mid.y, p_end.y);
|
||||
lv_obj_invalidate_area(gauge, &a);
|
||||
|
||||
|
||||
}
|
||||
@@ -544,7 +545,7 @@ static void lv_gauge_draw_labels(lv_obj_t * gauge, const lv_area_t * mask)
|
||||
lv_utils_num_to_str(scale_act, scale_txt);
|
||||
else
|
||||
ext->format_cb(gauge, scale_txt, sizeof(scale_txt), scale_act);
|
||||
|
||||
|
||||
lv_area_t label_cord;
|
||||
lv_point_t label_size;
|
||||
lv_txt_get_size(&label_size, scale_txt, label_dsc.font, label_dsc.letter_space, label_dsc.line_space,
|
||||
|
||||
@@ -215,7 +215,7 @@ static lv_design_res_t lv_led_design(lv_obj_t * led, const lv_area_t * clip_area
|
||||
rect_dsc.shadow_width = ((ext->bright - LV_LED_BRIGHT_MIN) * rect_dsc.shadow_width) /
|
||||
(LV_LED_BRIGHT_MAX - LV_LED_BRIGHT_MIN);
|
||||
rect_dsc.shadow_spread = ((ext->bright - LV_LED_BRIGHT_MIN) * rect_dsc.shadow_spread) /
|
||||
(LV_LED_BRIGHT_MAX - LV_LED_BRIGHT_MIN);
|
||||
(LV_LED_BRIGHT_MAX - LV_LED_BRIGHT_MIN);
|
||||
|
||||
lv_draw_rect(&led->coords, clip_area, &rect_dsc);
|
||||
}
|
||||
|
||||
@@ -126,9 +126,9 @@ void lv_linemeter_set_value(lv_obj_t * lmeter, int32_t value)
|
||||
ext->cur_value = ext->cur_value < ext->min_value ? ext->min_value : ext->cur_value;
|
||||
|
||||
int16_t level_old =
|
||||
(int32_t)((int32_t)(old_value - ext->min_value) * ext->line_cnt) / (ext->max_value - ext->min_value);
|
||||
(int32_t)((int32_t)(old_value - ext->min_value) * ext->line_cnt) / (ext->max_value - ext->min_value);
|
||||
int16_t level_new =
|
||||
(int32_t)((int32_t)(ext->cur_value - ext->min_value) * ext->line_cnt) / (ext->max_value - ext->min_value);
|
||||
(int32_t)((int32_t)(ext->cur_value - ext->min_value) * ext->line_cnt) / (ext->max_value - ext->min_value);
|
||||
|
||||
if(level_new == level_old) {
|
||||
return;
|
||||
@@ -274,7 +274,8 @@ void lv_linemeter_set_angle_offset(lv_obj_t * lmeter, uint16_t angle)
|
||||
* @param lmeter pointer to a line meter object
|
||||
* @param mirror mirror setting
|
||||
*/
|
||||
void lv_linemeter_set_mirror(lv_obj_t *lmeter, bool mirror) {
|
||||
void lv_linemeter_set_mirror(lv_obj_t * lmeter, bool mirror)
|
||||
{
|
||||
lv_linemeter_ext_t * ext = lv_obj_get_ext_attr(lmeter);
|
||||
if(ext->mirrored == mirror) return;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ typedef struct {
|
||||
int32_t cur_value;
|
||||
int32_t min_value;
|
||||
int32_t max_value;
|
||||
uint8_t mirrored :1;
|
||||
uint8_t mirrored : 1;
|
||||
} lv_linemeter_ext_t;
|
||||
|
||||
/*Styles*/
|
||||
@@ -99,7 +99,7 @@ void lv_linemeter_set_angle_offset(lv_obj_t * lmeter, uint16_t angle);
|
||||
* @param lmeter pointer to a line meter object
|
||||
* @param mirror mirror setting
|
||||
*/
|
||||
void lv_linemeter_set_mirror(lv_obj_t *lmeter, bool mirror);
|
||||
void lv_linemeter_set_mirror(lv_obj_t * lmeter, bool mirror);
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
|
||||
@@ -105,7 +105,8 @@ lv_obj_t * lv_msgbox_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_coord_t fit_w = lv_obj_get_width_fit(par);
|
||||
if(lv_disp_get_size_category(NULL) <= LV_DISP_SIZE_SMALL) {
|
||||
lv_obj_set_width(mbox, fit_w);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lv_obj_set_width(mbox, LV_MATH_MIN(fit_w, LV_DPX(400)));
|
||||
}
|
||||
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
@@ -165,7 +166,8 @@ void lv_msgbox_add_btns(lv_obj_t * mbox, const char * btn_map[])
|
||||
lv_state_t state = lv_obj_get_state(mbox, LV_MSGBOX_PART_BG);
|
||||
if(state & LV_STATE_EDITED) {
|
||||
lv_obj_set_state(ext->btnm, LV_STATE_FOCUSED | LV_STATE_EDITED);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lv_obj_set_state(ext->btnm, LV_STATE_FOCUSED);
|
||||
}
|
||||
|
||||
@@ -480,13 +482,15 @@ static lv_res_t lv_msgbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param
|
||||
lv_state_t state = lv_obj_get_state(mbox, LV_MSGBOX_PART_BG);
|
||||
if(state & LV_STATE_FOCUSED) {
|
||||
lv_obj_set_state(ext->btnm, LV_STATE_FOCUSED);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lv_obj_clear_state(ext->btnm, LV_STATE_FOCUSED);
|
||||
|
||||
}
|
||||
if(state & LV_STATE_EDITED) {
|
||||
lv_obj_set_state(ext->btnm, LV_STATE_EDITED);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lv_obj_clear_state(ext->btnm, LV_STATE_EDITED);
|
||||
|
||||
}
|
||||
|
||||
@@ -1352,7 +1352,8 @@ static void get_edge_flash_area(lv_obj_t * page, lv_area_t * flash_area, lv_coor
|
||||
flash_area->x2 = page->coords.x1 + state;
|
||||
flash_area->y1 = page->coords.y1 - page_h;
|
||||
flash_area->y2 = page->coords.y2 + page_h;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lv_area_set(flash_area, 0, 0, -1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,8 +187,8 @@ void lv_roller_set_options(lv_obj_t * roller, const char * options, lv_roller_mo
|
||||
ext->sel_opt_id_ori = ext->sel_opt_id;
|
||||
|
||||
|
||||
// refr_width(roller);
|
||||
// refr_height(roller);
|
||||
// refr_width(roller);
|
||||
// refr_height(roller);
|
||||
refr_position(roller, LV_ANIM_OFF);
|
||||
}
|
||||
|
||||
@@ -648,10 +648,10 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign,
|
||||
}
|
||||
else if(sign == LV_SIGNAL_PARENT_SIZE_CHG) {
|
||||
#if LV_USE_ANIMATION
|
||||
lv_anim_del(lv_page_get_scrl(roller), (lv_anim_exec_xcb_t)lv_obj_set_y);
|
||||
lv_anim_del(lv_page_get_scrl(roller), (lv_anim_exec_xcb_t)lv_obj_set_y);
|
||||
#endif
|
||||
refr_position(roller, false);
|
||||
refr_width(roller);
|
||||
refr_position(roller, false);
|
||||
refr_width(roller);
|
||||
|
||||
}
|
||||
|
||||
@@ -838,15 +838,15 @@ static void refr_width(lv_obj_t * roller)
|
||||
if(label == NULL) return;
|
||||
|
||||
switch(lv_label_get_align(label)) {
|
||||
case LV_LABEL_ALIGN_LEFT:
|
||||
lv_obj_align(label, NULL, LV_ALIGN_IN_LEFT_MID, 0, 0);
|
||||
break;
|
||||
case LV_LABEL_ALIGN_CENTER:
|
||||
lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
break;
|
||||
case LV_LABEL_ALIGN_RIGHT:
|
||||
lv_obj_align(label, NULL, LV_ALIGN_IN_RIGHT_MID, 0, 0);
|
||||
break;
|
||||
case LV_LABEL_ALIGN_LEFT:
|
||||
lv_obj_align(label, NULL, LV_ALIGN_IN_LEFT_MID, 0, 0);
|
||||
break;
|
||||
case LV_LABEL_ALIGN_CENTER:
|
||||
lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
break;
|
||||
case LV_LABEL_ALIGN_RIGHT:
|
||||
lv_obj_align(label, NULL, LV_ALIGN_IN_RIGHT_MID, 0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ lv_obj_t * lv_spinbox_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->step = 1;
|
||||
ext->range_max = 99999;
|
||||
ext->range_min = -99999;
|
||||
ext->rollover = false;
|
||||
ext->rollover = false;
|
||||
|
||||
|
||||
/*The signal and design functions are not copied so set them here*/
|
||||
@@ -125,12 +125,13 @@ lv_obj_t * lv_spinbox_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
* @param spinbox pointer to spinbox
|
||||
* @param b true or false to enable or disable (default)
|
||||
*/
|
||||
void lv_spinbox_set_rollover(lv_obj_t * spinbox, bool b) {
|
||||
void lv_spinbox_set_rollover(lv_obj_t * spinbox, bool b)
|
||||
{
|
||||
LV_ASSERT_OBJ(spinbox, LV_OBJX_NAME);
|
||||
|
||||
lv_spinbox_ext_t * ext = lv_obj_get_ext_attr(spinbox);
|
||||
|
||||
ext->rollover = b;
|
||||
ext->rollover = b;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -243,12 +244,13 @@ void lv_spinbox_set_padding_left(lv_obj_t * spinbox, uint8_t padding)
|
||||
* Get spinbox rollover function status
|
||||
* @param spinbox pointer to spinbox
|
||||
*/
|
||||
bool lv_spinbox_get_rollover(lv_obj_t * spinbox) {
|
||||
bool lv_spinbox_get_rollover(lv_obj_t * spinbox)
|
||||
{
|
||||
LV_ASSERT_OBJ(spinbox, LV_OBJX_NAME);
|
||||
|
||||
lv_spinbox_ext_t * ext = lv_obj_get_ext_attr(spinbox);
|
||||
|
||||
return ext->rollover;
|
||||
return ext->rollover;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -320,12 +322,13 @@ void lv_spinbox_increment(lv_obj_t * spinbox)
|
||||
if((ext->value + ext->step) > 0 && ext->value < 0) ext->value = -ext->value;
|
||||
ext->value += ext->step;
|
||||
|
||||
} else {
|
||||
// Rollover?
|
||||
if ((ext->rollover) && (ext->value == ext->range_max))
|
||||
ext->value = ext->range_min;
|
||||
else
|
||||
ext->value = ext->range_max;
|
||||
}
|
||||
else {
|
||||
// Rollover?
|
||||
if((ext->rollover) && (ext->value == ext->range_max))
|
||||
ext->value = ext->range_min;
|
||||
else
|
||||
ext->value = ext->range_max;
|
||||
}
|
||||
|
||||
lv_spinbox_updatevalue(spinbox);
|
||||
@@ -345,12 +348,13 @@ void lv_spinbox_decrement(lv_obj_t * spinbox)
|
||||
/*Special mode when zero crossing*/
|
||||
if((ext->value - ext->step) < 0 && ext->value > 0) ext->value = -ext->value;
|
||||
ext->value -= ext->step;
|
||||
} else {
|
||||
// Rollover?
|
||||
if ((ext->rollover) && (ext->value == ext->range_min))
|
||||
ext->value = ext->range_max;
|
||||
else
|
||||
ext->value = ext->range_min;
|
||||
}
|
||||
else {
|
||||
// Rollover?
|
||||
if((ext->rollover) && (ext->value == ext->range_min))
|
||||
ext->value = ext->range_max;
|
||||
else
|
||||
ext->value = ext->range_min;
|
||||
}
|
||||
|
||||
lv_spinbox_updatevalue(spinbox);
|
||||
|
||||
@@ -42,7 +42,7 @@ typedef struct {
|
||||
int32_t range_max;
|
||||
int32_t range_min;
|
||||
int32_t step;
|
||||
uint8_t rollover : 1; // Set to true for rollover functionality
|
||||
uint8_t rollover : 1; // Set to true for rollover functionality
|
||||
uint16_t digit_count : 4;
|
||||
uint16_t dec_point_pos : 4; /*if 0, there is no separator and the number is an integer*/
|
||||
uint16_t digit_padding_left : 4;
|
||||
|
||||
@@ -795,7 +795,8 @@ static lv_design_res_t lv_table_design(lv_obj_t * table, const lv_area_t * clip_
|
||||
if((rect_dsc[cell_type].border_side & LV_BORDER_SIDE_RIGHT) && cell_area_border.x2 < table->coords.x2 - bg_right - 1) {
|
||||
cell_area_border.x2 += rect_dsc[cell_type].border_width / 2 + (rect_dsc[cell_type].border_width & 0x1);
|
||||
}
|
||||
if((rect_dsc[cell_type].border_side & LV_BORDER_SIDE_BOTTOM) && cell_area_border.y2 < table->coords.y2 - bg_bottom - 1) {
|
||||
if((rect_dsc[cell_type].border_side & LV_BORDER_SIDE_BOTTOM) &&
|
||||
cell_area_border.y2 < table->coords.y2 - bg_bottom - 1) {
|
||||
cell_area_border.y2 += rect_dsc[cell_type].border_width / 2 + (rect_dsc[cell_type].border_width & 0x1);
|
||||
}
|
||||
|
||||
@@ -998,7 +999,7 @@ static void refr_size(lv_obj_t * table)
|
||||
|
||||
for(i = 0; i < ext->row_cnt; i++) {
|
||||
ext->row_h[i] = get_row_height(table, i, font, letter_space, line_space,
|
||||
cell_left, cell_right, cell_top, cell_bottom);
|
||||
cell_left, cell_right, cell_top, cell_bottom);
|
||||
h += ext->row_h[i];
|
||||
}
|
||||
|
||||
|
||||
@@ -177,9 +177,9 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_obj_t * new_tab = lv_tabview_add_tab(tabview, copy_ext->tab_name_ptr[i]);
|
||||
lv_obj_t * copy_tab = lv_tabview_get_tab(copy, i);
|
||||
lv_style_list_copy(lv_obj_get_style_list(new_tab, LV_PAGE_PART_SCROLLABLE), lv_obj_get_style_list(copy_tab,
|
||||
LV_PAGE_PART_SCROLLABLE));
|
||||
LV_PAGE_PART_SCROLLABLE));
|
||||
lv_style_list_copy(lv_obj_get_style_list(new_tab, LV_PAGE_PART_SCROLLBAR), lv_obj_get_style_list(copy_tab,
|
||||
LV_PAGE_PART_SCROLLBAR));
|
||||
LV_PAGE_PART_SCROLLBAR));
|
||||
lv_obj_refresh_style(new_tab, LV_STYLE_PROP_ALL);
|
||||
}
|
||||
|
||||
@@ -664,7 +664,8 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p
|
||||
if(state & LV_STATE_FOCUSED) {
|
||||
lv_obj_set_state(ext->btns, LV_STATE_FOCUSED);
|
||||
lv_obj_set_state(ext->indic, LV_STATE_FOCUSED);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lv_obj_clear_state(ext->btns, LV_STATE_FOCUSED);
|
||||
lv_obj_clear_state(ext->indic, LV_STATE_FOCUSED);
|
||||
|
||||
@@ -672,7 +673,8 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p
|
||||
if(state & LV_STATE_EDITED) {
|
||||
lv_obj_set_state(ext->btns, LV_STATE_EDITED);
|
||||
lv_obj_set_state(ext->indic, LV_STATE_EDITED);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lv_obj_clear_state(ext->btns, LV_STATE_EDITED);
|
||||
lv_obj_clear_state(ext->indic, LV_STATE_EDITED);
|
||||
|
||||
|
||||
@@ -548,7 +548,7 @@ static lv_res_t lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param)
|
||||
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
|
||||
lv_get_state_info_t * info = param;
|
||||
if(info->part == LV_WIN_PART_CONTENT_SCROLLABLE) info->result = lv_obj_get_state(lv_page_get_scrl(ext->page),
|
||||
LV_CONT_PART_MAIN);
|
||||
LV_CONT_PART_MAIN);
|
||||
else if(info->part == LV_WIN_PART_SCROLLBAR) info->result = lv_obj_get_state(ext->page, LV_PAGE_PART_SCROLLBAR);
|
||||
else if(info->part == LV_WIN_PART_HEADER) info->result = lv_obj_get_state(ext->header, LV_OBJ_PART_MAIN);
|
||||
return LV_RES_OK;
|
||||
|
||||
Reference in New Issue
Block a user