incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arie...@apache.org
Subject svn commit: r1224936 - /incubator/ooo/trunk/main/sfx2/source/dialog/filedlghelper.cxx
Date Tue, 27 Dec 2011 15:57:39 GMT
Author: arielch
Date: Tue Dec 27 15:57:39 2011
New Revision: 1224936

URL: http://svn.apache.org/viewvc?rev=1224936&view=rev
Log:
Check if Bitmap is empty before trying to scale it

Modified:
    incubator/ooo/trunk/main/sfx2/source/dialog/filedlghelper.cxx

Modified: incubator/ooo/trunk/main/sfx2/source/dialog/filedlghelper.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sfx2/source/dialog/filedlghelper.cxx?rev=1224936&r1=1224935&r2=1224936&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sfx2/source/dialog/filedlghelper.cxx (original)
+++ incubator/ooo/trunk/main/sfx2/source/dialog/filedlghelper.cxx Tue Dec 27 15:57:39 2011
@@ -749,34 +749,36 @@ IMPL_LINK( FileDialogHelper_Impl, TimeOu
 			// proper position and painting a frame
 
 			Bitmap aBmp = maGraphic.GetBitmap();
+            if ( !aBmp.IsEmpty() )
+            {
+                // scale the bitmap to the correct size
+                sal_Int32 nOutWidth  = xFilePicker->getAvailableWidth();
+                sal_Int32 nOutHeight = xFilePicker->getAvailableHeight();
+                sal_Int32 nBmpWidth  = aBmp.GetSizePixel().Width();
+                sal_Int32 nBmpHeight = aBmp.GetSizePixel().Height();
 
-			// scale the bitmap to the correct size
-			sal_Int32 nOutWidth  = xFilePicker->getAvailableWidth();
-			sal_Int32 nOutHeight = xFilePicker->getAvailableHeight();
-			sal_Int32 nBmpWidth  = aBmp.GetSizePixel().Width();
-			sal_Int32 nBmpHeight = aBmp.GetSizePixel().Height();
-
-			double nXRatio = (double) nOutWidth / nBmpWidth;
-			double nYRatio = (double) nOutHeight / nBmpHeight;
+                double nXRatio = (double) nOutWidth / nBmpWidth;
+                double nYRatio = (double) nOutHeight / nBmpHeight;
 
-			if ( nXRatio < nYRatio )
-				aBmp.Scale( nXRatio, nXRatio );
-			else
-				aBmp.Scale( nYRatio, nYRatio );
+                if ( nXRatio < nYRatio )
+                    aBmp.Scale( nXRatio, nXRatio );
+                else
+                    aBmp.Scale( nYRatio, nYRatio );
 
-            // #94505# Convert to true color, to allow CopyPixel
-            aBmp.Convert( BMP_CONVERSION_24BIT );
+                // #94505# Convert to true color, to allow CopyPixel
+                aBmp.Convert( BMP_CONVERSION_24BIT );
 
-			// and copy it into the Any
-			SvMemoryStream aData;
+                // and copy it into the Any
+                SvMemoryStream aData;
 
-			aData << aBmp;
+                aData << aBmp;
 
-            const Sequence < sal_Int8 > aBuffer(
-                static_cast< const sal_Int8* >(aData.GetData()),
-                aData.GetEndOfData() );
+                const Sequence < sal_Int8 > aBuffer(
+                    static_cast< const sal_Int8* >(aData.GetData()),
+                    aData.GetEndOfData() );
 
-			aAny <<= aBuffer;
+                aAny <<= aBuffer;
+            }
 		}
 	}
 



Mime
View raw message