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
ee3a4438
Commit
ee3a4438
authored
May 08, 2018
by
Gabor Kiss-Vamosi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lv_draw: shadow draw fix array over indexing
parent
51e15ced
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
lv_draw.c
lv_draw/lv_draw.c
+12
-5
No files found.
lv_draw/lv_draw.c
View file @
ee3a4438
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
#define LABEL_RECOLOR_PAR_LENGTH 6
#define LABEL_RECOLOR_PAR_LENGTH 6
#define SHADOW_OPA_EXTRA_PRECISION
8
/*Calculate with 2^x bigger shadow opacity values to avoid rounding errors*/
#define SHADOW_OPA_EXTRA_PRECISION
0
/*Calculate with 2^x bigger shadow opacity values to avoid rounding errors*/
#define SHADOW_BOTTOM_AA_EXTRA_RADIUS 3
/*Add extra radius with LV_SHADOW_BOTTOM to cover anti-aliased corners*/
#define SHADOW_BOTTOM_AA_EXTRA_RADIUS 3
/*Add extra radius with LV_SHADOW_BOTTOM to cover anti-aliased corners*/
/**********************
/**********************
* TYPEDEFS
* TYPEDEFS
...
@@ -1789,7 +1789,7 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
...
@@ -1789,7 +1789,7 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
bool
line_ready
;
bool
line_ready
;
for
(
line
=
1
;
line
<=
radius
+
swidth
;
line
++
)
{
/*Check all rows and make the 1D blur to 2D*/
for
(
line
=
1
;
line
<=
radius
+
swidth
;
line
++
)
{
/*Check all rows and make the 1D blur to 2D*/
line_ready
=
false
;
line_ready
=
false
;
for
(
col
=
1
;
col
<
radius
+
swidth
+
10
;
col
++
)
{
/*Check all pixels in a 1D blur line (from the origo to last shadow pixel (radius + swidth))*/
for
(
col
=
1
;
col
<
radius
+
swidth
;
col
++
)
{
/*Check all pixels in a 1D blur line (from the origo to last shadow pixel (radius + swidth))*/
/*Sum the opacities from the lines above and below this 'row'*/
/*Sum the opacities from the lines above and below this 'row'*/
int16_t
line_rel
;
int16_t
line_rel
;
...
@@ -1806,7 +1806,7 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
...
@@ -1806,7 +1806,7 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
}
}
/*Add the value of the 1D blur on 'col_rel' position*/
/*Add the value of the 1D blur on 'col_rel' position*/
if
(
col_rel
<
-
swidth
)
{
/*Outside of the burred area. */
if
(
col_rel
<
-
swidth
)
{
/*Outside of the b
l
urred area. */
if
(
line_rel
==
-
swidth
)
line_ready
=
true
;
/*If no data even on the very first line then it wont't be anything else in this line*/
if
(
line_rel
==
-
swidth
)
line_ready
=
true
;
/*If no data even on the very first line then it wont't be anything else in this line*/
break
;
/*Break anyway because only smaller 'col_rel' values will come */
break
;
/*Break anyway because only smaller 'col_rel' values will come */
}
}
...
@@ -1815,7 +1815,10 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
...
@@ -1815,7 +1815,10 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
}
}
line_2d_blur
[
col
]
=
px_opa_sum
>>
SHADOW_OPA_EXTRA_PRECISION
;
line_2d_blur
[
col
]
=
px_opa_sum
>>
SHADOW_OPA_EXTRA_PRECISION
;
if
(
line_ready
)
break
;
if
(
line_ready
)
{
col
++
;
/*To make this line to the last one ( drawing will go to '< col')*/
break
;
}
}
}
...
@@ -1833,12 +1836,14 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
...
@@ -1833,12 +1836,14 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
point_lb
.
y
=
ofs_lb
.
y
+
line
;
point_lb
.
y
=
ofs_lb
.
y
+
line
;
uint16_t
d
;
uint16_t
d
;
for
(
d
=
1
;
d
<
=
col
;
d
++
)
{
for
(
d
=
1
;
d
<
col
;
d
++
)
{
if
(
point_rt
.
x
!=
point_lt
.
x
)
{
if
(
point_rt
.
x
!=
point_lt
.
x
)
{
px_fp
(
point_lt
.
x
,
point_lt
.
y
,
mask
,
style
->
body
.
shadow
.
color
,
line_2d_blur
[
d
]);
px_fp
(
point_lt
.
x
,
point_lt
.
y
,
mask
,
style
->
body
.
shadow
.
color
,
line_2d_blur
[
d
]);
}
}
printf
(
"%d, "
,
line_2d_blur
[
d
]);
if
(
point_rb
.
x
!=
point_lb
.
x
&&
point_lt
.
y
!=
point_lb
.
y
)
{
if
(
point_rb
.
x
!=
point_lb
.
x
&&
point_lt
.
y
!=
point_lb
.
y
)
{
px_fp
(
point_lb
.
x
,
point_lb
.
y
,
mask
,
style
->
body
.
shadow
.
color
,
line_2d_blur
[
d
]);
px_fp
(
point_lb
.
x
,
point_lb
.
y
,
mask
,
style
->
body
.
shadow
.
color
,
line_2d_blur
[
d
]);
}
}
...
@@ -1857,6 +1862,8 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
...
@@ -1857,6 +1862,8 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
point_lt
.
x
--
;
point_lt
.
x
--
;
}
}
printf
(
"
\n
"
);
/* Put the first line to the edges too.
/* Put the first line to the edges too.
* It is not correct because blur should be done below the corner too
* It is not correct because blur should be done below the corner too
* but is is simple, fast and gives a good enough result*/
* but is is simple, fast and gives a good enough result*/
...
...
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