[Libreoffice-commits] .: extensions/source

Caolán McNamara caolan at kemper.freedesktop.org
Sat Nov 27 08:33:08 PST 2010


 extensions/source/scanner/sanedlg.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 64e3a1bcb53d7080f31692952ec99b345cf690d3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Nov 27 16:28:14 2010 +0000

    Resolves: rhbz#657628# divide by zero

diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx
index 159c8af..98c6546 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() ),


More information about the Libreoffice-commits mailing list