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:32:56 +0000 |
commit | 64e3a1bcb53d7080f31692952ec99b345cf690d3 (patch) | |
tree | c136fd3938b198313c961473e61aa8bbfdf48d70 /extensions/source/scanner | |
parent | 5d57e7bc80ec0624a1b234efccb2ceacaca31b95 (diff) |
Resolves: rhbz#657628# divide by zero
Diffstat (limited to 'extensions/source/scanner')
-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() ), |