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
dd6bad1b
Commit
dd6bad1b
authored
Mar 22, 2018
by
Gabor Kiss-Vamosi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix of 16 bit image draw with alpha byte
parent
0d938168
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
17 deletions
+27
-17
lv_group.c
lv_core/lv_group.c
+0
-2
lv_draw_vbasic.c
lv_draw/lv_draw_vbasic.c
+27
-15
No files found.
lv_core/lv_group.c
View file @
dd6bad1b
...
@@ -102,8 +102,6 @@ void lv_group_remove_obj(lv_obj_t * obj)
...
@@ -102,8 +102,6 @@ void lv_group_remove_obj(lv_obj_t * obj)
obj
->
group_p
=
NULL
;
obj
->
group_p
=
NULL
;
}
}
}
}
}
}
/**
/**
...
...
lv_draw/lv_draw_vbasic.c
View file @
dd6bad1b
...
@@ -167,7 +167,7 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
...
@@ -167,7 +167,7 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
}
}
/*Fill with opacity*/
/*Fill with opacity*/
else
{
else
{
/*Use hw blend if present*/
/*Use hw blend if present*/
if
(
lv_disp_is_mem_blend_supported
())
{
if
(
lv_disp_is_mem_blend_supported
())
{
if
(
color_array_tmp
[
0
].
full
!=
color
.
full
||
last_width
!=
w
)
{
if
(
color_array_tmp
[
0
].
full
!=
color
.
full
||
last_width
!=
w
)
{
uint16_t
i
;
uint16_t
i
;
...
@@ -317,7 +317,7 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
...
@@ -317,7 +317,7 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
*/
*/
void
lv_vmap
(
const
lv_area_t
*
cords_p
,
const
lv_area_t
*
mask_p
,
void
lv_vmap
(
const
lv_area_t
*
cords_p
,
const
lv_area_t
*
mask_p
,
const
uint8_t
*
map_p
,
lv_opa_t
opa
,
bool
chroma_key
,
bool
alpha_byte
,
const
uint8_t
*
map_p
,
lv_opa_t
opa
,
bool
chroma_key
,
bool
alpha_byte
,
lv_color_t
recolor
,
lv_opa_t
recolor_opa
)
lv_color_t
recolor
,
lv_opa_t
recolor_opa
)
{
{
lv_area_t
masked_a
;
lv_area_t
masked_a
;
bool
union_ok
;
bool
union_ok
;
...
@@ -384,31 +384,43 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
...
@@ -384,31 +384,43 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
for
(
row
=
masked_a
.
y1
;
row
<=
masked_a
.
y2
;
row
++
)
{
for
(
row
=
masked_a
.
y1
;
row
<=
masked_a
.
y2
;
row
++
)
{
for
(
col
=
0
;
col
<
map_useful_w
;
col
++
)
{
for
(
col
=
0
;
col
<
map_useful_w
;
col
++
)
{
lv_opa_t
opa_result
=
opa
;
lv_opa_t
opa_result
=
opa
;
lv_color_t
*
px_color
=
(
lv_color_t
*
)
&
map_p
[(
uint32_t
)
col
*
px_size_byte
];
uint8_t
*
px_color_p
=
(
uint8_t
*
)
&
map_p
[(
uint32_t
)
col
*
px_size_byte
];
lv_color_t
px_color
;
/*Handle chroma key*/
if
(
chroma_key
&&
px_color
->
full
==
chroma_key_color
.
full
)
continue
;
/*Calculate with the pixel level alpha*/
/*Calculate with the pixel level alpha*/
if
(
alpha_byte
)
{
if
(
alpha_byte
)
{
lv_opa_t
px_opa
=
(
*
(((
uint8_t
*
)
px_color
)
+
LV_IMG_PX_SIZE_ALPHA_BYTE
-
1
));
#if LV_COLOR_DEPTH == 8
px_color
.
full
=
px_color_p
[
0
];
#elif LV_COLOR_DEPTH == 16
/*Because of Alpha byte 16 bit color can start on odd address which can cause crash*/
px_color
.
full
=
px_color_p
[
0
]
+
(
px_color_p
[
1
]
<<
8
);
#elif LV_COLOR_DEPTH == 24
px_color
=
*
((
lv_color_t
*
)
px_color_p
);
#endif
lv_opa_t
px_opa
=
*
(
px_color_p
+
LV_IMG_PX_SIZE_ALPHA_BYTE
-
1
);
if
(
px_opa
==
LV_OPA_TRANSP
)
continue
;
if
(
px_opa
==
LV_OPA_TRANSP
)
continue
;
else
if
(
px_opa
!=
LV_OPA_COVER
)
opa_result
=
(
uint32_t
)((
uint32_t
)
px_opa
*
opa_result
)
>>
8
;
else
if
(
px_opa
!=
LV_OPA_COVER
)
opa_result
=
(
uint32_t
)((
uint32_t
)
px_opa
*
opa_result
)
>>
8
;
}
}
else
{
px_color
=
*
((
lv_color_t
*
)
px_color_p
);
}
/*Handle chroma key*/
if
(
chroma_key
&&
px_color
.
full
==
chroma_key_color
.
full
)
continue
;
/*Re-color the pixel if required*/
/*Re-color the pixel if required*/
if
(
recolor_opa
!=
LV_OPA_TRANSP
)
{
if
(
recolor_opa
!=
LV_OPA_TRANSP
)
{
if
(
last_img_px
.
full
!=
px_color
->
full
)
{
/*Minor acceleration: calculate only for new colors (save the last)*/
if
(
last_img_px
.
full
!=
px_color
.
full
)
{
/*Minor acceleration: calculate only for new colors (save the last)*/
last_img_px
=
*
px_color
;
last_img_px
=
px_color
;
recolored_px
=
lv_color_mix
(
recolor
,
last_img_px
,
recolor_opa
);
recolored_px
=
lv_color_mix
(
recolor
,
last_img_px
,
recolor_opa
);
}
}
if
(
opa_result
==
LV_OPA_COVER
)
vdb_buf_tmp
[
col
].
full
=
recolored_px
.
full
;
if
(
opa_result
==
LV_OPA_COVER
)
vdb_buf_tmp
[
col
].
full
=
recolored_px
.
full
;
else
vdb_buf_tmp
[
col
]
=
lv_color_mix
(
recolored_px
,
vdb_buf_tmp
[
col
],
opa_result
);
else
vdb_buf_tmp
[
col
]
=
lv_color_mix
(
recolored_px
,
vdb_buf_tmp
[
col
],
opa_result
);
}
else
{
}
else
{
if
(
opa_result
==
LV_OPA_COVER
)
vdb_buf_tmp
[
col
]
.
full
=
px_color
->
full
;
if
(
opa_result
==
LV_OPA_COVER
)
vdb_buf_tmp
[
col
]
=
px_color
;
else
vdb_buf_tmp
[
col
]
=
lv_color_mix
(
*
px_color
,
vdb_buf_tmp
[
col
],
opa_result
);
else
vdb_buf_tmp
[
col
]
=
lv_color_mix
(
px_color
,
vdb_buf_tmp
[
col
],
opa_result
);
}
}
...
@@ -441,8 +453,8 @@ static void sw_mem_blend(lv_color_t * dest, const lv_color_t * src, uint32_t len
...
@@ -441,8 +453,8 @@ static void sw_mem_blend(lv_color_t * dest, const lv_color_t * src, uint32_t len
}
else
{
}
else
{
uint32_t
col
;
uint32_t
col
;
for
(
col
=
0
;
col
<
length
;
col
++
)
{
for
(
col
=
0
;
col
<
length
;
col
++
)
{
dest
[
col
]
=
lv_color_mix
(
src
[
col
],
dest
[
col
],
opa
);
dest
[
col
]
=
lv_color_mix
(
src
[
col
],
dest
[
col
],
opa
);
}
}
}
}
}
}
...
...
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