[Libreoffice-commits] .: vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jan 23 02:48:28 PST 2013


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

New commits:
commit e1669188e2832cf0cc1caf111f70aff7ba17757a
Author: Thorsten Behrens <tbehrens at suse.com>
Date:   Wed Jan 23 11:42:55 2013 +0100

    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

diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index 465ea1c..e7a4193 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() )
                     {


More information about the Libreoffice-commits mailing list