mirror of
https://github.com/lvgl/lvgl.git
synced 2024-11-23 09:43:41 +08:00
fix(conf): Make LV_COLOR_MIX_ROUND_OFS configurable (#2766)
* fix(config): check macro equal one correctly 1.remove all tabs from lv_conf_internal_gen.py 2.make the generated code align each other Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> * fix(conf): Make LV_COLOR_MIX_ROUND_OFS configurable Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
dfb036e42c
commit
ddfdccac3c
12
Kconfig
12
Kconfig
@ -48,6 +48,18 @@ menu "LVGL configuration"
|
||||
Requires `LV_COLOR_DEPTH = 32` colors and the screen's `bg_opa` should be set to
|
||||
non LV_OPA_COVER value
|
||||
|
||||
config LV_COLOR_MIX_ROUND_OFS
|
||||
int "Adjust color mix functions rounding"
|
||||
default 128 if !LV_COLOR_DEPTH_32
|
||||
default 0 if LV_COLOR_DEPTH_32
|
||||
range 0 254
|
||||
help
|
||||
0: no adjustment, get the integer part of the result (round down)
|
||||
64: round up from x.75
|
||||
128: round up from half
|
||||
192: round up from x.25
|
||||
254: round up
|
||||
|
||||
config LV_COLOR_CHROMA_KEY_HEX
|
||||
hex "Images pixels with this color will not be drawn (if they are chroma keyed)."
|
||||
range 0x000000 0xFFFFFF
|
||||
|
@ -34,6 +34,10 @@
|
||||
*Requires `LV_COLOR_DEPTH = 32` colors and the screen's `bg_opa` should be set to non LV_OPA_COVER value*/
|
||||
#define LV_COLOR_SCREEN_TRANSP 0
|
||||
|
||||
/* Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently.
|
||||
* 0: round down, 64: round up from x.75, 128: round up from half, 192: round up from x.25, 254: round up */
|
||||
#define LV_COLOR_MIX_ROUND_OFS (LV_COLOR_DEPTH == 32 ? 0: 128)
|
||||
|
||||
/*Images pixels with this color will not be drawn if they are chroma keyed)*/
|
||||
#define LV_COLOR_CHROMA_KEY lv_color_hex(0x00ff00) /*pure green*/
|
||||
|
||||
|
@ -59,7 +59,7 @@ fout.write(
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LV_COLOR_DEPTH
|
||||
#ifdef CONFIG_LV_COLOR_DEPTH
|
||||
# define _LV_KCONFIG_PRESENT
|
||||
#endif
|
||||
|
||||
@ -88,44 +88,44 @@ for line in fin.read().splitlines():
|
||||
name = r[1]
|
||||
name = re.sub('\(.*?\)', '', name, 1) #remove parentheses from macros. E.g. MY_FUNC(5) -> MY_FUNC
|
||||
|
||||
name_and_value = re.sub('.*# *define', '', line, 1)
|
||||
|
||||
#If the value should be 1 (enabled) by default use a more complex structure for Kconfig checks because
|
||||
#if a not defined CONFIG_... value should be interpreted as 0 and not the LVGL default
|
||||
is_one = re.search(r'.*#.*define +[A-Z0-9_]+ +1[^0-9]*', line)
|
||||
name_and_value = re.sub('[\s]*#[\s]*define', '', line, 1)
|
||||
|
||||
#If the value should be 1 (enabled) by default use a more complex structure for Kconfig checks because
|
||||
#if a not defined CONFIG_... value should be interpreted as 0 and not the LVGL default
|
||||
is_one = re.search(r'[\s]*#[\s]*define[\s]*[A-Z0-9_]+[\s]+1[\s]*$', line)
|
||||
if(is_one):
|
||||
#1. Use the value if already set from lv_conf.h or anything else (i.e. do nothing)
|
||||
#2. In Kconfig environment use the CONFIG_... value if set, else use 0
|
||||
#3. In not Kconfig environment use the LVGL's default value
|
||||
|
||||
|
||||
fout.write(
|
||||
f'#ifndef {name}\n'
|
||||
f'# ifdef _LV_KCONFIG_PRESENT\n'
|
||||
f'# ifdef CONFIG_{name.upper()}\n'
|
||||
f'# define {name} CONFIG_{name.upper()}\n'
|
||||
f'# else\n'
|
||||
f'# define {name} 0\n'
|
||||
f'# endif\n'
|
||||
f'# else\n'
|
||||
f'# define {name_and_value}\n'
|
||||
f'# endif\n'
|
||||
f'#endif\n'
|
||||
)
|
||||
f'#ifndef {name}\n'
|
||||
f'# ifdef _LV_KCONFIG_PRESENT\n'
|
||||
f'# ifdef CONFIG_{name.upper()}\n'
|
||||
f'# define {name} CONFIG_{name.upper()}\n'
|
||||
f'# else\n'
|
||||
f'# define {name} 0\n'
|
||||
f'# endif\n'
|
||||
f'# else\n'
|
||||
f'# define{name_and_value}\n'
|
||||
f'# endif\n'
|
||||
f'#endif\n'
|
||||
)
|
||||
else:
|
||||
#1. Use the value if already set from lv_conf.h or anything else (i.e. do nothing)
|
||||
#2. Use the Kconfig value if set
|
||||
#3. Use the LVGL's default value
|
||||
|
||||
|
||||
fout.write(
|
||||
f'#ifndef {name}\n'
|
||||
f'# ifdef CONFIG_{name.upper()}\n'
|
||||
f'# define {name} CONFIG_{name.upper()}\n'
|
||||
f'# else\n'
|
||||
f'# define {name_and_value}\n'
|
||||
f'# endif\n'
|
||||
f'#endif\n'
|
||||
)
|
||||
|
||||
f'#ifndef {name}\n'
|
||||
f'# ifdef CONFIG_{name.upper()}\n'
|
||||
f'# define {name} CONFIG_{name.upper()}\n'
|
||||
f'# else\n'
|
||||
f'# define{name_and_value}\n'
|
||||
f'# endif\n'
|
||||
f'#endif\n'
|
||||
)
|
||||
|
||||
elif re.search('^ *typedef .*;.*$', line):
|
||||
continue #ignore typedefs to avoide redeclaration
|
||||
else:
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -73,23 +73,6 @@ enum {
|
||||
#error "Invalid LV_COLOR_DEPTH in lv_conf.h! Set it to 1, 8, 16 or 32!"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Adjust color mix functions rounding.
|
||||
* GPUs might calculate color mix (blending) differently.
|
||||
* Should be in range of 0..254
|
||||
* 0: no adjustment, get the integer part of the result (round down)
|
||||
* 64: round up from x.75
|
||||
* 128: round up from half
|
||||
* 192: round up from x.25
|
||||
* 254: round up*/
|
||||
#ifndef LV_COLOR_MIX_ROUND_OFS
|
||||
#if LV_COLOR_DEPTH == 32
|
||||
#define LV_COLOR_MIX_ROUND_OFS 0
|
||||
#else
|
||||
#define LV_COLOR_MIX_ROUND_OFS 128
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) && !defined(_LV_COLOR_HAS_MODERN_CPP)
|
||||
/**
|
||||
* MSVC compiler's definition of the __cplusplus indicating 199711L regardless to C++ standard version
|
||||
|
Loading…
Reference in New Issue
Block a user