BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lvgl
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
lvgl
Commits
1dc04388
Commit
1dc04388
authored
Jan 10, 2017
by
Kiss-Vamosi Gabor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lv_gauge: updated, math_base: min max rename
parent
f85741be
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
58 additions
and
43 deletions
+58
-43
lv_draw.c
lv_draw/lv_draw.c
+16
-16
area.c
lv_misc/area.c
+8
-8
text.c
lv_misc/text.c
+1
-1
lv_gauge.c
lv_objx/lv_gauge.c
+0
-0
lv_gauge.h
lv_objx/lv_gauge.h
+21
-7
lv_img.c
lv_objx/lv_img.c
+1
-0
lv_line.c
lv_objx/lv_line.c
+2
-2
lv_page.c
lv_objx/lv_page.c
+4
-4
lv_rect.c
lv_objx/lv_rect.c
+5
-5
No files found.
lv_draw/lv_draw.c
View file @
1dc04388
...
@@ -322,10 +322,10 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
...
@@ -322,10 +322,10 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
last_y
=
act_point
.
y
;
last_y
=
act_point
.
y
;
last_x
=
act_point
.
x
;
last_x
=
act_point
.
x
;
draw_area
.
x1
=
min
(
act_area
.
x1
,
act_area
.
x2
);
draw_area
.
x1
=
MATH_MIN
(
act_area
.
x1
,
act_area
.
x2
);
draw_area
.
x2
=
max
(
act_area
.
x1
,
act_area
.
x2
);
draw_area
.
x2
=
MATH_MAX
(
act_area
.
x1
,
act_area
.
x2
);
draw_area
.
y1
=
min
(
act_area
.
y1
,
act_area
.
y2
);
draw_area
.
y1
=
MATH_MIN
(
act_area
.
y1
,
act_area
.
y2
);
draw_area
.
y2
=
max
(
act_area
.
y1
,
act_area
.
y2
);
draw_area
.
y2
=
MATH_MAX
(
act_area
.
y1
,
act_area
.
y2
);
fill_fp
(
&
draw_area
,
mask_p
,
lines_p
->
objs
.
color
,
opa
);
fill_fp
(
&
draw_area
,
mask_p
,
lines_p
->
objs
.
color
,
opa
);
}
}
if
(
hor
==
false
&&
last_x
!=
act_point
.
x
)
{
if
(
hor
==
false
&&
last_x
!=
act_point
.
x
)
{
...
@@ -338,10 +338,10 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
...
@@ -338,10 +338,10 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
last_y
=
act_point
.
y
;
last_y
=
act_point
.
y
;
last_x
=
act_point
.
x
;
last_x
=
act_point
.
x
;
draw_area
.
x1
=
min
(
act_area
.
x1
,
act_area
.
x2
);
draw_area
.
x1
=
MATH_MIN
(
act_area
.
x1
,
act_area
.
x2
);
draw_area
.
x2
=
max
(
act_area
.
x1
,
act_area
.
x2
);
draw_area
.
x2
=
MATH_MAX
(
act_area
.
x1
,
act_area
.
x2
);
draw_area
.
y1
=
min
(
act_area
.
y1
,
act_area
.
y2
);
draw_area
.
y1
=
MATH_MIN
(
act_area
.
y1
,
act_area
.
y2
);
draw_area
.
y2
=
max
(
act_area
.
y1
,
act_area
.
y2
);
draw_area
.
y2
=
MATH_MAX
(
act_area
.
y1
,
act_area
.
y2
);
fill_fp
(
&
draw_area
,
mask_p
,
lines_p
->
objs
.
color
,
opa
);
fill_fp
(
&
draw_area
,
mask_p
,
lines_p
->
objs
.
color
,
opa
);
}
}
...
@@ -366,10 +366,10 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
...
@@ -366,10 +366,10 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
act_area
.
y1
=
last_y
-
width_half
;
act_area
.
y1
=
last_y
-
width_half
;
act_area
.
y2
=
act_point
.
y
+
width_half
+
width_1
;
act_area
.
y2
=
act_point
.
y
+
width_half
+
width_1
;
draw_area
.
x1
=
min
(
act_area
.
x1
,
act_area
.
x2
);
draw_area
.
x1
=
MATH_MIN
(
act_area
.
x1
,
act_area
.
x2
);
draw_area
.
x2
=
max
(
act_area
.
x1
,
act_area
.
x2
);
draw_area
.
x2
=
MATH_MAX
(
act_area
.
x1
,
act_area
.
x2
);
draw_area
.
y1
=
min
(
act_area
.
y1
,
act_area
.
y2
);
draw_area
.
y1
=
MATH_MIN
(
act_area
.
y1
,
act_area
.
y2
);
draw_area
.
y2
=
max
(
act_area
.
y1
,
act_area
.
y2
);
draw_area
.
y2
=
MATH_MAX
(
act_area
.
y1
,
act_area
.
y2
);
fill_fp
(
&
draw_area
,
mask_p
,
lines_p
->
objs
.
color
,
opa
);
fill_fp
(
&
draw_area
,
mask_p
,
lines_p
->
objs
.
color
,
opa
);
}
}
if
(
hor
==
false
)
{
if
(
hor
==
false
)
{
...
@@ -380,10 +380,10 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
...
@@ -380,10 +380,10 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
act_area
.
y1
=
last_y
;
act_area
.
y1
=
last_y
;
act_area
.
y2
=
act_point
.
y
;
act_area
.
y2
=
act_point
.
y
;
draw_area
.
x1
=
min
(
act_area
.
x1
,
act_area
.
x2
);
draw_area
.
x1
=
MATH_MIN
(
act_area
.
x1
,
act_area
.
x2
);
draw_area
.
x2
=
max
(
act_area
.
x1
,
act_area
.
x2
);
draw_area
.
x2
=
MATH_MAX
(
act_area
.
x1
,
act_area
.
x2
);
draw_area
.
y1
=
min
(
act_area
.
y1
,
act_area
.
y2
);
draw_area
.
y1
=
MATH_MIN
(
act_area
.
y1
,
act_area
.
y2
);
draw_area
.
y2
=
max
(
act_area
.
y1
,
act_area
.
y2
);
draw_area
.
y2
=
MATH_MAX
(
act_area
.
y1
,
act_area
.
y2
);
fill_fp
(
&
draw_area
,
mask_p
,
lines_p
->
objs
.
color
,
opa
);
fill_fp
(
&
draw_area
,
mask_p
,
lines_p
->
objs
.
color
,
opa
);
}
}
}
}
...
...
lv_misc/area.c
View file @
1dc04388
...
@@ -94,10 +94,10 @@ uint32_t area_get_size(const area_t * area_p)
...
@@ -94,10 +94,10 @@ uint32_t area_get_size(const area_t * area_p)
bool
area_union
(
area_t
*
res_p
,
const
area_t
*
a1_p
,
const
area_t
*
a2_p
)
bool
area_union
(
area_t
*
res_p
,
const
area_t
*
a1_p
,
const
area_t
*
a2_p
)
{
{
/* Get the smaller area from 'a1_p' and 'a2_p' */
/* Get the smaller area from 'a1_p' and 'a2_p' */
res_p
->
x1
=
max
(
a1_p
->
x1
,
a2_p
->
x1
);
res_p
->
x1
=
MATH_MAX
(
a1_p
->
x1
,
a2_p
->
x1
);
res_p
->
y1
=
max
(
a1_p
->
y1
,
a2_p
->
y1
);
res_p
->
y1
=
MATH_MAX
(
a1_p
->
y1
,
a2_p
->
y1
);
res_p
->
x2
=
min
(
a1_p
->
x2
,
a2_p
->
x2
);
res_p
->
x2
=
MATH_MIN
(
a1_p
->
x2
,
a2_p
->
x2
);
res_p
->
y2
=
min
(
a1_p
->
y2
,
a2_p
->
y2
);
res_p
->
y2
=
MATH_MIN
(
a1_p
->
y2
,
a2_p
->
y2
);
/*If x1 or y1 greater then x2 or y2 then the areas union is empty*/
/*If x1 or y1 greater then x2 or y2 then the areas union is empty*/
bool
union_ok
=
true
;
bool
union_ok
=
true
;
...
@@ -117,10 +117,10 @@ bool area_union(area_t * res_p, const area_t * a1_p, const area_t * a2_p)
...
@@ -117,10 +117,10 @@ bool area_union(area_t * res_p, const area_t * a1_p, const area_t * a2_p)
*/
*/
void
area_join
(
area_t
*
a_res_p
,
const
area_t
*
a1_p
,
const
area_t
*
a2_p
)
void
area_join
(
area_t
*
a_res_p
,
const
area_t
*
a1_p
,
const
area_t
*
a2_p
)
{
{
a_res_p
->
x1
=
min
(
a1_p
->
x1
,
a2_p
->
x1
);
a_res_p
->
x1
=
MATH_MIN
(
a1_p
->
x1
,
a2_p
->
x1
);
a_res_p
->
y1
=
min
(
a1_p
->
y1
,
a2_p
->
y1
);
a_res_p
->
y1
=
MATH_MIN
(
a1_p
->
y1
,
a2_p
->
y1
);
a_res_p
->
x2
=
max
(
a1_p
->
x2
,
a2_p
->
x2
);
a_res_p
->
x2
=
MATH_MAX
(
a1_p
->
x2
,
a2_p
->
x2
);
a_res_p
->
y2
=
max
(
a1_p
->
y2
,
a2_p
->
y2
);
a_res_p
->
y2
=
MATH_MAX
(
a1_p
->
y2
,
a2_p
->
y2
);
}
}
/**
/**
...
...
lv_misc/text.c
View file @
1dc04388
...
@@ -56,7 +56,7 @@ void txt_get_size(point_t * size_res, const char * text, const font_t * font,
...
@@ -56,7 +56,7 @@ void txt_get_size(point_t * size_res, const char * text, const font_t * font,
act_line_length
=
txt_get_width
(
&
text
[
line_start
],
new_line_start
-
line_start
,
act_line_length
=
txt_get_width
(
&
text
[
line_start
],
new_line_start
-
line_start
,
font
,
letter_space
);
font
,
letter_space
);
size_res
->
x
=
max
(
act_line_length
,
size_res
->
x
);
size_res
->
x
=
MATH_MAX
(
act_line_length
,
size_res
->
x
);
line_start
=
new_line_start
;
line_start
=
new_line_start
;
}
}
...
...
lv_objx/lv_gauge.c
View file @
1dc04388
This diff is collapsed.
Click to expand it.
lv_objx/lv_gauge.h
View file @
1dc04388
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
/*********************
/*********************
* DEFINES
* DEFINES
*********************/
*********************/
#define LV_GAUGE_MAX_NEEDLE 4
/*Max number of needles. Used in the style.*/
/**********************
/**********************
* TYPEDEFS
* TYPEDEFS
...
@@ -37,11 +38,19 @@ typedef struct
...
@@ -37,11 +38,19 @@ typedef struct
{
{
lv_rects_t
rects
;
/*Style of ancestor*/
lv_rects_t
rects
;
/*Style of ancestor*/
/*New style element for this type */
/*New style element for this type */
lv_labels_t
scale_labels
;
color_t
mcolor_max
;
/*Top color at max.*/
lv_lines_t
needle_lines
;
color_t
gcolor_max
;
/*Bootom color at max*/
cord_t
label_pad
;
/*Scale settings*/
uint16_t
angle
;
uint16_t
scale_angle
;
/*Angle of the scale in deg. (~220)*/
uint8_t
label_num
;
lv_labels_t
scale_labels
;
/*Style of the labels*/
cord_t
scale_pad
;
/*Padding of scale labels from the edge*/
uint8_t
scale_label_num
;
/*Number of scale labels (~6)*/
/*Needle settings*/
lv_lines_t
needle_lines
;
/*Style of neddles*/
color_t
needle_color
[
LV_GAUGE_MAX_NEEDLE
];
/*Color of needles*/
color_t
needle_mid_color
;
/*Color of middle where the needles start*/
cord_t
needle_mid_r
;
/*Radius of the needle middle area*/
opa_t
needle_opa
;
/*Opacity of the needles*/
}
lv_gauges_t
;
}
lv_gauges_t
;
/*Built-in styles of gauge*/
/*Built-in styles of gauge*/
...
@@ -57,7 +66,8 @@ typedef struct
...
@@ -57,7 +66,8 @@ typedef struct
/*New data for this type */
/*New data for this type */
int16_t
min
;
int16_t
min
;
int16_t
max
;
int16_t
max
;
int16_t
value
;
int16_t
*
values
;
uint8_t
needle_num
;
}
lv_gauge_ext_t
;
}
lv_gauge_ext_t
;
/**********************
/**********************
...
@@ -67,7 +77,11 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy);
...
@@ -67,7 +77,11 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy);
bool
lv_gauge_signal
(
lv_obj_t
*
gauge
,
lv_signal_t
sign
,
void
*
param
);
bool
lv_gauge_signal
(
lv_obj_t
*
gauge
,
lv_signal_t
sign
,
void
*
param
);
lv_gauges_t
*
lv_gauges_get
(
lv_gauges_builtin_t
style
,
lv_gauges_t
*
copy
);
lv_gauges_t
*
lv_gauges_get
(
lv_gauges_builtin_t
style
,
lv_gauges_t
*
copy
);
void
lv_gauge_set_value
(
lv_obj_t
*
gauge
,
int16_t
value
);
void
lv_gauge_set_value
(
lv_obj_t
*
gauge
,
int16_t
value
,
uint8_t
needle
);
void
lv_gauge_set_needle_num
(
lv_obj_t
*
gauge
,
uint8_t
num
);
uint8_t
lv_gauge_get_needle_num
(
lv_obj_t
*
gauge
);
int16_t
lv_gauge_get_value
(
lv_obj_t
*
gauge
,
uint8_t
needle
);
/**********************
/**********************
* MACROS
* MACROS
...
...
lv_objx/lv_img.c
View file @
1dc04388
...
@@ -311,6 +311,7 @@ static bool lv_img_design(lv_obj_t * img, const area_t * mask, lv_design_mode_t
...
@@ -311,6 +311,7 @@ static bool lv_img_design(lv_obj_t * img, const area_t * mask, lv_design_mode_t
}
}
else
return
false
;
else
return
false
;
}
else
if
(
mode
==
LV_DESIGN_DRAW_MAIN
)
{
}
else
if
(
mode
==
LV_DESIGN_DRAW_MAIN
)
{
if
(
ext
->
h
==
0
||
ext
->
w
==
0
)
return
true
;
area_t
cords
;
area_t
cords
;
lv_obj_get_cords
(
img
,
&
cords
);
lv_obj_get_cords
(
img
,
&
cords
);
...
...
lv_objx/lv_line.c
View file @
1dc04388
...
@@ -145,8 +145,8 @@ void lv_line_set_points(lv_obj_t * line, const point_t * point_a, uint16_t point
...
@@ -145,8 +145,8 @@ void lv_line_set_points(lv_obj_t * line, const point_t * point_a, uint16_t point
cord_t
xmax
=
LV_CORD_MIN
;
cord_t
xmax
=
LV_CORD_MIN
;
cord_t
ymax
=
LV_CORD_MIN
;
cord_t
ymax
=
LV_CORD_MIN
;
for
(
i
=
0
;
i
<
point_num
;
i
++
)
{
for
(
i
=
0
;
i
<
point_num
;
i
++
)
{
xmax
=
max
(
point_a
[
i
].
x
*
us
,
xmax
);
xmax
=
MATH_MAX
(
point_a
[
i
].
x
*
us
,
xmax
);
ymax
=
max
(
point_a
[
i
].
y
*
us
,
ymax
);
ymax
=
MATH_MAX
(
point_a
[
i
].
y
*
us
,
ymax
);
}
}
lv_lines_t
*
lines
=
lv_obj_get_style
(
line
);
lv_lines_t
*
lines
=
lv_obj_get_style
(
line
);
...
...
lv_objx/lv_page.c
View file @
1dc04388
...
@@ -277,8 +277,8 @@ static bool lv_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void* param)
...
@@ -277,8 +277,8 @@ static bool lv_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void* param)
case
LV_SIGNAL_DRAG_BEGIN
:
case
LV_SIGNAL_DRAG_BEGIN
:
if
(
style
->
sb_mode
==
LV_PAGE_SB_MODE_DRAG
)
{
if
(
style
->
sb_mode
==
LV_PAGE_SB_MODE_DRAG
)
{
cord_t
sbh_pad
=
max
(
style
->
sb_width
,
style
->
bg_rects
.
hpad
);
cord_t
sbh_pad
=
MATH_MAX
(
style
->
sb_width
,
style
->
bg_rects
.
hpad
);
cord_t
sbv_pad
=
max
(
style
->
sb_width
,
style
->
bg_rects
.
vpad
);
cord_t
sbv_pad
=
MATH_MAX
(
style
->
sb_width
,
style
->
bg_rects
.
vpad
);
if
(
area_get_height
(
&
page_ext
->
sbv
)
<
lv_obj_get_height
(
scrl
)
-
2
*
sbv_pad
)
{
if
(
area_get_height
(
&
page_ext
->
sbv
)
<
lv_obj_get_height
(
scrl
)
-
2
*
sbv_pad
)
{
page_ext
->
sbv_draw
=
1
;
page_ext
->
sbv_draw
=
1
;
}
}
...
@@ -565,8 +565,8 @@ static void lv_page_sb_refresh(lv_obj_t * page)
...
@@ -565,8 +565,8 @@ static void lv_page_sb_refresh(lv_obj_t * page)
cord_t
vpad
=
style
->
bg_rects
.
vpad
;
cord_t
vpad
=
style
->
bg_rects
.
vpad
;
cord_t
obj_w
=
lv_obj_get_width
(
page
);
cord_t
obj_w
=
lv_obj_get_width
(
page
);
cord_t
obj_h
=
lv_obj_get_height
(
page
);
cord_t
obj_h
=
lv_obj_get_height
(
page
);
cord_t
sbh_pad
=
max
(
style
->
sb_width
,
style
->
bg_rects
.
hpad
);
cord_t
sbh_pad
=
MATH_MAX
(
style
->
sb_width
,
style
->
bg_rects
.
hpad
);
cord_t
sbv_pad
=
max
(
style
->
sb_width
,
style
->
bg_rects
.
vpad
);
cord_t
sbv_pad
=
MATH_MAX
(
style
->
sb_width
,
style
->
bg_rects
.
vpad
);
if
(
style
->
sb_mode
==
LV_PAGE_SB_MODE_OFF
)
return
;
if
(
style
->
sb_mode
==
LV_PAGE_SB_MODE_OFF
)
return
;
...
...
lv_objx/lv_rect.c
View file @
1dc04388
...
@@ -563,7 +563,7 @@ static void lv_rect_layout_pretty(lv_obj_t * rect)
...
@@ -563,7 +563,7 @@ static void lv_rect_layout_pretty(lv_obj_t * rect)
lv_obj_is_protected
(
child_rc
,
LV_PROTECT_POS
)
==
false
)
{
lv_obj_is_protected
(
child_rc
,
LV_PROTECT_POS
)
==
false
)
{
if
(
w_row
+
lv_obj_get_width
(
child_rc
)
>
w_obj
)
break
;
/*If the next object is already not fit then break*/
if
(
w_row
+
lv_obj_get_width
(
child_rc
)
>
w_obj
)
break
;
/*If the next object is already not fit then break*/
w_row
+=
lv_obj_get_width
(
child_rc
)
+
style
->
opad
;
/*Add the object width + opad*/
w_row
+=
lv_obj_get_width
(
child_rc
)
+
style
->
opad
;
/*Add the object width + opad*/
h_row
=
max
(
h_row
,
lv_obj_get_height
(
child_rc
));
/*Search the highest object*/
h_row
=
MATH_MAX
(
h_row
,
lv_obj_get_height
(
child_rc
));
/*Search the highest object*/
obj_num
++
;
obj_num
++
;
}
}
child_rc
=
ll_get_prev
(
&
rect
->
child_ll
,
child_rc
);
/*Load the next object*/
child_rc
=
ll_get_prev
(
&
rect
->
child_ll
,
child_rc
);
/*Load the next object*/
...
@@ -690,10 +690,10 @@ void lv_rect_refr_autofit(lv_obj_t * rect)
...
@@ -690,10 +690,10 @@ void lv_rect_refr_autofit(lv_obj_t * rect)
LL_READ
(
rect
->
child_ll
,
i
)
{
LL_READ
(
rect
->
child_ll
,
i
)
{
if
(
lv_obj_get_hidden
(
i
)
!=
false
)
continue
;
if
(
lv_obj_get_hidden
(
i
)
!=
false
)
continue
;
new_cords
.
x1
=
min
(
new_cords
.
x1
,
i
->
cords
.
x1
);
new_cords
.
x1
=
MATH_MIN
(
new_cords
.
x1
,
i
->
cords
.
x1
);
new_cords
.
y1
=
min
(
new_cords
.
y1
,
i
->
cords
.
y1
);
new_cords
.
y1
=
MATH_MIN
(
new_cords
.
y1
,
i
->
cords
.
y1
);
new_cords
.
x2
=
max
(
new_cords
.
x2
,
i
->
cords
.
x2
);
new_cords
.
x2
=
MATH_MAX
(
new_cords
.
x2
,
i
->
cords
.
x2
);
new_cords
.
y2
=
max
(
new_cords
.
y2
,
i
->
cords
.
y2
);
new_cords
.
y2
=
MATH_MAX
(
new_cords
.
y2
,
i
->
cords
.
y2
);
}
}
/*If the value is not the init value then the page has >=1 child.*/
/*If the value is not the init value then the page has >=1 child.*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment