Convert MtfConversion to scoped enum

Change-Id: I694fe139531a10467265b028ad15df0eda6d723a
Reviewed-on: https://gerrit.libreoffice.org/25442
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
Noel Grandin 2016-05-25 12:05:54 +02:00 committed by Noel Grandin
parent 702eb3d389
commit 92d3025521
4 changed files with 11 additions and 11 deletions

View file

@ -3930,9 +3930,9 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons
if ( nBrightness || nContrast || ( nGamma != 0x10000 ) )
aGdiMetaFile.Adjust( nBrightness, (sal_Int16)nContrast, 0, 0, 0, (double)nGamma / 0x10000, false, true );
if ( eDrawMode == GRAPHICDRAWMODE_GREYS )
aGdiMetaFile.Convert( MTF_CONVERSION_8BIT_GREYS );
aGdiMetaFile.Convert( MtfConversion::N8BitGreys );
else if ( eDrawMode == GRAPHICDRAWMODE_MONO )
aGdiMetaFile.Convert( MTF_CONVERSION_1BIT_THRESHOLD );
aGdiMetaFile.Convert( MtfConversion::N1BitThreshold );
aGraf = aGdiMetaFile;
}
break;

View file

@ -43,11 +43,11 @@ class Gradient;
#define GDI_METAFILE_END ((size_t)0xFFFFFFFF)
#define GDI_METAFILE_LABEL_NOTFOUND ((size_t)0xFFFFFFFF)
enum MtfConversion
enum class MtfConversion
{
MTF_CONVERSION_NONE = 0,
MTF_CONVERSION_1BIT_THRESHOLD = 1,
MTF_CONVERSION_8BIT_GREYS = 2
NONE = 0,
N1BitThreshold = 1,
N8BitGreys = 2
};

View file

@ -1513,11 +1513,11 @@ void GraphicManager::ImplAdjust( GDIMetaFile& rMtf, const GraphicAttr& rAttr, Gr
switch( aAttr.GetDrawMode() )
{
case GRAPHICDRAWMODE_MONO:
rMtf.Convert( MTF_CONVERSION_1BIT_THRESHOLD );
rMtf.Convert( MtfConversion::N1BitThreshold );
break;
case GRAPHICDRAWMODE_GREYS:
rMtf.Convert( MTF_CONVERSION_8BIT_GREYS );
rMtf.Convert( MtfConversion::N8BitGreys );
break;
case GRAPHICDRAWMODE_WATERMARK:

View file

@ -1848,7 +1848,7 @@ Color GDIMetaFile::ImplColConvertFnc( const Color& rColor, const void* pColParam
{
sal_uInt8 cLum = rColor.GetLuminance();
if( MTF_CONVERSION_1BIT_THRESHOLD == static_cast<const ImplColConvertParam*>(pColParam)->eConversion )
if( MtfConversion::N1BitThreshold == static_cast<const ImplColConvertParam*>(pColParam)->eConversion )
cLum = ( cLum < 128 ) ? 0 : 255;
return Color( rColor.GetTransparency(), cLum, cLum, cLum );
@ -2269,13 +2269,13 @@ void GDIMetaFile::Adjust( short nLuminancePercent, short nContrastPercent,
void GDIMetaFile::Convert( MtfConversion eConversion )
{
// nothing to do? => return quickly
if( eConversion != MTF_CONVERSION_NONE )
if( eConversion != MtfConversion::NONE )
{
ImplColConvertParam aColParam;
ImplBmpConvertParam aBmpParam;
aColParam.eConversion = eConversion;
aBmpParam.eConversion = ( MTF_CONVERSION_1BIT_THRESHOLD == eConversion ) ? BMP_CONVERSION_1BIT_THRESHOLD : BMP_CONVERSION_8BIT_GREYS;
aBmpParam.eConversion = ( MtfConversion::N1BitThreshold == eConversion ) ? BMP_CONVERSION_1BIT_THRESHOLD : BMP_CONVERSION_8BIT_GREYS;
ImplExchangeColors( ImplColConvertFnc, &aColParam, ImplBmpConvertFnc, &aBmpParam );
}