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
bf44999a
Commit
bf44999a
authored
Apr 12, 2011
by
Vladimir Ur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Recangle program rewritten so it became more accurate on a screen
parent
668bdfa6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
77 deletions
+17
-77
gr_basic.cpp
common/gr_basic.cpp
+17
-77
No files found.
common/gr_basic.cpp
View file @
bf44999a
...
...
@@ -1336,92 +1336,32 @@ void GRFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
void
GRSRect
(
EDA_RECT
*
aClipBox
,
wxDC
*
aDC
,
int
x1
,
int
y1
,
int
x2
,
int
y2
,
int
aWidth
,
int
aColor
,
wxPenStyle
aStyle
)
{
if
(
x1
>
x2
)
EXCHG
(
x1
,
x2
);
if
(
y1
>
y2
)
EXCHG
(
y1
,
y2
);
if
(
aClipBox
)
{
int
xmin
=
aClipBox
->
GetX
();
int
ymin
=
aClipBox
->
GetY
();
int
xmax
=
aClipBox
->
GetRight
();
int
ymax
=
aClipBox
->
GetBottom
();
if
(
x1
>
xmax
)
return
;
if
(
x2
<
xmin
)
return
;
if
(
y1
>
ymax
)
return
;
if
(
y2
<
ymin
)
return
;
}
wxPoint
points
[
5
];
points
[
0
]
=
wxPoint
(
x1
,
y1
);
points
[
1
]
=
wxPoint
(
x1
,
y2
);
points
[
2
]
=
wxPoint
(
x2
,
y2
);
points
[
3
]
=
wxPoint
(
x2
,
y1
);
points
[
4
]
=
points
[
0
];
GRSetColorPen
(
aDC
,
aColor
,
aWidth
,
aStyle
);
if
(
(
x1
==
x2
)
||
(
y1
==
y2
)
)
aDC
->
DrawLine
(
x1
,
y1
,
x2
,
y2
);
else
{
GRSetBrush
(
aDC
,
BLACK
);
aDC
->
DrawRectangle
(
x1
,
y1
,
x2
-
x1
,
y2
-
y1
);
}
ClipAndDrawFilledPoly
(
aClipBox
,
aDC
,
points
,
5
);
// polygon approach is more accurate
}
void
GRSFilledRect
(
EDA_RECT
*
ClipBox
,
wxDC
*
DC
,
int
x1
,
int
y1
,
int
x2
,
int
y2
,
int
width
,
int
Color
,
int
BgColor
)
{
if
(
x1
>
x2
)
EXCHG
(
x1
,
x2
);
if
(
y1
>
y2
)
EXCHG
(
y1
,
y2
);
if
(
ClipBox
)
{
int
xmin
=
ClipBox
->
GetX
();
int
ymin
=
ClipBox
->
GetY
();
int
xmax
=
ClipBox
->
GetRight
();
int
ymax
=
ClipBox
->
GetBottom
();
if
(
x1
>
xmax
)
return
;
if
(
x2
<
xmin
)
return
;
if
(
y1
>
ymax
)
return
;
if
(
y2
<
ymin
)
return
;
// Clipping coordinates
if
(
x1
<
xmin
)
x1
=
xmin
-
1
;
if
(
y1
<
ymin
)
y1
=
ymin
-
1
;
if
(
x2
>
xmax
)
x2
=
xmax
+
1
;
if
(
y2
>
ymax
)
y2
=
ymax
+
1
;
}
GRSetColorPen
(
DC
,
Color
,
width
);
if
(
(
x1
==
x2
)
||
(
y1
==
y2
)
)
DC
->
DrawLine
(
x1
,
y1
,
x2
,
y2
);
else
{
wxPoint
points
[
5
];
points
[
0
]
=
wxPoint
(
x1
,
y1
);
points
[
1
]
=
wxPoint
(
x1
,
y2
);
points
[
2
]
=
wxPoint
(
x2
,
y2
);
points
[
3
]
=
wxPoint
(
x2
,
y1
);
points
[
4
]
=
points
[
0
];
GRSetBrush
(
DC
,
BgColor
,
FILLED
);
DC
->
DrawRectangle
(
x1
,
y1
,
x2
-
x1
,
y2
-
y1
);
}
GRSetColorPen
(
DC
,
BgColor
,
width
);
ClipAndDrawFilledPoly
(
ClipBox
,
DC
,
points
,
5
);
// polygon approach is more accurate
}
...
...
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