Kaydet (Commit) 52360bf8 authored tarafından Noel Grandin's avatar Noel Grandin

convert BmpCombine to scoped enum and drop unused

Change-Id: Ic67474683a25a25e5753777f4bbbeded6ceba414
Reviewed-on: https://gerrit.libreoffice.org/33793Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst ba9b66ee
......@@ -3826,7 +3826,7 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons
Bitmap aBitmap( aBitmapEx.GetBitmap() );
Bitmap aMask( aBitmap.CreateMask( MSO_CLR_ToColor( nTransColor, DFF_Prop_pictureTransparent ), 9 ) );
if ( aBitmapEx.IsTransparent() )
aMask.CombineSimple( aBitmapEx.GetMask(), BMP_COMBINE_OR );
aMask.CombineSimple( aBitmapEx.GetMask(), BmpCombine::Or );
aGraf = BitmapEx( aBitmap, aMask );
}
}
......
......@@ -88,16 +88,9 @@ enum BmpConversion
BMP_CONVERSION_GHOSTED = 10
};
enum BmpCombine
enum class BmpCombine
{
BMP_COMBINE_COPY = 0,
BMP_COMBINE_INVERT = 1,
BMP_COMBINE_AND = 2,
BMP_COMBINE_NAND = 3,
BMP_COMBINE_OR = 4,
BMP_COMBINE_NOR = 5,
BMP_COMBINE_XOR = 6,
BMP_COMBINE_NXOR = 7
Or, And
};
enum BmpReduce
......
......@@ -98,7 +98,7 @@ uno::Reference< graphic::XGraphic > SAL_CALL GraphicTransformer::colorChange(
{
Bitmap aMask( aBitmapEx.GetMask() );
Bitmap aMask2( aBitmap.CreateMask( aColorFrom, nTolerance ) );
aMask.CombineSimple( aMask2, BMP_COMBINE_OR );
aMask.CombineSimple( aMask2, BmpCombine::Or );
aBitmap.Replace( aColorFrom, aColorTo, nTolerance );
aGraphic = ::Graphic( BitmapEx( aBitmap, aMask ) );
}
......
......@@ -631,7 +631,7 @@ BitmapEx SvxBmpMask::ImpMaskTransparent( const BitmapEx& rBitmapEx, const Color&
Bitmap aMask( rBitmapEx.GetBitmap().CreateMask( rColor, nTol ) );
if( rBitmapEx.IsTransparent() )
aMask.CombineSimple( rBitmapEx.GetMask(), BMP_COMBINE_OR );
aMask.CombineSimple( rBitmapEx.GetMask(), BmpCombine::Or );
aBmpEx = BitmapEx( rBitmapEx.GetBitmap(), aMask );
LeaveWait();
......
......@@ -691,7 +691,7 @@ IMPL_LINK( SvxSuperContourDlg, PipetteClickHdl, ContourWindow&, rWnd, void )
aMask = aBmp.CreateMask( rColor, nTol );
if( aGraphic.IsTransparent() )
aMask.CombineSimple( aGraphic.GetBitmapEx().GetMask(), BMP_COMBINE_OR );
aMask.CombineSimple( aGraphic.GetBitmapEx().GetMask(), BmpCombine::Or );
if( !!aMask )
{
......
......@@ -1637,11 +1637,11 @@ void WinMtfOutput::ImplDrawBitmap( const Point& rPos, const Size& rSize, const B
if ( rBitmap.GetTransparentColor() == Color( COL_WHITE ) )
{
aMask.CombineSimple( rBitmap.GetMask(), BMP_COMBINE_OR );
aMask.CombineSimple( rBitmap.GetMask(), BmpCombine::Or );
}
else
{
aMask.CombineSimple( rBitmap.GetMask(), BMP_COMBINE_AND );
aMask.CombineSimple( rBitmap.GetMask(), BmpCombine::And );
}
aBmpEx = BitmapEx( rBitmap.GetBitmap(), aMask );
......
......@@ -1721,31 +1721,7 @@ bool Bitmap::CombineSimple( const Bitmap& rMask, BmpCombine eCombine )
switch( eCombine )
{
case BMP_COMBINE_COPY:
{
for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ )
{
if( pMaskAcc->GetPixel( nY, nX ) == aMaskBlack )
pAcc->SetPixel( nY, nX, aBlack );
else
pAcc->SetPixel( nY, nX, aWhite );
}
}
break;
case BMP_COMBINE_INVERT:
{
for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ )
{
if( pAcc->GetPixel( nY, nX ) == aBlack )
pAcc->SetPixel( nY, nX, aWhite );
else
pAcc->SetPixel( nY, nX, aBlack );
}
}
break;
case BMP_COMBINE_AND:
case BmpCombine::And:
{
for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ )
{
......@@ -1757,19 +1733,7 @@ bool Bitmap::CombineSimple( const Bitmap& rMask, BmpCombine eCombine )
}
break;
case BMP_COMBINE_NAND:
{
for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ )
{
if( pMaskAcc->GetPixel( nY, nX ) != aMaskBlack && pAcc->GetPixel( nY, nX ) != aBlack )
pAcc->SetPixel( nY, nX, aBlack );
else
pAcc->SetPixel( nY, nX, aWhite );
}
}
break;
case BMP_COMBINE_OR:
case BmpCombine::Or:
{
for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ )
{
......@@ -1781,53 +1745,6 @@ bool Bitmap::CombineSimple( const Bitmap& rMask, BmpCombine eCombine )
}
break;
case BMP_COMBINE_NOR:
{
for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ )
{
if( pMaskAcc->GetPixel( nY, nX ) != aMaskBlack || pAcc->GetPixel( nY, nX ) != aBlack )
pAcc->SetPixel( nY, nX, aBlack );
else
pAcc->SetPixel( nY, nX, aWhite );
}
}
break;
case BMP_COMBINE_XOR:
{
for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ )
{
aPixel = pAcc->GetPixel( nY, nX );
aMaskPixel = pMaskAcc->GetPixel( nY, nX );
if( ( aMaskPixel != aMaskBlack && aPixel == aBlack ) ||
( aMaskPixel == aMaskBlack && aPixel != aBlack ) )
{
pAcc->SetPixel( nY, nX, aWhite );
}
else
pAcc->SetPixel( nY, nX, aBlack );
}
}
break;
case BMP_COMBINE_NXOR:
{
for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ )
{
aPixel = pAcc->GetPixel( nY, nX );
aMaskPixel = pMaskAcc->GetPixel( nY, nX );
if( ( aMaskPixel != aMaskBlack && aPixel == aBlack ) ||
( aMaskPixel == aMaskBlack && aPixel != aBlack ) )
{
pAcc->SetPixel( nY, nX, aBlack );
}
else
pAcc->SetPixel( nY, nX, aWhite );
}
}
break;
}
bRet = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment