diff options
author | Caolán McNamara <caolanm@redhat.com> | 2010-11-27 16:28:14 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2010-11-27 16:42:13 +0000 |
commit | bcdaee3492ff5449ca567abf001d4df4be012a2d (patch) | |
tree | 24b734a4cc2261ebcd79bf258f1d7ed5135a857d | |
parent | d707ff8a7e63b1821b65b0ff8681021a47419658 (diff) |
Resolves: rhbz#657628# divide by zero
(cherry picked from commit cde18c8978d2c680dbee88159246024960cdc705)
-rw-r--r-- | extensions/source/scanner/sanedlg.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx index 159c8afd5..98c654695 100644 --- a/extensions/source/scanner/sanedlg.cxx +++ b/extensions/source/scanner/sanedlg.cxx @@ -743,21 +743,23 @@ void SaneDlg::AcquirePreview() maReslBox.SetValue( (ULONG)fResl ); if( mbDragEnable ) + { maPreviewRect = Rectangle( maTopLeft, Size( maBottomRight.X() - maTopLeft.X(), maBottomRight.Y() - maTopLeft.Y() ) ); + } else { Size aBMSize( maPreviewBitmap.GetSizePixel() ); - if( aBMSize.Width() > aBMSize.Height() ) + if( aBMSize.Width() > aBMSize.Height() && aBMSize.Width() ) { int nVHeight = (maBottomRight.X() - maTopLeft.X()) * aBMSize.Height() / aBMSize.Width(); maPreviewRect = Rectangle( Point( maTopLeft.X(), ( maTopLeft.Y() + maBottomRight.Y() )/2 - nVHeight/2 ), Size( maBottomRight.X() - maTopLeft.X(), nVHeight ) ); } - else + else if (aBMSize.Height()) { int nVWidth = (maBottomRight.Y() - maTopLeft.Y()) * aBMSize.Width() / aBMSize.Height(); maPreviewRect = Rectangle( Point( ( maTopLeft.X() + maBottomRight.X() )/2 - nVWidth/2, maTopLeft.Y() ), |