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
929a849b
Commit
929a849b
authored
Jun 20, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a framerate limiter.
Now it does not use all the CPU power while panning even on simple boards.
parent
bb9ee216
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
drawpanel_gal.cpp
common/drawpanel_gal.cpp
+11
-1
class_drawpanel_gal.h
include/class_drawpanel_gal.h
+2
-1
No files found.
common/drawpanel_gal.cpp
View file @
929a849b
...
@@ -88,6 +88,8 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
...
@@ -88,6 +88,8 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
Connect
(
wxEVT_PAINT
,
wxPaintEventHandler
(
EDA_DRAW_PANEL_GAL
::
onPaint
),
NULL
,
this
);
Connect
(
wxEVT_PAINT
,
wxPaintEventHandler
(
EDA_DRAW_PANEL_GAL
::
onPaint
),
NULL
,
this
);
Connect
(
wxEVT_SIZE
,
wxSizeEventHandler
(
EDA_DRAW_PANEL_GAL
::
onSize
),
NULL
,
this
);
Connect
(
wxEVT_SIZE
,
wxSizeEventHandler
(
EDA_DRAW_PANEL_GAL
::
onSize
),
NULL
,
this
);
m_timeStamp
=
0
;
}
}
...
@@ -107,7 +109,7 @@ EDA_DRAW_PANEL_GAL::~EDA_DRAW_PANEL_GAL()
...
@@ -107,7 +109,7 @@ EDA_DRAW_PANEL_GAL::~EDA_DRAW_PANEL_GAL()
}
}
void
EDA_DRAW_PANEL_GAL
::
onPaint
(
wxPaintEvent
&
aEvent
)
void
EDA_DRAW_PANEL_GAL
::
onPaint
(
wxPaintEvent
&
WXUNUSED
(
aEvent
)
)
{
{
Refresh
();
Refresh
();
}
}
...
@@ -121,6 +123,14 @@ void EDA_DRAW_PANEL_GAL::onSize( wxSizeEvent& aEvent )
...
@@ -121,6 +123,14 @@ void EDA_DRAW_PANEL_GAL::onSize( wxSizeEvent& aEvent )
void
EDA_DRAW_PANEL_GAL
::
Refresh
(
bool
eraseBackground
,
const
wxRect
*
rect
)
void
EDA_DRAW_PANEL_GAL
::
Refresh
(
bool
eraseBackground
,
const
wxRect
*
rect
)
{
{
const
unsigned
int
FPS_LIMIT
=
50
;
// Framerate limiter
wxLongLong
currentTimeStamp
=
wxGetLocalTimeMillis
();
if
(
currentTimeStamp
-
m_timeStamp
<
(
1
/
FPS_LIMIT
)
)
return
;
m_timeStamp
=
currentTimeStamp
;
#ifdef __WXDEBUG__
#ifdef __WXDEBUG__
prof_counter
time
;
prof_counter
time
;
...
...
include/class_drawpanel_gal.h
View file @
929a849b
...
@@ -79,7 +79,7 @@ public:
...
@@ -79,7 +79,7 @@ public:
virtual
void
Refresh
(
bool
eraseBackground
=
true
,
const
wxRect
*
rect
=
NULL
);
virtual
void
Refresh
(
bool
eraseBackground
=
true
,
const
wxRect
*
rect
=
NULL
);
protected
:
protected
:
void
onPaint
(
wxPaintEvent
&
aEvent
);
void
onPaint
(
wxPaintEvent
&
WXUNUSED
(
aEvent
)
);
void
onSize
(
wxSizeEvent
&
aEvent
);
void
onSize
(
wxSizeEvent
&
aEvent
);
KiGfx
::
GAL
*
m_gal
;
///< Interface for drawing objects on a 2D-surface
KiGfx
::
GAL
*
m_gal
;
///< Interface for drawing objects on a 2D-surface
...
@@ -90,6 +90,7 @@ protected:
...
@@ -90,6 +90,7 @@ protected:
KiGfx
::
WX_VIEW_CONTROLS
*
m_viewControls
;
///< Control for VIEW (moving, zooming, etc.)
KiGfx
::
WX_VIEW_CONTROLS
*
m_viewControls
;
///< Control for VIEW (moving, zooming, etc.)
GalType
m_currentGal
;
///< Currently used GAL
GalType
m_currentGal
;
///< Currently used GAL
bool
m_useShaders
;
///< Are shaders used? (only for OpenGL GAL)
bool
m_useShaders
;
///< Are shaders used? (only for OpenGL GAL)
wxLongLong
m_timeStamp
;
std
::
string
m_galShaderPath
;
///< Path to shader files, used in OpenGL mode
std
::
string
m_galShaderPath
;
///< Path to shader files, used in OpenGL mode
};
};
...
...
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