diff options
author | Armin Le Grand <alg@apache.org> | 2012-07-27 14:04:19 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-05-12 20:29:52 +0100 |
commit | baebeb7de4c5f9511e45c2846ec2a72861a948c0 (patch) | |
tree | a9f01bff8740937c036a02ff6f3927a73ca9571b /vcl/source/gdi/bitmapex.cxx | |
parent | 8056d92635dd1cb03798d4691611d2484bf680af (diff) |
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
Diffstat (limited to 'vcl/source/gdi/bitmapex.cxx')
-rw-r--r-- | vcl/source/gdi/bitmapex.cxx | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index f29bfbef0aef..5087f181e8bc 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 |