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
64b5010b
Commit
64b5010b
authored
Jan 19, 2018
by
Gabor Kiss-Vamosi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change 0b.. number to 0x... and add big endian support to LV_COLOR_MAKE
parent
6f43efde
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
31 deletions
+45
-31
lv_color.h
lv_misc/lv_color.h
+20
-6
lv_ll.c
lv_misc/lv_ll.c
+2
-2
lv_txt.c
lv_misc/lv_txt.c
+23
-23
No files found.
lv_misc/lv_color.h
View file @
64b5010b
...
...
@@ -147,17 +147,17 @@ static inline uint8_t lv_color_to1(lv_color_t color)
#if LV_COLOR_DEPTH == 1
return
color
.
full
;
#elif LV_COLOR_DEPTH == 8
if
((
color
.
red
&
0
b100
)
||
(
color
.
green
&
0
b100
)
||
(
color
.
blue
&
0
b10
))
{
if
((
color
.
red
&
0
x4
)
||
(
color
.
green
&
0
x4
)
||
(
color
.
blue
&
0
x2
))
{
return
1
;
}
else
{
return
0
;
}
#elif LV_COLOR_DEPTH == 16
if
((
color
.
red
&
0
b1000
0
)
||
(
color
.
green
&
0
b10000
0
)
||
(
color
.
blue
&
0
b1000
0
))
{
if
((
color
.
red
&
0
x1
0
)
||
(
color
.
green
&
0
x2
0
)
||
(
color
.
blue
&
0
x1
0
))
{
return
1
;
}
else
{
return
0
;
...
...
@@ -261,6 +261,9 @@ static inline uint8_t lv_color_brightness(lv_color_t color)
return
(
uint16_t
)
bright
>>
3
;
}
/* The most simple macro to create a color from R,G and B values
* The order of bit field is different on Big-endian and Little-endian machines*/
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#if LV_COLOR_DEPTH == 1
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){(b8 >> 7 | g8 >> 7 | r8 >> 7)})
#elif LV_COLOR_DEPTH == 8
...
...
@@ -270,6 +273,17 @@ static inline uint8_t lv_color_brightness(lv_color_t color)
#elif LV_COLOR_DEPTH == 24
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8, g8, r8}})
#endif
#else
#if LV_COLOR_DEPTH == 1
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){(r8 >> 7 | g8 >> 7 | b8 >> 7)})
#elif LV_COLOR_DEPTH == 8
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{r8 >> 6, g8 >> 5, b8 >> 5}})
#elif LV_COLOR_DEPTH == 16
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{r8 >> 3, g8 >> 2, b8 >> 3}})
#elif LV_COLOR_DEPTH == 24
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{r8, g8, b8}})
#endif
#endif
#define LV_COLOR_HEX(c) LV_COLOR_MAKE(((uint32_t)((uint32_t)c >> 16) & 0xFF), \
((uint32_t)((uint32_t)c >> 8) & 0xFF), \
...
...
lv_misc/lv_ll.c
View file @
64b5010b
...
...
@@ -52,8 +52,8 @@ void lv_ll_init(lv_ll_t * ll_p, uint32_t n_size)
ll_p
->
head
=
NULL
;
ll_p
->
tail
=
NULL
;
if
(
n_size
&
0
b11
)
{
n_size
&=
~
0
b11
;
if
(
n_size
&
0
x3
)
{
/*Round up to 4*/
n_size
&=
~
0
x3
;
n_size
+=
4
;
}
...
...
lv_misc/lv_txt.c
View file @
64b5010b
...
...
@@ -302,10 +302,10 @@ void lv_txt_cut(char * txt, uint32_t pos, uint32_t len)
*/
uint8_t
lv_txt_utf8_size
(
uint8_t
c
)
{
if
((
c
&
0
b1000000
0
)
==
0
)
return
1
;
else
if
((
c
&
0
b11100000
)
==
0
b1100000
0
)
return
2
;
else
if
((
c
&
0
b11110000
)
==
0
b1110000
0
)
return
3
;
else
if
((
c
&
0
b11111000
)
==
0
b1111000
0
)
return
4
;
if
((
c
&
0
x8
0
)
==
0
)
return
1
;
else
if
((
c
&
0
xE0
)
==
0xC
0
)
return
2
;
else
if
((
c
&
0
xF0
)
==
0xE
0
)
return
3
;
else
if
((
c
&
0
xF1
)
==
0xF
0
)
return
4
;
return
0
;
}
...
...
@@ -381,41 +381,41 @@ uint32_t lv_txt_utf8_next(const char * txt, uint32_t * i)
/*Real UTF-8 decode*/
else
{
/*2 bytes UTF-8 code*/
if
((
txt
[
*
i
]
&
0
b11100000
)
==
0
b1100000
0
)
{
result
=
(
uint32_t
)(
txt
[
*
i
]
&
0
b00011111
)
<<
6
;
if
((
txt
[
*
i
]
&
0
xE0
)
==
0xC
0
)
{
result
=
(
uint32_t
)(
txt
[
*
i
]
&
0
x1F
)
<<
6
;
(
*
i
)
++
;
if
((
txt
[
*
i
]
&
0
b11000000
)
!=
0
b1000000
0
)
return
0
;
/*Invalid UTF-8 code*/
result
+=
(
txt
[
*
i
]
&
0
b00111111
);
if
((
txt
[
*
i
]
&
0
xC0
)
!=
0x8
0
)
return
0
;
/*Invalid UTF-8 code*/
result
+=
(
txt
[
*
i
]
&
0
x3F
);
(
*
i
)
++
;
}
/*3 bytes UTF-8 code*/
else
if
((
txt
[
*
i
]
&
0
b11110000
)
==
0
b1110000
0
)
{
result
=
(
uint32_t
)(
txt
[
*
i
]
&
0
b00001111
)
<<
12
;
else
if
((
txt
[
*
i
]
&
0
xF0
)
==
0xE
0
)
{
result
=
(
uint32_t
)(
txt
[
*
i
]
&
0
x0F
)
<<
12
;
(
*
i
)
++
;
if
((
txt
[
*
i
]
&
0
b11000000
)
!=
0
b1000000
0
)
return
0
;
/*Invalid UTF-8 code*/
result
+=
(
uint32_t
)(
txt
[
*
i
]
&
0
b00111111
)
<<
6
;
if
((
txt
[
*
i
]
&
0
xC0
)
!=
0x8
0
)
return
0
;
/*Invalid UTF-8 code*/
result
+=
(
uint32_t
)(
txt
[
*
i
]
&
0
x3F
)
<<
6
;
(
*
i
)
++
;
if
((
txt
[
*
i
]
&
0
b11000000
)
!=
0
b1000000
0
)
return
0
;
/*Invalid UTF-8 code*/
result
+=
(
txt
[
*
i
]
&
0
b00111111
);
if
((
txt
[
*
i
]
&
0
xC0
)
!=
0x8
0
)
return
0
;
/*Invalid UTF-8 code*/
result
+=
(
txt
[
*
i
]
&
0
x3F
);
(
*
i
)
++
;
}
/*
3
bytes UTF-8 code*/
else
if
((
txt
[
*
i
]
&
0
b11111000
)
==
0
b1111000
0
)
{
result
=
(
uint32_t
)(
txt
[
*
i
]
&
0
b00001111
)
<<
18
;
/*
4
bytes UTF-8 code*/
else
if
((
txt
[
*
i
]
&
0
xF8
)
==
0xF
0
)
{
result
=
(
uint32_t
)(
txt
[
*
i
]
&
0
x07
)
<<
18
;
(
*
i
)
++
;
if
((
txt
[
*
i
]
&
0
b11000000
)
!=
0
b1000000
0
)
return
0
;
/*Invalid UTF-8 code*/
result
+=
(
uint32_t
)(
txt
[
*
i
]
&
0
b00111111
)
<<
12
;
if
((
txt
[
*
i
]
&
0
xC0
)
!=
0x8
0
)
return
0
;
/*Invalid UTF-8 code*/
result
+=
(
uint32_t
)(
txt
[
*
i
]
&
0
x3F
)
<<
12
;
(
*
i
)
++
;
if
((
txt
[
*
i
]
&
0
b11000000
)
!=
0
b1000000
0
)
return
0
;
/*Invalid UTF-8 code*/
result
+=
(
uint32_t
)(
txt
[
*
i
]
&
0
b00111111
)
<<
6
;
if
((
txt
[
*
i
]
&
0
xC0
)
!=
0x8
0
)
return
0
;
/*Invalid UTF-8 code*/
result
+=
(
uint32_t
)(
txt
[
*
i
]
&
0
x3F
)
<<
6
;
(
*
i
)
++
;
if
((
txt
[
*
i
]
&
0
b11000000
)
!=
0
b1000000
0
)
return
0
;
/*Invalid UTF-8 code*/
result
+=
(
uint32_t
)(
txt
[
*
i
]
&
0
b00111111
)
<<
6
;
if
((
txt
[
*
i
]
&
0
xC0
)
!=
0x8
0
)
return
0
;
/*Invalid UTF-8 code*/
result
+=
(
uint32_t
)(
txt
[
*
i
]
&
0
x3F
)
<<
6
;
(
*
i
)
++
;
}
else
{
(
*
i
)
++
;
/*Not UTF-8 char. Go the next.*/
...
...
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