wxMathPlot: fixed crash when one of its dimensions == 0
This commit is contained in:
parent
f3fabeb9fb
commit
9c65d0d281
|
@ -167,8 +167,10 @@ void mpInfoLayer::Plot(wxDC & dc, mpWindow & w)
|
||||||
#ifdef MATHPLOT_DO_LOGGING
|
#ifdef MATHPLOT_DO_LOGGING
|
||||||
// wxLogMessage(_("mpInfoLayer::Plot() screen size has changed from %d x %d to %d x %d"), m_winX, m_winY, scrx, scry);
|
// wxLogMessage(_("mpInfoLayer::Plot() screen size has changed from %d x %d to %d x %d"), m_winX, m_winY, scrx, scry);
|
||||||
#endif
|
#endif
|
||||||
if (m_winX != 1) m_dim.x = (int) floor((double)(m_dim.x*scrx/m_winX));
|
if (m_winX > 1)
|
||||||
if (m_winY != 1) {
|
m_dim.x = (int) floor((double)(m_dim.x*scrx/m_winX));
|
||||||
|
|
||||||
|
if (m_winY > 1) {
|
||||||
m_dim.y = (int) floor((double)(m_dim.y*scry/m_winY));
|
m_dim.y = (int) floor((double)(m_dim.y*scry/m_winY));
|
||||||
UpdateReference();
|
UpdateReference();
|
||||||
}
|
}
|
||||||
|
@ -236,8 +238,10 @@ void mpInfoCoords::Plot(wxDC & dc, mpWindow & w)
|
||||||
#ifdef MATHPLOT_DO_LOGGING
|
#ifdef MATHPLOT_DO_LOGGING
|
||||||
// wxLogMessage(_("mpInfoLayer::Plot() screen size has changed from %d x %d to %d x %d"), m_winX, m_winY, scrx, scry);
|
// wxLogMessage(_("mpInfoLayer::Plot() screen size has changed from %d x %d to %d x %d"), m_winX, m_winY, scrx, scry);
|
||||||
#endif
|
#endif
|
||||||
if (m_winX != 1) m_dim.x = (int) floor((double)(m_dim.x*scrx/m_winX));
|
if (m_winX > 1)
|
||||||
if (m_winY != 1) {
|
m_dim.x = (int) floor((double)(m_dim.x*scrx/m_winX));
|
||||||
|
|
||||||
|
if (m_winY > 1) {
|
||||||
m_dim.y = (int) floor((double)(m_dim.y*scry/m_winY));
|
m_dim.y = (int) floor((double)(m_dim.y*scry/m_winY));
|
||||||
UpdateReference();
|
UpdateReference();
|
||||||
}
|
}
|
||||||
|
@ -290,8 +294,10 @@ void mpInfoLegend::Plot(wxDC & dc, mpWindow & w)
|
||||||
#ifdef MATHPLOT_DO_LOGGING
|
#ifdef MATHPLOT_DO_LOGGING
|
||||||
// wxLogMessage(_("mpInfoLayer::Plot() screen size has changed from %d x %d to %d x %d"), m_winX, m_winY, scrx, scry);
|
// wxLogMessage(_("mpInfoLayer::Plot() screen size has changed from %d x %d to %d x %d"), m_winX, m_winY, scrx, scry);
|
||||||
#endif
|
#endif
|
||||||
if (m_winX != 1) m_dim.x = (int) floor((double)(m_dim.x*scrx/m_winX));
|
if (m_winX > 1)
|
||||||
if (m_winY != 1) {
|
m_dim.x = (int) floor((double)(m_dim.x*scrx/m_winX));
|
||||||
|
|
||||||
|
if (m_winY > 1) {
|
||||||
m_dim.y = (int) floor((double)(m_dim.y*scry/m_winY));
|
m_dim.y = (int) floor((double)(m_dim.y*scry/m_winY));
|
||||||
UpdateReference();
|
UpdateReference();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue