[Libreoffice-commits] core.git: filter/source
Caolán McNamara
caolanm at redhat.com
Tue Jun 12 14:44:22 UTC 2018
filter/source/msfilter/mstoolbar.cxx | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
New commits:
commit 170d7dccf10eedcddb2a4eab714ec0da9817255c
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jun 12 13:47:24 2018 +0100
crashtesting: asserts on empty mask
since...
commit d46c32140fdb05758c039dd27552b1788faac104
Date: Thu Jun 7 12:37:33 2018 +0200
assert in BitmapInfoAccess if bitmap is empty or we can't read from it
Change-Id: I5b0ed63d476f0203d5c18441ff759415192eab2f
Reviewed-on: https://gerrit.libreoffice.org/55688
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/filter/source/msfilter/mstoolbar.cxx b/filter/source/msfilter/mstoolbar.cxx
index ecfa1f7ee318..52d69b901a34 100644
--- a/filter/source/msfilter/mstoolbar.cxx
+++ b/filter/source/msfilter/mstoolbar.cxx
@@ -294,11 +294,19 @@ bool TBCData::ImportToolBarControl( CustomToolBarImportHelper& helper, std::vect
if ( !sCommand.isEmpty() )
{
BitmapEx aBitEx( pIcon->getBitMap() );
- if ( pSpecificInfo->getIconMask() )
- // according to the spec:
- // "the iconMask is white in all the areas in which the icon is
- // displayed as transparent and is black in all other areas."
- aBitEx = BitmapEx( aBitEx.GetBitmap(), pSpecificInfo->getIconMask()->getBitMap().GetBitmap().CreateMask( COL_WHITE ) );
+ TBCBitMap* pIconMask = pSpecificInfo->getIconMask();
+ if (pIconMask)
+ {
+ Bitmap aMaskBase(pIconMask->getBitMap().GetBitmap());
+ Size aMaskSize = aMaskBase.GetSizePixel();
+ if (aMaskSize.Width() && aMaskSize.Height())
+ {
+ // according to the spec:
+ // "the iconMask is white in all the areas in which the icon is
+ // displayed as transparent and is black in all other areas."
+ aBitEx = BitmapEx(aBitEx.GetBitmap(), aMaskBase.CreateMask(COL_WHITE));
+ }
+ }
Graphic aGraphic( aBitEx );
helper.addIcon( aGraphic.GetXGraphic(), sCommand );
More information about the Libreoffice-commits
mailing list