summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorThorsten Behrens <tbehrens@suse.com>2013-01-23 11:42:55 +0100
committerThorsten Behrens <tbehrens@suse.com>2013-01-23 20:44:11 +0100
commitfbdd9b181e59a0510fc5e7dcb56fac8e0dc6bb8f (patch)
treeb09f518628fb8108b34fb876e48e3dc9e05a63d3 /vcl
parent85e7a0f6cd9b311e6734e747b03ad0a736ff6dbd (diff)
Fix fdo#59616 - ensure BitmapEx has same-sized subbitmaps
Lots of code relies on the fact that the two bitmaps inside a BitmapEx actually have the same size. Enforce that convention during import. Change-Id: I436ccc33b06c627cd6347747d22c24bfaf7ca932
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/bitmapex.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index e717d0b1c245..f6994320058a 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -806,6 +806,24 @@ SvStream& operator>>( SvStream& rIStm, BitmapEx& rBitmapEx )
if( !!aMask)
{
+ // fdo#59616 enforce same size for both mask and content
+ if( aMask.GetSizePixel() != aBmp.GetSizePixel() )
+ {
+ Bitmap aNewMask;
+ const Size aNominalSize=aBmp.GetSizePixel();
+ BitmapReadAccess aAcc(aMask);
+ if( aAcc.HasPalette() )
+ aNewMask = Bitmap(aNominalSize,
+ aMask.GetBitCount(),
+ &aAcc.GetPalette());
+ else
+ aNewMask = Bitmap(aNominalSize,
+ aMask.GetBitCount());
+ const Rectangle aCopyArea(Point(0,0), aNominalSize);
+ aNewMask.CopyPixel(aCopyArea, aCopyArea, &aMask);
+ aMask = aNewMask;
+ }
+
// do we have an alpha mask?
if( ( 8 == aMask.GetBitCount() ) && aMask.HasGreyPalette() )
{