incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1366405 - /incubator/ooo/trunk/main/vcl/source/gdi/bitmapex.cxx
Date Fri, 27 Jul 2012 15:04:20 GMT
Author: alg
Date: Fri Jul 27 15:04:19 2012
New Revision: 1366405

URL: http://svn.apache.org/viewvc?rev=1366405&view=rev
Log:
#120165# Adapt Mask/Alpha at BitmapEx construction when size differs from base bitmap
Original patch by: pengyunquan
Changed patch by: alg
Review by: alg

Modified:
    incubator/ooo/trunk/main/vcl/source/gdi/bitmapex.cxx

Modified: incubator/ooo/trunk/main/vcl/source/gdi/bitmapex.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/bitmapex.cxx?rev=1366405&r1=1366404&r2=1366405&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/gdi/bitmapex.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/gdi/bitmapex.cxx Fri Jul 27 15:04:19 2012
@@ -131,8 +131,15 @@ BitmapEx::BitmapEx( const Bitmap& rBmp, 
 		eTransparent	( !rMask ? TRANSPARENT_NONE : TRANSPARENT_BITMAP ),
 		bAlpha			( sal_False )
 {
-    DBG_ASSERT( !rMask || rBmp.GetSizePixel() == rMask.GetSizePixel(),
-                "BitmapEx::BitmapEx(): size mismatch for bitmap and mask." );
+    if(!rMask)
+    {
+        OSL_ENSURE(false, "Empty mask given (!)");
+    }
+    else if(rBmp.GetSizePixel() != rMask.GetSizePixel())
+    {
+        OSL_ENSURE(false, "Mask size differs from Bitmap size, corrected Mask (!)");
+        aMask.Scale(rBmp.GetSizePixel());
+    }
 
     // #105489# Ensure a mask is exactly one bit deep
     if( !!aMask && aMask.GetBitCount() != 1 )
@@ -151,8 +158,15 @@ BitmapEx::BitmapEx( const Bitmap& rBmp, 
 		eTransparent	( !rAlphaMask ? TRANSPARENT_NONE : TRANSPARENT_BITMAP ),
 		bAlpha			( !rAlphaMask ? sal_False : sal_True )
 {
-    DBG_ASSERT( !rAlphaMask || rBmp.GetSizePixel() == rAlphaMask.GetSizePixel(),
-                "BitmapEx::BitmapEx(): size mismatch for bitmap and alpha mask." );
+    if(!rAlphaMask)
+    {
+        OSL_ENSURE(false, "Empty alpha given (!)");
+    }
+    else if(rBmp.GetSizePixel() != rAlphaMask.GetSizePixel())
+    {
+        OSL_ENSURE(false, "Alpha size differs from Bitmap size, corrected Mask (!)");
+        aMask.Scale(rBmp.GetSizePixel());
+    }
 
     // #i75531# the workaround below can go when
     // X11SalGraphics::drawAlphaBitmap()'s render acceleration



Mime
View raw message