Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
490a73b6
Commit
490a73b6
authored
Aug 06, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed filled arcs drawing (GAL).
parent
bcdd3d7b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
12 deletions
+24
-12
cairo_gal.cpp
common/gal/cairo/cairo_gal.cpp
+13
-0
opengl_gal.cpp
common/gal/opengl/opengl_gal.cpp
+11
-12
No files found.
common/gal/cairo/cairo_gal.cpp
View file @
490a73b6
...
...
@@ -223,6 +223,19 @@ void CAIRO_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double aS
cairo_new_sub_path
(
currentContext
);
cairo_arc
(
currentContext
,
aCenterPoint
.
x
,
aCenterPoint
.
y
,
aRadius
,
aStartAngle
,
aEndAngle
);
if
(
isFillEnabled
)
{
VECTOR2D
startPoint
(
cos
(
aStartAngle
)
*
aRadius
+
aCenterPoint
.
x
,
sin
(
aStartAngle
)
*
aRadius
+
aCenterPoint
.
y
);
VECTOR2D
endPoint
(
cos
(
aEndAngle
)
*
aRadius
+
aCenterPoint
.
x
,
sin
(
aEndAngle
)
*
aRadius
+
aCenterPoint
.
y
);
cairo_move_to
(
currentContext
,
aCenterPoint
.
x
,
aCenterPoint
.
y
);
cairo_line_to
(
currentContext
,
startPoint
.
x
,
startPoint
.
y
);
cairo_line_to
(
currentContext
,
endPoint
.
x
,
endPoint
.
y
);
cairo_close_path
(
currentContext
);
}
isElementAdded
=
true
;
}
...
...
common/gal/opengl/opengl_gal.cpp
View file @
490a73b6
...
...
@@ -377,17 +377,12 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double a
// Swap the angles, if start angle is greater than end angle
SWAP
(
aStartAngle
,
>
,
aEndAngle
);
VECTOR2D
startPoint
(
cos
(
aStartAngle
),
sin
(
aStartAngle
)
);
VECTOR2D
endPoint
(
cos
(
aEndAngle
),
sin
(
aEndAngle
)
);
VECTOR2D
startEndPoint
=
startPoint
+
endPoint
;
VECTOR2D
middlePoint
=
0.5
*
startEndPoint
;
Save
();
currentManager
->
Translate
(
aCenterPoint
.
x
,
aCenterPoint
.
y
,
layerDepth
);
if
(
isStrokeEnabled
)
{
double
alphaIncrement
=
2.0
*
M_PI
/
CIRCLE_POINTS
;
const
double
alphaIncrement
=
2.0
*
M_PI
/
CIRCLE_POINTS
;
currentManager
->
Color
(
strokeColor
.
r
,
strokeColor
.
g
,
strokeColor
.
b
,
strokeColor
.
a
);
VECTOR2D
p
(
cos
(
aStartAngle
)
*
aRadius
,
sin
(
aStartAngle
)
*
aRadius
);
...
...
@@ -411,20 +406,24 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double a
if
(
isFillEnabled
)
{
double
alphaIncrement
=
2
*
M_PI
/
CIRCLE_POINTS
;
const
double
alphaIncrement
=
2
*
M_PI
/
CIRCLE_POINTS
;
double
alpha
;
currentManager
->
Color
(
fillColor
.
r
,
fillColor
.
g
,
fillColor
.
b
,
fillColor
.
a
);
currentManager
->
Shader
(
SHADER_NONE
);
// Triangle fan
for
(
alpha
=
aStartAngle
;
(
alpha
+
alphaIncrement
)
<
aEndAngle
;
)
{
currentManager
->
Vertex
(
middlePoint
.
x
,
middlePoint
.
y
,
0.0
);
currentManager
->
Vertex
(
cos
(
alpha
)
,
sin
(
alpha
),
0.0
);
currentManager
->
Vertex
(
0.0
,
0.0
,
0.0
);
currentManager
->
Vertex
(
cos
(
alpha
)
*
aRadius
,
sin
(
alpha
)
*
aRadius
,
0.0
);
alpha
+=
alphaIncrement
;
currentManager
->
Vertex
(
cos
(
alpha
)
,
sin
(
alpha
),
0.0
);
currentManager
->
Vertex
(
cos
(
alpha
)
*
aRadius
,
sin
(
alpha
)
*
aRadius
,
0.0
);
}
currentManager
->
Vertex
(
middlePoint
.
x
,
middlePoint
.
y
,
0.0
);
currentManager
->
Vertex
(
cos
(
alpha
),
sin
(
alpha
),
0.0
);
// The last missing triangle
const
VECTOR2D
endPoint
(
cos
(
aEndAngle
)
*
aRadius
,
sin
(
aEndAngle
)
*
aRadius
);
currentManager
->
Vertex
(
0.0
,
0.0
,
0.0
);
currentManager
->
Vertex
(
cos
(
alpha
)
*
aRadius
,
sin
(
alpha
)
*
aRadius
,
0.0
);
currentManager
->
Vertex
(
endPoint
.
x
,
endPoint
.
y
,
0.0
);
}
...
...
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