Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NuttX RTOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
f4grx
NuttX RTOS
Commits
8bfd44ab
Commit
8bfd44ab
authored
10 years ago
by
Gregory Nutt
Browse files
Options
Downloads
Patches
Plain Diff
NX circular drawing. Reduce computations; line caps needed only on every other line segment
parent
141846c6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
libnx/nx/nx_drawcircle.c
+13
-2
13 additions, 2 deletions
libnx/nx/nx_drawcircle.c
libnx/nxtk/nxtk_drawcircletoolbar.c
+12
-2
12 additions, 2 deletions
libnx/nxtk/nxtk_drawcircletoolbar.c
libnx/nxtk/nxtk_drawcirclewindow.c
+12
-2
12 additions, 2 deletions
libnx/nxtk/nxtk_drawcirclewindow.c
with
37 additions
and
6 deletions
libnx/nx/nx_drawcircle.c
+
13
−
2
View file @
8bfd44ab
...
...
@@ -113,6 +113,7 @@ int nx_drawcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center,
{
struct
nxgl_point_s
pts
[
NCIRCLE_POINTS
];
FAR
struct
nxgl_vector_s
vector
;
bool
capped
;
int
i
;
int
ret
;
...
...
@@ -122,17 +123,27 @@ int nx_drawcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center,
/* Draw each pair of points as a vector */
capped
=
false
;
for
(
i
=
POINT_0p0
;
i
<
POINT_337p5
;
i
++
)
{
/* Draw one line segment */
vector
.
pt1
.
x
=
pts
[
i
].
x
;
vector
.
pt1
.
y
=
pts
[
i
].
y
;
vector
.
pt2
.
x
=
pts
[
i
+
1
].
x
;
vector
.
pt2
.
y
=
pts
[
i
+
1
].
y
;
ret
=
nx_drawline
(
hwnd
,
&
vector
,
width
,
color
,
true
);
ret
=
nx_drawline
(
hwnd
,
&
vector
,
width
,
color
,
capped
);
if
(
ret
!=
OK
)
{
return
ret
;
}
/* Every other line segment needs to have a circular line caps to join
* cleanly with the surround lines segments without line caps.
*/
capped
=
!
capped
;
}
/* The final, closing vector is a special case */
...
...
@@ -141,5 +152,5 @@ int nx_drawcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center,
vector
.
pt1
.
y
=
pts
[
POINT_337p5
].
y
;
vector
.
pt2
.
x
=
pts
[
POINT_0p0
].
x
;
vector
.
pt2
.
y
=
pts
[
POINT_0p0
].
y
;
return
nx_drawline
(
hwnd
,
&
vector
,
width
,
color
,
true
);
return
nx_drawline
(
hwnd
,
&
vector
,
width
,
color
,
capped
);
}
This diff is collapsed.
Click to expand it.
libnx/nxtk/nxtk_drawcircletoolbar.c
+
12
−
2
View file @
8bfd44ab
...
...
@@ -113,6 +113,7 @@ int nxtk_drawcircletoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *cent
{
struct
nxgl_point_s
pts
[
NCIRCLE_POINTS
];
FAR
struct
nxgl_vector_s
vector
;
bool
capped
;
int
i
;
int
ret
;
...
...
@@ -124,15 +125,24 @@ int nxtk_drawcircletoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *cent
for
(
i
=
POINT_0p0
;
i
<
POINT_337p5
;
i
++
)
{
/* Draw one line segment */
vector
.
pt1
.
x
=
pts
[
i
].
x
;
vector
.
pt1
.
y
=
pts
[
i
].
y
;
vector
.
pt2
.
x
=
pts
[
i
+
1
].
x
;
vector
.
pt2
.
y
=
pts
[
i
+
1
].
y
;
ret
=
nxtk_drawlinetoolbar
(
hfwnd
,
&
vector
,
width
,
color
,
true
);
ret
=
nxtk_drawlinetoolbar
(
hfwnd
,
&
vector
,
width
,
color
,
capped
);
if
(
ret
!=
OK
)
{
return
ret
;
}
/* Every other line segment needs to have a circular line caps to join
* cleanly with the surround lines segments without line caps.
*/
capped
=
!
capped
;
}
/* The final, closing vector is a special case */
...
...
@@ -141,5 +151,5 @@ int nxtk_drawcircletoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *cent
vector
.
pt1
.
y
=
pts
[
POINT_337p5
].
y
;
vector
.
pt2
.
x
=
pts
[
POINT_0p0
].
x
;
vector
.
pt2
.
y
=
pts
[
POINT_0p0
].
y
;
return
nxtk_drawlinetoolbar
(
hfwnd
,
&
vector
,
width
,
color
,
true
);
return
nxtk_drawlinetoolbar
(
hfwnd
,
&
vector
,
width
,
color
,
capped
);
}
This diff is collapsed.
Click to expand it.
libnx/nxtk/nxtk_drawcirclewindow.c
+
12
−
2
View file @
8bfd44ab
...
...
@@ -113,6 +113,7 @@ int nxtk_drawcirclewindow(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *cente
{
struct
nxgl_point_s
pts
[
NCIRCLE_POINTS
];
FAR
struct
nxgl_vector_s
vector
;
bool
capped
;
int
i
;
int
ret
;
...
...
@@ -124,15 +125,24 @@ int nxtk_drawcirclewindow(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *cente
for
(
i
=
POINT_0p0
;
i
<
POINT_337p5
;
i
++
)
{
/* Draw one line segment */
vector
.
pt1
.
x
=
pts
[
i
].
x
;
vector
.
pt1
.
y
=
pts
[
i
].
y
;
vector
.
pt2
.
x
=
pts
[
i
+
1
].
x
;
vector
.
pt2
.
y
=
pts
[
i
+
1
].
y
;
ret
=
nxtk_drawlinewindow
(
hfwnd
,
&
vector
,
width
,
color
,
true
);
ret
=
nxtk_drawlinewindow
(
hfwnd
,
&
vector
,
width
,
color
,
capped
);
if
(
ret
!=
OK
)
{
return
ret
;
}
/* Every other line segment needs to have a circular line caps to join
* cleanly with the surround lines segments without line caps.
*/
capped
=
!
capped
;
}
/* The final, closing vector is a special case */
...
...
@@ -141,5 +151,5 @@ int nxtk_drawcirclewindow(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *cente
vector
.
pt1
.
y
=
pts
[
POINT_337p5
].
y
;
vector
.
pt2
.
x
=
pts
[
POINT_0p0
].
x
;
vector
.
pt2
.
y
=
pts
[
POINT_0p0
].
y
;
return
nxtk_drawlinewindow
(
hfwnd
,
&
vector
,
width
,
color
,
true
);
return
nxtk_drawlinewindow
(
hfwnd
,
&
vector
,
width
,
color
,
capped
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment