diff options
-rw-r--r-- | extensions/source/scanner/grid.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx index 4956c3fe6566..44143f555509 100644 --- a/extensions/source/scanner/grid.cxx +++ b/extensions/source/scanner/grid.cxx @@ -306,8 +306,12 @@ Point GridWindow::transform( double x, double y ) void GridWindow::transform( const Point& rOriginal, double& x, double& y ) { - x = ( rOriginal.X() - m_aGridArea.Left() ) * (m_fMaxX - m_fMinX) / (double)m_aGridArea.GetWidth() + m_fMinX; - y = ( m_aGridArea.Bottom() - rOriginal.Y() ) * (m_fMaxY - m_fMinY) / (double)m_aGridArea.GetHeight() + m_fMinY; + const long nWidth = m_aGridArea.GetWidth(); + const long nHeight = m_aGridArea.GetHeight(); + if (!nWidth || nHeight) + return; + x = ( rOriginal.X() - m_aGridArea.Left() ) * (m_fMaxX - m_fMinX) / (double)nWidth + m_fMinX; + y = ( m_aGridArea.Bottom() - rOriginal.Y() ) * (m_fMaxY - m_fMinY) / (double)nHeight + m_fMinY; } void GridWindow::drawLine( double x1, double y1, double x2, double y2 ) |