Compare commits

...

54 Commits

Author SHA1 Message Date
Gabor Kiss-Vamosi
f7a17a525e chore: kick CI to rebuild the docs 2024-04-23 15:59:22 +02:00
fvanroie
9122f844f6 fix(img): possible divide by 0 exception (lvgl#3988) (#3992)
Co-authored-by: fvanroie <cpt_jack@msn.com>
2023-02-15 20:58:08 +01:00
spanish-worker
5c0bb3f85a fix(tileview): build error with animations disabled (#3942)
Co-authored-by: spanish-worker <>
2023-01-24 09:07:23 +01:00
ckielstra
c539546f74 fix(style) fix typo in value line spacing calculation (#3171)
The code for calculating the extra space around a 'value style' property contained a copy/paste error where the 'letter space' instead of the 'line space' was used in the vertical required size calculations.
2022-03-15 21:16:41 -04:00
Dustin Holden
9d99f08e80 fix(btnmatrix): set btn_id_act on keypad press (#3140) 2022-03-01 19:42:17 +01:00
glory-man
3a39ed05a7 fix(refr): prevent area refresh if it's not on a visible screen (#3068) 2022-02-07 17:43:09 +01:00
Philippe Coval
ec4435426e build(cmake) add install support (#2698)
Signed-off-by: Philippe Coval <philippe.coval@huawei.com>
2021-10-19 09:30:57 -04:00
Gabor Kiss-Vamosi
a33fe6a2d6 fix(disp) be sure the pending scr load animation is finished in lv_scr_load_anim
fixes #2502
2021-09-07 21:55:53 +02:00
Damian Kurek
32ee6c5781 Remove main component dependency (#2527) 2021-09-06 10:38:56 +02:00
Gabor Kiss-Vamosi
a3234c8aa1 fix(refr) set disp_drv->draw_buf->flushing_last correctly with sw rotation 2021-08-27 14:52:01 +02:00
Gabor Kiss-Vamosi
ac1fa649ca fix typo 2021-08-10 16:02:22 +02:00
Gabor Kiss-Vamosi
8747a35123 fix warning 2021-08-10 13:56:03 +02:00
Gabor Kiss-Vamosi
3fce530c01 fix(canvas) invalidate the image on delete
fixes #2398
2021-08-09 11:23:22 +02:00
Gabor Kiss-Vamosi
719fa3ce0f fix(gauge) fix warning due to missing cast 2021-07-15 17:32:53 +02:00
Gabor Kiss-Vamosi
797212a3f3 fix(gauge) handle critical values larger than max value 2021-07-13 17:38:16 +02:00
Gabor Kiss-Vamosi
042e34cb88 fix(gauge)fix inaccuracy of gauge critical value
Fixes #2288
2021-06-17 11:01:42 +02:00
Gabor Kiss-Vamosi
60ddd13465 fix build error
fixes #2317
2021-06-16 12:45:08 +02:00
Gabor Kiss-Vamosi
e04a8d2961 fix(draw) underflow in subpixel font drawing
Fixes: #2273
2021-06-15 19:56:26 +02:00
Themba Dube
3bafa5a8a3 Bump version number in PlatformIO
Try to address https://github.com/lvgl/lvgl/issues/2046#issuecomment-851713326
2021-06-02 08:23:59 -04:00
Gabor Kiss-Vamosi
f710be661b fix(tabview) wix memory leak with left/right tab position
Fixes #2223
2021-05-29 21:51:20 +02:00
Gabor Kiss-Vamosi
b16e7f1076 fix(textarea) fix setting padding in one line mode
Fixes #2253
2021-05-19 14:47:19 +02:00
embeddedt
708272c37c fix(roller) use correct line height for selected area (#2251)
Co-authored-by: alec-2018 <40708750+alec-2018@users.noreply.github.com>
2021-05-11 10:08:29 -04:00
Gabor Kiss-Vamosi
f926ec56e9 Merge branch 'release/v7' of https://github.com/littlevgl/lvgl into release/v7 2021-05-10 09:50:46 +02:00
Gabor Kiss-Vamosi
d11d95bf8e fix(anim) minor fixes 2021-05-10 09:50:41 +02:00
Sean
e06fe1b82e Fix the bug that setting text font to rollers lv_roller_part_selected is invalid when animation is disabled. (#2238)
Co-authored-by: Cheng Tang <ctang@thoughtworks.com>
2021-05-06 19:23:54 +02:00
Matt Sieren
d39a34351c fix(kconfig) remove dependency for LV_COLOR_CHROMA_KEY_HEX (#2234)
Remove the depdenency on LV_COLOR_SCREEN_TRANSP which depends on
LV_COLOR_DEPTH_32 so chroma-keying is working with systems that operate
in a 16 bit color space or lower.
2021-05-04 20:44:14 -04:00
embeddedt
e08ecffca9 fix(style) remove redundant lv_style_copy declaration
Reported here: https://forum.lvgl.io/t/warning-from-compiler-xc32/5342
2021-04-25 18:06:06 -04:00
Gabor Kiss-Vamosi
3e7bc7294a Merge branch 'release/v7' of https://github.com/littlevgl/lvgl into release/v7 2021-04-24 19:44:44 +02:00
Gabor Kiss-Vamosi
77d6dbb691 fix(material theme) properly handle LV_THEME_MATERIAL_FLAG_NO_FOCUS 2021-04-24 19:44:38 +02:00
incity
506a21c6d9 fix bug : heap-use-after-free (#2207) 2021-04-22 16:08:17 +02:00
Roman Stanchak
28c43adc60 lv_theme_mono: fix runtime error with spinner widget using mono theme (#2202)
When using the spinner widget with the mono theme, a runtime error
occurs when the widget is styled:

Warn: Invalid style (local variable or not initialized?)
(lv_style.c #952 lv_debug_check_style())
Error: _lv_style_list_add_style         (lv_style.c #189
_lv_style_list_add_style())
Error: Invalid style (0x000055CF3A53A190)       (lv_debug.c #127
lv_debug_log_error())

This is apparently due to styles->tick_line not being initialized.

The spinner uses the arc's styles in the material theme, so the same
approach is applied here.
2021-04-19 19:36:23 +02:00
Gabor Kiss-Vamosi
0ce7795b7a fix(table) fix memory leak
See https://forum.lvgl.io/t/possible-memory-leak-in-table-widget/5254
2021-04-19 15:50:19 +02:00
Gabor Kiss-Vamosi
3025101786 fix(material theme) add default line style with 1 px width
fixes #2177
2021-04-08 13:30:34 +02:00
Gabor Kiss-Vamosi
94ad20bc94 fix(lv_obj_style_dec) update comment
fixes #2181
2021-04-06 20:37:26 +02:00
Gabor Kiss-Vamosi
9f1982bf5c Merge branch 'release/v7' of https://github.com/littlevgl/lvgl into release/v7 2021-04-06 11:52:51 +02:00
Gabor Kiss-Vamosi
02b80de5f3 fix(linemeter) don't make the first line active if cur_calue == min value 2021-04-06 11:52:40 +02:00
Gabor Kiss-Vamosi
ea04782acb Merge branch 'release/v7' of https://github.com/littlevgl/lvgl into release/v7 2021-04-06 11:13:06 +02:00
embeddedt
15976bdb9e fix(indev) provide raw old points to read_cb, not rotated points (#2180)
fixes #2184
2021-04-06 11:12:29 +02:00
embeddedt
acf42d3999 fix(indev) provide raw old points to read_cb, not rotated points (#2180) 2021-04-02 12:51:49 +02:00
Gabor Kiss-Vamosi
82b9779067 Merge branch 'release/v7' of https://github.com/littlevgl/lvgl into release/v7 2021-04-01 12:22:08 +02:00
Gabor Kiss-Vamosi
c08b0cdc79 fix(draw_rect) drawing right border
fixes #2159
2021-04-01 12:21:39 +02:00
embeddedt
08b3fe1f11 fix(btnmatrix): initialize align parameter (#2176) 2021-03-31 08:06:00 -04:00
Amir Gonnen
1748798aca feat(cmake) Allow building LVGL without kconfig (#2165)
Also add ../ to the search path, such that lv_conf.h could be found on parent directory

Related discussion: https://github.com/lvgl/lvgl/pull/1875#issuecomment-803179499
2021-03-24 18:54:03 -04:00
Gabor Kiss-Vamosi
e1ac174e16 Merge branch 'master' into release/v7 2021-03-16 16:33:07 +01:00
Gabor Kiss-Vamosi
3856548377 Merge branch 'master' into release/v7 2021-02-16 15:34:28 +01:00
Gabor Kiss-Vamosi
51edc63ac1 Merge branch 'master' into release/v7 2021-02-02 15:12:24 +01:00
Gabor Kiss-Vamosi
d9f5298225 Merge branch 'master' into release/v7 2021-01-19 14:36:51 +01:00
Gabor Kiss-Vamosi
3fa221e659 Merge branch 'master' into release/v7 2021-01-05 15:57:48 +01:00
Gabor Kiss-Vamosi
0b39da7d24 Merge branch 'master' into release/v7 2020-12-15 19:59:41 +01:00
Gabor Kiss-Vamosi
87a49f25c1 merge master 2020-12-01 15:30:57 +01:00
Gabor Kiss-Vamosi
9688935c8f Merge branch 'master' into release/v7 2020-12-01 15:10:11 +01:00
Gabor Kiss-Vamosi
f32526562a Merge branch 'master' into release/v7 2020-11-17 11:30:10 +01:00
Gabor Kiss-Vamosi
4250e64613 Merge branch 'master' into release/v7 2020-11-03 09:23:30 +01:00
Gabor Kiss-Vamosi
cfc4ec4b1b Release v7.7.0 2020-10-21 13:11:27 +02:00
40 changed files with 257 additions and 127 deletions

View File

@@ -1,5 +1,12 @@
# Changelog
## v7.11.1
### New features
### Bugfixes
- fix(kconfig) remove dependency for LV_COLOR_CHROMA_KEY_HEX
## v7.11.0 (Planned for 19.02.2021)
### New features

View File

@@ -2,9 +2,16 @@ if(ESP_PLATFORM)
file(GLOB_RECURSE SOURCES src/*.c)
idf_component_register(SRCS ${SOURCES}
INCLUDE_DIRS . src
REQUIRES main)
idf_build_get_property(LV_MICROPYTHON LV_MICROPYTHON)
if (LV_MICROPYTHON)
idf_component_register(SRCS ${SOURCES}
INCLUDE_DIRS . src ../
REQUIRES main)
else()
idf_component_register(SRCS ${SOURCES}
INCLUDE_DIRS . src ../)
endif()
target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_CONF_INCLUDE_SIMPLE")
@@ -65,3 +72,35 @@ file(GLOB_RECURSE SOURCES src/*.c)
add_library(lvgl STATIC ${SOURCES})
endif()
option(install "Enable install to system" OFF)
if(install)
include_directories(${CMAKE_SOURCE_DIR})
file(GLOB LVGL_PUBLIC_HEADERS
"${CMAKE_SOURCE_DIR}/lv_conf.h"
"${CMAKE_SOURCE_DIR}/lvgl.h")
if("${LIB_INSTALL_DIR}" STREQUAL "")
set(LIB_INSTALL_DIR "lib")
endif()
if("${INC_INSTALL_DIR}" STREQUAL "")
set(INC_INSTALL_DIR "include/lvgl")
endif()
install(DIRECTORY "${CMAKE_SOURCE_DIR}/src"
DESTINATION "${CMAKE_INSTALL_PREFIX}/${INC_INSTALL_DIR}/"
FILES_MATCHING
PATTERN "*.h")
set_target_properties(lvgl PROPERTIES
OUTPUT_NAME lvgl
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}")
install(TARGETS lvgl
ARCHIVE DESTINATION "${LIB_INSTALL_DIR}"
PUBLIC_HEADER DESTINATION "${INC_INSTALL_DIR}")
endif(install)

View File

@@ -62,7 +62,6 @@ menu "LVGL configuration"
config LV_COLOR_TRANSP_HEX
hex "Images pixels with this color will not be drawn (with chroma keying)."
depends on LV_COLOR_SCREEN_TRANSP
range 0x000000 0xFFFFFF
default 0x00FF00
help

View File

@@ -9,7 +9,7 @@ LVGL provides everything you need to create embedded GUI with easy-to-use graphi
</p>
<h4 align="center">
<a href="https://lvgl.io">Website </a> &middot;
<a href="https://lvgl.io">Website </a> &middot;Update README.md
<a href="https://lvgl.io/demos">Online demo</a> &middot;
<a href="https://lvgl.github.io/lv_examples/">Nightly demos</a> &middot;
<a href="https://docs.lvgl.io/">Docs</a> &middot;
@@ -139,6 +139,7 @@ void btn_event_cb(lv_obj_t * btn, lv_event_t event)
}
}
```
![LVGL button with label example](https://raw.githubusercontent.com/lvgl/docs/latest/misc/simple_button_example.gif)
### LVGL from Micropython

View File

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

View File

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

View File

@@ -28,10 +28,11 @@ fout.write(
#include <stdint.h>
/* Handle special Kconfig options */
#include "lv_conf_kconfig.h"
#ifdef CONFIG_LV_CONF_SKIP
#define LV_CONF_SKIP
#ifndef LV_KCONFIG_IGNORE
# include "lv_conf_kconfig.h"
# ifdef CONFIG_LV_CONF_SKIP
# define LV_CONF_SKIP
# endif
#endif
/* If "lv_conf.h" is available from here try to use it later.*/

View File

@@ -11,10 +11,11 @@
#include <stdint.h>
/* Handle special Kconfig options */
#include "lv_conf_kconfig.h"
#ifdef CONFIG_LV_CONF_SKIP
#define LV_CONF_SKIP
#ifndef LV_KCONFIG_IGNORE
# include "lv_conf_kconfig.h"
# ifdef CONFIG_LV_CONF_SKIP
# define LV_CONF_SKIP
# endif
#endif
/* If "lv_conf.h" is available from here try to use it later.*/

View File

@@ -215,13 +215,15 @@ void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t
lv_disp_t * d = lv_obj_get_disp(new_scr);
lv_obj_t * act_scr = lv_scr_act();
if(d->del_prev && act_scr != d->scr_to_load && d->scr_to_load) {
lv_obj_del(act_scr);
if(d->scr_to_load && act_scr != d->scr_to_load) {
lv_disp_load_scr(d->scr_to_load);
lv_anim_del(d->scr_to_load, NULL);
lv_obj_set_pos(d->scr_to_load, 0, 0);
lv_style_remove_prop(lv_obj_get_local_style(d->scr_to_load, LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE);
if(d->del_prev) {
lv_obj_del(act_scr);
}
act_scr = d->scr_to_load;
}

View File

@@ -414,6 +414,10 @@ lv_task_t * lv_indev_get_read_task(lv_disp_t * indev)
static void indev_pointer_proc(lv_indev_t * i, lv_indev_data_t * data)
{
lv_disp_t * disp = i->driver.disp;
/*Save the raw points so they can be used again in _lv_indev_read*/
i->proc.types.pointer.last_raw_point.x = data->point.x;
i->proc.types.pointer.last_raw_point.y = data->point.y;
/*Rotate the points if necessary*/
if(disp->driver.rotated == LV_DISP_ROT_180 || disp->driver.rotated == LV_DISP_ROT_270) {
data->point.x = disp->driver.hor_res - data->point.x - 1;
data->point.y = disp->driver.ver_res - data->point.y - 1;

View File

@@ -585,34 +585,35 @@ bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area)
/*Invalidate the object only if it belongs to the current or previous'*/
lv_obj_t * obj_scr = lv_obj_get_screen(obj);
lv_disp_t * disp = lv_obj_get_disp(obj_scr);
if(obj_scr == lv_disp_get_scr_act(disp) ||
obj_scr == lv_disp_get_scr_prev(disp) ||
obj_scr == lv_disp_get_layer_top(disp) ||
obj_scr == lv_disp_get_layer_sys(disp)) {
if(obj_scr != lv_disp_get_scr_act(disp) &&
obj_scr != lv_disp_get_scr_prev(disp) &&
obj_scr != lv_disp_get_layer_top(disp) &&
obj_scr != lv_disp_get_layer_sys(disp)) {
return false;
}
/*Truncate the area to the object*/
lv_area_t obj_coords;
lv_coord_t ext_size = obj->ext_draw_pad;
lv_area_copy(&obj_coords, &obj->coords);
obj_coords.x1 -= ext_size;
obj_coords.y1 -= ext_size;
obj_coords.x2 += ext_size;
obj_coords.y2 += ext_size;
/*Truncate the area to the object*/
lv_area_t obj_coords;
lv_coord_t ext_size = obj->ext_draw_pad;
lv_area_copy(&obj_coords, &obj->coords);
obj_coords.x1 -= ext_size;
obj_coords.y1 -= ext_size;
obj_coords.x2 += ext_size;
obj_coords.y2 += ext_size;
bool is_common;
bool is_common;
is_common = _lv_area_intersect(area, area, &obj_coords);
if(is_common == false) return false; /*The area is not on the object*/
is_common = _lv_area_intersect(area, area, &obj_coords);
if(is_common == false) return false; /*The area is not on the object*/
/*Truncate recursively to the parents*/
lv_obj_t * par = lv_obj_get_parent(obj);
while(par != NULL) {
is_common = _lv_area_intersect(area, area, &par->coords);
if(is_common == false) return false; /*If no common parts with parent break;*/
if(lv_obj_get_hidden(par)) return false; /*If the parent is hidden then the child is hidden and won't be drawn*/
/*Truncate recursively to the parents*/
lv_obj_t * par = lv_obj_get_parent(obj);
while(par != NULL) {
is_common = _lv_area_intersect(area, area, &par->coords);
if(is_common == false) return false; /*If no common parts with parent break;*/
if(lv_obj_get_hidden(par)) return false; /*If the parent is hidden then the child is hidden and won't be drawn*/
par = lv_obj_get_parent(par);
}
par = lv_obj_get_parent(par);
}
return true;
@@ -3601,7 +3602,7 @@ lv_coord_t lv_obj_get_draw_rect_ext_pad_size(lv_obj_t * obj, uint8_t part)
lv_opa_t value_opa = lv_obj_get_style_value_opa(obj, part);
if(value_opa > LV_OPA_MIN) {
lv_style_int_t letter_space = lv_obj_get_style_value_letter_space(obj, part);
lv_style_int_t line_space = lv_obj_get_style_value_letter_space(obj, part);
lv_style_int_t line_space = lv_obj_get_style_value_line_space(obj, part);
const lv_font_t * font = lv_obj_get_style_value_font(obj, part);
lv_point_t txt_size;

View File

@@ -32,19 +32,6 @@ extern "C" {
* - For example:
* `lv_obj_set_style_local_border_width(btn1, LV_BTN_PART_MAIN, LV_STATE_PRESSED, 2);`
*
* Get a local style property's value of an object in a given state
* ----------------------------------------------------------------
* - Return the best matching property in the given state.
* - E.g. if `state` parameter is LV_STATE_PRESSED | LV_STATE_CHECKED` but the property defined only in
* `LV_STATE_PRESSED` and `LV_STATE_DEFAULT` the best matching state is `LV_STATE_PRESSED`
* (because it has higher precedence) and it will be returned.
* - If the property is not found even in `LV_STATE_DEFAULT` `-1` is returned.
* - For example:
* `//Type of result should be lv_style_int_t/lv_opa_t/lv_color_t/const void * according to the type of the property`
* `lv_style_int_t result;`
* `lv_obj_get_style_local_border_width(btn1, LV_BTN_PART_MAIN, LV_STATE_PRESSED, &result);`
* `if(weight > 0) ...the property is found and loaded into result...`
*
* Get the value from a style in a given state
* -------------------------------------------
* - The same rules applies to the return value then for "lv_obj_get_style_local_...()" above

View File

@@ -861,7 +861,7 @@ static void lv_refr_vdb_rotate(lv_area_t * area, lv_color_t * color_p)
area->y1 = area->x1;
area->y2 = area->y1 + area_w - 1;
}
vdb->flushing = 0;
/*Rotate the screen in chunks, flushing after each one*/
lv_coord_t row = 0;
while(row < area_h) {
@@ -895,6 +895,16 @@ static void lv_refr_vdb_rotate(lv_area_t * area, lv_color_t * color_p)
area->x1 = area->x2 - height + 1;
}
}
/* The original part (chunk of the current area) were split into more parts here.
* Set the original last_part flag on the last part of rotation. */
if(row + height >= area_h && vdb->last_area && vdb->last_part) {
vdb->flushing_last = 1;
}
else {
vdb->flushing_last = 0;
}
/*Flush the completed area to the display*/
drv->flush_cb(drv, area, rot_buf == NULL ? color_p : rot_buf);
/*FIXME: Rotation forces legacy behavior where rendering and flushing are done serially*/

View File

@@ -328,13 +328,6 @@ void lv_style_reset(lv_style_t * style);
*/
uint16_t _lv_style_get_mem_size(const lv_style_t * style);
/**
* Copy a style to an other
* @param dest pointer to the destination style
* @param src pointer to the source style
*/
void lv_style_copy(lv_style_t * dest, const lv_style_t * src);
/**
* Remove a property from a style
* @param style pointer to a style

View File

@@ -655,6 +655,14 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
int32_t col_bit;
col_bit = bit_ofs & 0x7; /* "& 0x7" equals to "% 8" just faster */
lv_area_t map_area;
map_area.x1 = col_start / 3 + pos_x;
map_area.x2 = col_end / 3 + pos_x - 1;
map_area.y1 = row_start + pos_y;
map_area.y2 = map_area.y1;
if(map_area.x2 <= map_area.x1) return;
int32_t mask_buf_size = box_w * box_h > LV_HOR_RES_MAX ? LV_HOR_RES_MAX : g->box_w * g->box_h;
lv_opa_t * mask_buf = _lv_mem_buf_get(mask_buf_size);
int32_t mask_p = 0;
@@ -673,12 +681,6 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
/*If the letter is partially out of mask the move there on VDB*/
vdb_buf_tmp += (row_start * vdb_width) + col_start / 3;
lv_area_t map_area;
map_area.x1 = col_start / 3 + pos_x;
map_area.x2 = col_end / 3 + pos_x - 1;
map_area.y1 = row_start + pos_y;
map_area.y2 = map_area.y1;
uint8_t other_mask_cnt = lv_draw_mask_get_cnt();
uint8_t font_rgb[3];

View File

@@ -468,12 +468,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv
fill_area.y1 = disp_area->y1 + draw_area.y1;
fill_area.y2 = fill_area.y1;
uint32_t buf_ofs = 0;
if(dsc->border_side == LV_BORDER_SIDE_LEFT) fill_area.x2 = coords->x1 + corner_size;
else if(dsc->border_side == LV_BORDER_SIDE_RIGHT) {
fill_area.x1 = coords->x2 - corner_size;
buf_ofs = fill_area.x1 - coords->x1;
}
volatile bool top_only = false;
volatile bool bottom_only = false;
@@ -492,7 +487,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv
(bottom_only && fill_area.y1 >= coords->y2 - corner_size)) {
_lv_memset_ff(mask_buf, draw_area_w);
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
_lv_blend_fill(clip, &fill_area, color, mask_buf + buf_ofs, mask_res, opa, blend_mode);
_lv_blend_fill(clip, &fill_area, color, mask_buf, mask_res, opa, blend_mode);
}
fill_area.y1++;
fill_area.y2++;

View File

@@ -132,8 +132,8 @@ bool _lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data)
/* For touchpad sometimes users don't the last pressed coordinate on release.
* So be sure a coordinates are initialized to the last point */
if(indev->driver.type == LV_INDEV_TYPE_POINTER) {
data->point.x = indev->proc.types.pointer.act_point.x;
data->point.y = indev->proc.types.pointer.act_point.y;
data->point.x = indev->proc.types.pointer.last_raw_point.x;
data->point.y = indev->proc.types.pointer.last_raw_point.y;
}
/*Similarly set at least the last key in case of the user doesn't set it on release*/
else if(indev->driver.type == LV_INDEV_TYPE_KEYPAD) {

View File

@@ -131,6 +131,7 @@ typedef struct _lv_indev_proc_t {
/*Pointer and button data*/
lv_point_t act_point; /**< Current point of input device. */
lv_point_t last_point; /**< Last point of input device. */
lv_point_t last_raw_point; /**< Last point read from read_cb. */
lv_point_t vect; /**< Difference between `act_point` and `last_point`. */
lv_point_t drag_sum; /*Count the dragged pixels to check LV_INDEV_DEF_DRAG_LIMIT*/
lv_point_t drag_throw_vect;

View File

@@ -105,7 +105,7 @@ void lv_anim_start(lv_anim_t * a)
a->time_orig = a->time;
a->run_round = anim_run_round;
_lv_memcpy(new_anim, a, sizeof(lv_anim_t));
if(a->var == a) new_anim->var = new_anim;
/*Set the start value*/
if(new_anim->early_apply) {
if(new_anim->exec_cb && new_anim->var) new_anim->exec_cb(new_anim->var, new_anim->start);
@@ -437,8 +437,9 @@ static void anim_task(lv_task_t * param)
/*The animation will run now for the first time. Call `start_cb`*/
int32_t new_act_time = a->act_time + elaps;
if(a->act_time <= 0 && new_act_time >= 0) {
if(!a->start_cb_called && a->act_time <= 0 && new_act_time >= 0) {
if(a->start_cb) a->start_cb(a);
a->start_cb_called = 1;
}
a->act_time += elaps;
if(a->act_time >= 0) {

View File

@@ -95,6 +95,7 @@ typedef struct _lv_anim_t {
/*Animation system use these - user shouldn't set*/
uint8_t playback_now : 1; /**< Play back is in progress*/
uint8_t run_round : 1; /**< Indicates the animation has run in this round*/
uint8_t start_cb_called : 1; /**< Indicates that `start_cb` was already called`*/
uint32_t time_orig;
} lv_anim_t;

View File

@@ -352,7 +352,6 @@ static void clear_styles(lv_obj_t * obj, lv_theme_style_t name)
case LV_THEME_TILEVIEW:
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_BG);
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
break;
#endif

View File

@@ -85,6 +85,10 @@ typedef struct {
lv_style_t arc_knob;
#endif
#if LV_USE_LINE
lv_style_t line;
#endif
#if LV_USE_BAR
lv_style_t bar_bg;
lv_style_t bar_indic;
@@ -206,9 +210,10 @@ static void basic_init(void)
lv_style_set_bg_opa(&styles->bg, LV_STATE_DEFAULT, LV_OPA_COVER);
lv_style_set_bg_color(&styles->bg, LV_STATE_DEFAULT, COLOR_BG);
lv_style_set_border_color(&styles->bg, LV_STATE_DEFAULT, COLOR_BG_BORDER);
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0)lv_style_set_border_color(&styles->bg, LV_STATE_FOCUSED,
theme.color_primary);
lv_style_set_border_color(&styles->bg, LV_STATE_EDITED, theme.color_secondary);
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
lv_style_set_border_color(&styles->bg, LV_STATE_FOCUSED, theme.color_primary);
lv_style_set_border_color(&styles->bg, LV_STATE_EDITED, theme.color_secondary);
}
lv_style_set_border_width(&styles->bg, LV_STATE_DEFAULT, BORDER_WIDTH);
lv_style_set_border_post(&styles->bg, LV_STATE_DEFAULT, true);
lv_style_set_text_color(&styles->bg, LV_STATE_DEFAULT, COLOR_BG_TEXT);
@@ -240,8 +245,11 @@ static void basic_init(void)
lv_style_set_bg_color(&styles->bg_click, LV_STATE_PRESSED | LV_STATE_CHECKED, COLOR_BG_PR_CHK);
lv_style_set_bg_color(&styles->bg_click, LV_STATE_DISABLED, COLOR_BG_DIS);
lv_style_set_border_width(&styles->bg_click, LV_STATE_CHECKED, 0);
lv_style_set_border_color(&styles->bg_click, LV_STATE_FOCUSED | LV_STATE_PRESSED, lv_color_darken(theme.color_primary,
LV_OPA_20));
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
lv_style_set_border_color(&styles->bg_click, LV_STATE_FOCUSED | LV_STATE_PRESSED,
lv_color_darken(theme.color_primary, LV_OPA_20));
}
lv_style_set_border_color(&styles->bg_click, LV_STATE_PRESSED, COLOR_BG_BORDER_PR);
lv_style_set_border_color(&styles->bg_click, LV_STATE_CHECKED, COLOR_BG_BORDER_CHK);
lv_style_set_border_color(&styles->bg_click, LV_STATE_PRESSED | LV_STATE_CHECKED, COLOR_BG_BORDER_CHK_PR);
@@ -296,9 +304,11 @@ static void basic_init(void)
lv_style_set_pad_inner(&styles->btn, LV_STATE_DEFAULT, LV_DPX(20));
lv_style_set_outline_width(&styles->btn, LV_STATE_DEFAULT, OUTLINE_WIDTH);
lv_style_set_outline_opa(&styles->btn, LV_STATE_DEFAULT, LV_OPA_0);
lv_style_set_outline_opa(&styles->btn, LV_STATE_FOCUSED, LV_OPA_50);
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
lv_style_set_outline_opa(&styles->btn, LV_STATE_FOCUSED, LV_OPA_50);
lv_style_set_outline_color(&styles->btn, LV_STATE_EDITED, theme.color_secondary);
}
lv_style_set_outline_color(&styles->btn, LV_STATE_DEFAULT, theme.color_primary);
lv_style_set_outline_color(&styles->btn, LV_STATE_EDITED, theme.color_secondary);
lv_style_set_transition_time(&styles->btn, LV_STATE_DEFAULT, TRANSITION_TIME);
lv_style_set_transition_prop_4(&styles->btn, LV_STATE_DEFAULT, LV_STYLE_BORDER_OPA);
lv_style_set_transition_prop_5(&styles->btn, LV_STATE_DEFAULT, LV_STYLE_BG_COLOR);
@@ -352,7 +362,9 @@ static void bar_init(void)
lv_style_set_outline_color(&styles->bar_bg, LV_STATE_DEFAULT, theme.color_primary);
lv_style_set_outline_color(&styles->bar_bg, LV_STATE_EDITED, theme.color_secondary);
lv_style_set_outline_opa(&styles->bar_bg, LV_STATE_DEFAULT, LV_OPA_TRANSP);
lv_style_set_outline_opa(&styles->bar_bg, LV_STATE_FOCUSED, LV_OPA_50);
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
lv_style_set_outline_opa(&styles->bar_bg, LV_STATE_FOCUSED, LV_OPA_50);
}
lv_style_set_outline_width(&styles->bar_bg, LV_STATE_DEFAULT, OUTLINE_WIDTH);
lv_style_set_transition_time(&styles->bar_bg, LV_STATE_DEFAULT, TRANSITION_TIME);
lv_style_set_transition_prop_6(&styles->bar_bg, LV_STATE_DEFAULT, LV_STYLE_OUTLINE_OPA);
@@ -376,6 +388,8 @@ static void img_init(void)
static void line_init(void)
{
#if LV_USE_LINE != 0
lv_style_reset(&styles->line);
lv_style_set_line_width(&styles->line, LV_STATE_DEFAULT, 1);
#endif
}
@@ -564,9 +578,11 @@ static void calendar_init(void)
lv_style_set_text_color(&styles->calendar_date_nums, LV_STATE_DISABLED, LV_COLOR_GRAY);
lv_style_set_bg_opa(&styles->calendar_date_nums, LV_STATE_CHECKED, IS_LIGHT ? LV_OPA_20 : LV_OPA_40);
lv_style_set_bg_opa(&styles->calendar_date_nums, LV_STATE_PRESSED, LV_OPA_20);
lv_style_set_bg_opa(&styles->calendar_date_nums, LV_STATE_FOCUSED, LV_OPA_COVER);
lv_style_set_text_color(&styles->calendar_date_nums, LV_STATE_FOCUSED, LV_COLOR_WHITE);
lv_style_set_bg_color(&styles->calendar_date_nums, LV_STATE_FOCUSED, theme.color_primary);
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
lv_style_set_bg_opa(&styles->calendar_date_nums, LV_STATE_FOCUSED, LV_OPA_COVER);
lv_style_set_text_color(&styles->calendar_date_nums, LV_STATE_FOCUSED, LV_COLOR_WHITE);
lv_style_set_bg_color(&styles->calendar_date_nums, LV_STATE_FOCUSED, theme.color_primary);
}
lv_style_set_bg_color(&styles->calendar_date_nums, LV_STATE_DEFAULT,
IS_LIGHT ? lv_color_hex(0x666666) : LV_COLOR_WHITE);
lv_style_set_bg_color(&styles->calendar_date_nums, LV_STATE_CHECKED, theme.color_primary);
@@ -596,8 +612,10 @@ static void cpicker_init(void)
lv_style_set_bg_opa(&styles->cpicker_indic, LV_STATE_DEFAULT, LV_OPA_COVER);
lv_style_set_border_width(&styles->cpicker_indic, LV_STATE_DEFAULT, 2);
lv_style_set_border_color(&styles->cpicker_indic, LV_STATE_DEFAULT, LV_COLOR_GRAY);
lv_style_set_border_color(&styles->cpicker_indic, LV_STATE_FOCUSED, theme.color_primary);
lv_style_set_border_color(&styles->cpicker_indic, LV_STATE_EDITED, theme.color_secondary);
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
lv_style_set_border_color(&styles->cpicker_indic, LV_STATE_FOCUSED, theme.color_primary);
lv_style_set_border_color(&styles->cpicker_indic, LV_STATE_EDITED, theme.color_secondary);
}
lv_style_set_pad_left(&styles->cpicker_indic, LV_STATE_DEFAULT, LV_DPX(13));
lv_style_set_pad_right(&styles->cpicker_indic, LV_STATE_DEFAULT, LV_DPX(13));
lv_style_set_pad_top(&styles->cpicker_indic, LV_STATE_DEFAULT, LV_DPX(13));
@@ -613,14 +631,18 @@ static void checkbox_init(void)
lv_style_set_pad_inner(&styles->cb_bg, LV_STATE_DEFAULT, LV_DPX(10));
lv_style_set_outline_color(&styles->cb_bg, LV_STATE_DEFAULT, theme.color_primary);
lv_style_set_outline_opa(&styles->cb_bg, LV_STATE_DEFAULT, LV_OPA_TRANSP);
lv_style_set_outline_opa(&styles->cb_bg, LV_STATE_FOCUSED, LV_OPA_50);
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
lv_style_set_outline_opa(&styles->cb_bg, LV_STATE_FOCUSED, LV_OPA_50);
}
lv_style_set_outline_width(&styles->cb_bg, LV_STATE_DEFAULT, OUTLINE_WIDTH);
lv_style_set_outline_pad(&styles->cb_bg, LV_STATE_DEFAULT, LV_DPX(10));
lv_style_set_transition_time(&styles->cb_bg, LV_STATE_DEFAULT, TRANSITION_TIME);
lv_style_set_transition_prop_6(&styles->cb_bg, LV_STATE_DEFAULT, LV_STYLE_OUTLINE_OPA);
lv_style_reset(&styles->cb_bullet);
lv_style_set_outline_opa(&styles->cb_bullet, LV_STATE_FOCUSED, LV_OPA_TRANSP);
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
lv_style_set_outline_opa(&styles->cb_bullet, LV_STATE_FOCUSED, LV_OPA_TRANSP);
}
lv_style_set_radius(&styles->cb_bullet, LV_STATE_DEFAULT, LV_DPX(4));
lv_style_set_pattern_image(&styles->cb_bullet, LV_STATE_CHECKED, LV_SYMBOL_OK);
lv_style_set_pattern_recolor(&styles->cb_bullet, LV_STATE_CHECKED, LV_COLOR_WHITE);
@@ -647,7 +669,9 @@ static void keyboard_init(void)
lv_style_set_border_width(&styles->kb_bg, LV_STATE_DEFAULT, LV_DPX(4));
lv_style_set_border_side(&styles->kb_bg, LV_STATE_DEFAULT, LV_BORDER_SIDE_TOP);
lv_style_set_border_color(&styles->kb_bg, LV_STATE_DEFAULT, IS_LIGHT ? COLOR_BG_TEXT : LV_COLOR_BLACK);
lv_style_set_border_color(&styles->kb_bg, LV_STATE_EDITED, theme.color_secondary);
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
lv_style_set_border_color(&styles->kb_bg, LV_STATE_EDITED, theme.color_secondary);
}
lv_style_set_pad_left(&styles->kb_bg, LV_STATE_DEFAULT, LV_DPX(5));
lv_style_set_pad_right(&styles->kb_bg, LV_STATE_DEFAULT, LV_DPX(5));
lv_style_set_pad_top(&styles->kb_bg, LV_STATE_DEFAULT, LV_DPX(5));
@@ -743,13 +767,15 @@ static void list_init(void)
lv_style_set_border_side(&styles->list_btn, LV_STATE_DEFAULT, LV_BORDER_SIDE_BOTTOM);
lv_style_set_border_color(&styles->list_btn, LV_STATE_DEFAULT, COLOR_BG_BORDER);
lv_style_set_border_color(&styles->list_btn, LV_STATE_FOCUSED, theme.color_primary);
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
lv_style_set_border_color(&styles->list_btn, LV_STATE_FOCUSED, theme.color_primary);
}
lv_style_set_border_width(&styles->list_btn, LV_STATE_DEFAULT, 1);
lv_style_set_outline_color(&styles->list_btn, LV_STATE_FOCUSED, theme.color_secondary);
lv_style_set_outline_width(&styles->list_btn, LV_STATE_FOCUSED, OUTLINE_WIDTH);
lv_style_set_outline_pad(&styles->list_btn, LV_STATE_FOCUSED, -BORDER_WIDTH);
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
lv_style_set_outline_color(&styles->list_btn, LV_STATE_FOCUSED, theme.color_secondary);
lv_style_set_outline_width(&styles->list_btn, LV_STATE_FOCUSED, OUTLINE_WIDTH);
lv_style_set_outline_pad(&styles->list_btn, LV_STATE_FOCUSED, -BORDER_WIDTH);
}
lv_style_set_pad_left(&styles->list_btn, LV_STATE_DEFAULT, PAD_DEF);
lv_style_set_pad_right(&styles->list_btn, LV_STATE_DEFAULT, PAD_DEF);
lv_style_set_pad_top(&styles->list_btn, LV_STATE_DEFAULT, PAD_DEF);
@@ -760,8 +786,9 @@ static void list_init(void)
lv_style_set_transform_width(&styles->list_btn, LV_STATE_PRESSED, -BORDER_WIDTH);
lv_style_set_transform_width(&styles->list_btn, LV_STATE_CHECKED, -BORDER_WIDTH);
lv_style_set_transform_width(&styles->list_btn, LV_STATE_DISABLED, -BORDER_WIDTH);
lv_style_set_transform_width(&styles->list_btn, LV_STATE_FOCUSED, - BORDER_WIDTH);
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
lv_style_set_transform_width(&styles->list_btn, LV_STATE_FOCUSED, - BORDER_WIDTH);
}
lv_style_set_transition_time(&styles->list_btn, LV_STATE_DEFAULT, TRANSITION_TIME);
lv_style_set_transition_prop_6(&styles->list_btn, LV_STATE_DEFAULT, LV_STYLE_BG_COLOR);
lv_style_set_transition_prop_5(&styles->list_btn, LV_STATE_DEFAULT, LV_STYLE_TRANSFORM_WIDTH);
@@ -849,13 +876,16 @@ static void tabview_win_shared_init(void)
lv_style_set_text_color(&styles->tabview_btns, LV_STATE_CHECKED, COLOR_SCR_TEXT);
lv_style_set_pad_top(&styles->tabview_btns, LV_STATE_DEFAULT, LV_DPX(20));
lv_style_set_pad_bottom(&styles->tabview_btns, LV_STATE_DEFAULT, LV_DPX(20));
lv_style_set_text_color(&styles->tabview_btns, LV_STATE_FOCUSED, theme.color_primary);
lv_style_set_text_color(&styles->tabview_btns, LV_STATE_EDITED, theme.color_secondary);
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
lv_style_set_text_color(&styles->tabview_btns, LV_STATE_FOCUSED, theme.color_primary);
lv_style_set_text_color(&styles->tabview_btns, LV_STATE_EDITED, theme.color_secondary);
}
lv_style_reset(&styles->tabview_indic);
lv_style_set_bg_opa(&styles->tabview_indic, LV_STATE_DEFAULT, LV_OPA_COVER);
lv_style_set_bg_color(&styles->tabview_indic, LV_STATE_DEFAULT, theme.color_primary);
lv_style_set_bg_color(&styles->tabview_indic, LV_STATE_EDITED, theme.color_secondary);
if((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) == 0) {
lv_style_set_bg_color(&styles->tabview_indic, LV_STATE_EDITED, theme.color_secondary);
}
lv_style_set_size(&styles->tabview_indic, LV_STATE_DEFAULT, LV_DPX(5));
lv_style_set_radius(&styles->tabview_indic, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
@@ -1052,6 +1082,8 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_LINE
case LV_THEME_LINE:
list = lv_obj_get_style_list(obj, LV_LINE_PART_MAIN);
_lv_style_list_add_style(list, &styles->line);
break;
#endif

View File

@@ -687,13 +687,10 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_SPINNER
case LV_THEME_SPINNER:
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->tick_line);
_lv_style_list_add_style(list, &styles->arc_bg);
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_INDIC);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->fg_color);
_lv_style_list_add_style(list, &styles->tick_line);
_lv_style_list_add_style(list, &styles->arc_indic);
break;
#endif
@@ -793,8 +790,10 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
_lv_style_list_add_style(list, &styles->sb);
#if LV_USE_ANIMATION
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
_lv_style_list_add_style(list, &styles->bg);
#endif
break;
#endif

View File

@@ -636,8 +636,10 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
_lv_style_list_add_style(list, &styles->bg);
#if LV_USE_ANIMATION
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
_lv_style_list_add_style(list, &styles->bg);
#endif
break;
#endif

View File

@@ -97,6 +97,7 @@ lv_obj_t * lv_btnmatrix_create(lv_obj_t * par, const lv_obj_t * copy)
ext->map_p = NULL;
ext->recolor = 0;
ext->one_check = 0;
ext->align = LV_LABEL_ALIGN_LEFT;
lv_style_list_init(&ext->style_btn);
ext->style_btn.ignore_trans = 1;
@@ -892,6 +893,7 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * btnm, lv_signal_t sign, void * pa
else if(indev_type == LV_INDEV_TYPE_KEYPAD || (indev_type == LV_INDEV_TYPE_ENCODER &&
lv_group_get_editing(lv_obj_get_group(btnm)))) {
ext->btn_id_pr = ext->btn_id_focused;
ext->btn_id_act = ext->btn_id_focused;
invalidate_button_area(btnm, ext->btn_id_focused);
}
#endif

View File

@@ -11,6 +11,7 @@
#include "../lv_misc/lv_debug.h"
#include "../lv_misc/lv_math.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_draw/lv_img_cache.h"
#include "../lv_core/lv_refr.h"
#include "../lv_themes/lv_theme.h"
@@ -1107,7 +1108,7 @@ static lv_res_t lv_canvas_signal(lv_obj_t * canvas, lv_signal_t sign, void * par
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
if(sign == LV_SIGNAL_CLEANUP) {
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
lv_img_cache_invalidate_src(lv_canvas_get_img(canvas));
}
return res;

View File

@@ -80,6 +80,7 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, const lv_obj_t * copy)
}
/*Initialize the allocated 'ext' */
ext->lmeter.lvl_ofs = -1;
ext->needle_count = 0;
ext->values = NULL;
ext->needle_colors = NULL;

View File

@@ -112,7 +112,14 @@ static inline void lv_gauge_set_range(lv_obj_t * gauge, int32_t min, int32_t max
*/
static inline void lv_gauge_set_critical_value(lv_obj_t * gauge, int32_t value)
{
lv_linemeter_set_value(gauge, value - 1);
lv_linemeter_ext_t * ext = (lv_linemeter_ext_t *)lv_obj_get_ext_attr(gauge);
if(value > lv_linemeter_get_max_value(gauge)) {
ext->lvl_ofs = 1;
}
else {
ext->lvl_ofs = -1;
}
lv_linemeter_set_value(gauge, value);
}
/**

View File

@@ -261,8 +261,6 @@ void lv_img_set_offset_x(lv_obj_t * img, lv_coord_t x)
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
x = x % ext->w;
ext->offset.x = x;
lv_obj_invalidate(img);
}
@@ -279,8 +277,6 @@ void lv_img_set_offset_y(lv_obj_t * img, lv_coord_t y)
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
y = y % ext->h;
ext->offset.y = y;
lv_obj_invalidate(img);
}
@@ -683,8 +679,10 @@ static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area
lv_area_t zoomed_coords;
lv_obj_get_coords(img, &zoomed_coords);
zoomed_coords.x1 += (int32_t)((int32_t)ext->offset.x * zoom_final) >> 8;
zoomed_coords.y1 += (int32_t)((int32_t)ext->offset.y * zoom_final) >> 8;
int32_t offset_x = (int32_t)ext->offset.x % ext->w;
int32_t offset_y = (int32_t)ext->offset.y % ext->h;
zoomed_coords.x1 += (int32_t)(offset_x * zoom_final) >> 8;
zoomed_coords.y1 += (int32_t)(offset_y * zoom_final) >> 8;
zoomed_coords.x2 = zoomed_coords.x1 + ((int32_t)((int32_t)(obj_w - 1) * zoom_final) >> 8);
zoomed_coords.y2 = zoomed_coords.y1 + ((int32_t)((int32_t)(obj_h - 1) * zoom_final) >> 8);

View File

@@ -77,6 +77,7 @@ lv_obj_t * lv_linemeter_create(lv_obj_t * par, const lv_obj_t * copy)
ext->scale_angle = 240;
ext->angle_ofs = 0;
ext->mirrored = 0;
ext->lvl_ofs = 0;
/*The signal and design functions are not copied so set them here*/
lv_obj_set_signal_cb(linemeter, lv_linemeter_signal);
@@ -446,7 +447,8 @@ void lv_linemeter_draw_scale(lv_obj_t * lmeter, const lv_area_t * clip_area, uin
p1.y = y_out_extra;
/* Set the color of the lines */
if((!ext->mirrored && i > level) || (ext->mirrored && i < level)) {
if(ext->cur_value == ext->min_value || (!ext->mirrored && i > level + ext->lvl_ofs) || (ext->mirrored &&
i <= level + ext->lvl_ofs)) {
line_dsc.color = end_color;
line_dsc.width = end_line_width;
}
@@ -465,12 +467,12 @@ void lv_linemeter_draw_scale(lv_obj_t * lmeter, const lv_area_t * clip_area, uin
lv_draw_mask_remove_id(mask_out_id);
#endif
if(part == LV_LINEMETER_PART_MAIN && level + 1 < ext->line_cnt - 1) {
if(part == LV_LINEMETER_PART_MAIN && level < ext->line_cnt - 1) {
lv_style_int_t border_width = lv_obj_get_style_scale_border_width(lmeter, part);
lv_style_int_t end_border_width = lv_obj_get_style_scale_end_border_width(lmeter, part);
if(border_width || end_border_width) {
int16_t end_angle = ((level + 1) * ext->scale_angle) / (ext->line_cnt - 1) + angle_ofs;
int16_t end_angle = (level * ext->scale_angle) / (ext->line_cnt - 1) + angle_ofs;
lv_draw_line_dsc_t arc_dsc;
lv_draw_line_dsc_init(&arc_dsc);
lv_obj_init_draw_line_dsc(lmeter, part, &arc_dsc);

View File

@@ -33,6 +33,7 @@ typedef struct {
uint16_t scale_angle; /*Angle of the scale in deg. (0..360)*/
uint16_t angle_ofs;
uint16_t line_cnt; /*Count of lines */
int16_t lvl_ofs;
int32_t cur_value;
int32_t min_value;
int32_t max_value;

View File

@@ -829,7 +829,10 @@ static lv_res_t lv_list_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * para
lv_obj_t * list = lv_obj_get_parent(lv_obj_get_parent(btn));
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
lv_obj_t * sel = lv_list_get_btn_selected(list);
if(sel == btn) lv_list_focus_btn(list, lv_list_get_next_btn(list, btn));
if(sel == btn) {
ext->act_sel_btn = NULL;
lv_list_focus_btn(list, lv_list_get_next_btn(list, btn));
}
if(ext->last_sel_btn == btn) ext->last_sel_btn = NULL;
#endif
}

View File

@@ -58,7 +58,9 @@ typedef struct {
enum {
LV_LIST_PART_BG = LV_PAGE_PART_BG, /**< List background style */
LV_LIST_PART_SCROLLBAR = LV_PAGE_PART_SCROLLBAR, /**< List scrollbar style. */
#if LV_USE_ANIMATION
LV_LIST_PART_EDGE_FLASH = LV_PAGE_PART_EDGE_FLASH, /**< List edge flash style. */
#endif
_LV_LIST_PART_VIRTUAL_LAST = _LV_PAGE_PART_VIRTUAL_LAST,
LV_LIST_PART_SCROLLABLE = LV_PAGE_PART_SCROLLABLE, /**< List scrollable area style. */
_LV_LIST_PART_REAL_LAST = _LV_PAGE_PART_REAL_LAST,

View File

@@ -86,7 +86,9 @@ typedef struct {
enum {
LV_PAGE_PART_BG = LV_CONT_PART_MAIN,
LV_PAGE_PART_SCROLLBAR = _LV_OBJ_PART_VIRTUAL_LAST,
#if LV_USE_ANIMATION
LV_PAGE_PART_EDGE_FLASH,
#endif
_LV_PAGE_PART_VIRTUAL_LAST,
LV_PAGE_PART_SCROLLABLE = _LV_OBJ_PART_REAL_LAST,

View File

@@ -481,7 +481,7 @@ static lv_design_res_t lv_roller_design(lv_obj_t * roller, const lv_area_t * cli
label); /*Proportional position from the middle line (upscaled)*/
/*Apply a correction with different line heights*/
const lv_font_t * normal_label_font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_BG);
const lv_font_t * normal_label_font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_SELECTED);
lv_coord_t corr = (label_dsc.font->line_height - normal_label_font->line_height) / 2;
/*Apply the proportional position to the selected text*/

View File

@@ -310,6 +310,15 @@ void lv_table_set_row_cnt(lv_obj_t * table, uint16_t row_cnt)
}
if(ext->row_cnt > 0 && ext->col_cnt > 0) {
/*Free the unused cells*/
if(old_row_cnt > row_cnt) {
uint16_t old_cell_cnt = old_row_cnt * ext->col_cnt;
uint32_t new_cell_cnt = ext->col_cnt * ext->row_cnt;
uint32_t i;
for(i = new_cell_cnt; i < old_cell_cnt; i++) {
lv_mem_free(ext->cell_data[i]);
}
}
ext->cell_data = lv_mem_realloc(ext->cell_data, ext->row_cnt * ext->col_cnt * sizeof(char *));
LV_ASSERT_MEM(ext->cell_data);
if(ext->cell_data == NULL) return;
@@ -320,6 +329,7 @@ void lv_table_set_row_cnt(lv_obj_t * table, uint16_t row_cnt)
uint32_t new_cell_cnt = ext->col_cnt * ext->row_cnt;
_lv_memset_00(&ext->cell_data[old_cell_cnt], (new_cell_cnt - old_cell_cnt) * sizeof(ext->cell_data[0]));
}
}
else {
lv_mem_free(ext->cell_data);
@@ -348,6 +358,16 @@ void lv_table_set_col_cnt(lv_obj_t * table, uint16_t col_cnt)
ext->col_cnt = col_cnt;
if(ext->row_cnt > 0 && ext->col_cnt > 0) {
/*Free the unused cells*/
if(old_col_cnt > col_cnt) {
uint16_t old_cell_cnt = old_col_cnt * ext->row_cnt;
uint32_t new_cell_cnt = ext->col_cnt * ext->row_cnt;
uint32_t i;
for(i = new_cell_cnt; i < old_cell_cnt; i++) {
lv_mem_free(ext->cell_data[i]);
}
}
ext->cell_data = lv_mem_realloc(ext->cell_data, ext->row_cnt * ext->col_cnt * sizeof(char *));
LV_ASSERT_MEM(ext->cell_data);
if(ext->cell_data == NULL) return;
@@ -358,7 +378,6 @@ void lv_table_set_col_cnt(lv_obj_t * table, uint16_t col_cnt)
uint32_t new_cell_cnt = ext->col_cnt * ext->row_cnt;
_lv_memset_00(&ext->cell_data[old_cell_cnt], (new_cell_cnt - old_cell_cnt) * sizeof(ext->cell_data[0]));
}
}
else {
lv_mem_free(ext->cell_data);

View File

@@ -628,7 +628,16 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
if(sign == LV_SIGNAL_CLEANUP) {
uint8_t i;
for(i = 0; ext->tab_name_ptr[i][0] != '\0' && ext->tab_name_ptr[i][0] != '\n'; i++) lv_mem_free(ext->tab_name_ptr[i]);
if(ext->btns_pos == LV_TABVIEW_TAB_POS_LEFT || ext->btns_pos == LV_TABVIEW_TAB_POS_RIGHT) {
for(i = 0; i < ext->tab_cnt; i++) {
lv_mem_free(ext->tab_name_ptr[i * 2]);
}
}
else {
for(i = 0; i < ext->tab_cnt; i++) {
lv_mem_free(ext->tab_name_ptr[i]);
}
}
lv_mem_free(ext->tab_name_ptr);
ext->tab_name_ptr = NULL;

View File

@@ -1430,6 +1430,7 @@ static lv_res_t lv_textarea_signal(lv_obj_t * ta, lv_signal_t sign, void * param
if(ext->label) {
if(ext->one_line) {
lv_style_int_t top = lv_obj_get_style_pad_top(ta, LV_TEXTAREA_PART_BG);
lv_style_int_t left = lv_obj_get_style_pad_left(ta, LV_TEXTAREA_PART_BG);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(ta, LV_TEXTAREA_PART_BG);
const lv_font_t * font = lv_obj_get_style_text_font(ta, LV_TEXTAREA_PART_BG);
@@ -1437,6 +1438,7 @@ static lv_res_t lv_textarea_signal(lv_obj_t * ta, lv_signal_t sign, void * param
lv_coord_t font_h = lv_font_get_line_height(font);
lv_obj_set_height(ext->label, font_h);
lv_obj_set_height(ta, font_h + top + bottom);
lv_obj_set_pos(lv_page_get_scrollable(ta), left, top);
}
else {
/*In not one line mode refresh the Label width because 'hpad' can modify it*/

View File

@@ -79,7 +79,9 @@ typedef struct {
enum {
LV_TEXTAREA_PART_BG = LV_PAGE_PART_BG, /**< Text area background style */
LV_TEXTAREA_PART_SCROLLBAR = LV_PAGE_PART_SCROLLBAR, /**< Scrollbar style */
#if LV_USE_ANIMATION
LV_TEXTAREA_PART_EDGE_FLASH = LV_PAGE_PART_EDGE_FLASH, /**< Edge flash style */
#endif
LV_TEXTAREA_PART_CURSOR = _LV_PAGE_PART_VIRTUAL_LAST, /**< Cursor style */
LV_TEXTAREA_PART_PLACEHOLDER, /**< Placeholder style */
_LV_TEXTAREA_PART_VIRTUAL_LAST,

View File

@@ -47,7 +47,9 @@ typedef struct {
enum {
LV_TILEVIEW_PART_BG = LV_PAGE_PART_BG,
LV_TILEVIEW_PART_SCROLLBAR = LV_PAGE_PART_SCROLLBAR,
#if LV_USE_ANIMATION
LV_TILEVIEW_PART_EDGE_FLASH = LV_PAGE_PART_EDGE_FLASH,
#endif
_LV_TILEVIEW_PART_VIRTUAL_LAST = _LV_PAGE_PART_VIRTUAL_LAST,
_LV_TILEVIEW_PART_REAL_LAST = _LV_PAGE_PART_REAL_LAST
};