[Libreoffice-commits] core.git: vcl/source

Armin Le Grand alg at apache.org
Sun May 12 12:30:38 PDT 2013


 vcl/source/gdi/bitmapex.cxx |   22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

New commits:
commit baebeb7de4c5f9511e45c2846ec2a72861a948c0
Author: Armin Le Grand <alg at apache.org>
Date:   Fri Jul 27 14:04:19 2012 +0000

    Resolves: #i120165# Adapt Mask/Alpha at BitmapEx construction...
    
    when size differs from base bitmap
    
    Original patch by: pengyunquan
    Changed patch by: alg
    Review by: alg(cherry picked from commit 3cfc24693469fb9b682e9c76c28610be1e004799)
    
    Change-Id: I6f09cb18206487c1df01147a902ea0f390d65c65

diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index f29bfbe..5087f18 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -117,8 +117,15 @@ BitmapEx::BitmapEx( const Bitmap& rBmp, const Bitmap& rMask ) :
         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());
+    }
 
     // Ensure a mask is exactly one bit deep
     if( !!aMask && aMask.GetBitCount() != 1 )
@@ -135,8 +142,15 @@ BitmapEx::BitmapEx( const Bitmap& rBmp, const AlphaMask& rAlphaMask ) :
         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


More information about the Libreoffice-commits mailing list