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
2c9dd508
Commit
2c9dd508
authored
Jan 14, 2010
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
attempt to find a suitable way to draw grid depending on platforms
parent
e1534141
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
drawpanel.cpp
common/drawpanel.cpp
+14
-2
No files found.
common/drawpanel.cpp
View file @
2c9dd508
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
#include "class_base_screen.h"
#include "class_base_screen.h"
#include "wxstruct.h"
#include "wxstruct.h"
#include <wx/wupdlock.h>
#include "kicad_device_context.h"
#include "kicad_device_context.h"
#define CURSOR_SIZE 12 // Cursor size in pixels
#define CURSOR_SIZE 12 // Cursor size in pixels
...
@@ -760,9 +761,18 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
...
@@ -760,9 +761,18 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
GRSetColorPen
(
DC
,
color
);
GRSetColorPen
(
DC
,
color
);
int
xpos
,
ypos
;
int
xpos
,
ypos
;
#if 0 // Use a pixel based draw to display grid
// Draw grid: the best algorithm depend on the platform.
// under macOSX, the first method is better
// under window, the second method is better
// Under linux, to be tested (could be depend on linux versions
// so perhaps could be necessary to set this option at run time.
#if defined ( __WXMAC__ )
// Use a pixel based draw to display grid
// There is a lot of calls, so the cost is hight
// There is a lot of calls, so the cost is hight
// and grid is slowly drawn on some platforms
// and grid is slowly drawn on some platforms
wxWindowUpdateLocker
(
this
);
// under macOSX: drawings are faster with this
for
(
ii
=
0
;
;
ii
++
)
for
(
ii
=
0
;
;
ii
++
)
{
{
xg
=
wxRound
(
ii
*
screen_grid_size
.
x
);
xg
=
wxRound
(
ii
*
screen_grid_size
.
x
);
...
@@ -775,14 +785,16 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
...
@@ -775,14 +785,16 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
yg
=
wxRound
(
jj
*
screen_grid_size
.
y
);
yg
=
wxRound
(
jj
*
screen_grid_size
.
y
);
if
(
yg
>
size
.
y
)
if
(
yg
>
size
.
y
)
break
;
break
;
int
ypos = org.y + yg;
ypos
=
org
.
y
+
yg
;
DC
->
DrawPoint
(
xpos
,
GRMapY
(
ypos
)
);
DC
->
DrawPoint
(
xpos
,
GRMapY
(
ypos
)
);
}
}
}
}
#else // Currently on test: Use a fast way to draw the grid
#else // Currently on test: Use a fast way to draw the grid
// But this is fast if the Blit function is fast. Not true on all platforms
// a grid column is drawn; and then copied to others grid columns
// a grid column is drawn; and then copied to others grid columns
// this is possible because the grid is drawn only after clearing the screen.
// this is possible because the grid is drawn only after clearing the screen.
// under MACOSX, is very slow
ii
=
1
;
ii
=
1
;
xg
=
wxRound
(
ii
*
screen_grid_size
.
x
);
xg
=
wxRound
(
ii
*
screen_grid_size
.
x
);
int
x0pos
=
GRMapX
(
org
.
x
+
xg
);
int
x0pos
=
GRMapX
(
org
.
x
+
xg
);
...
...
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