From 92d3025521ec8939b66500347f8d38ed5b24e3c8 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 25 May 2016 12:05:54 +0200 Subject: [PATCH] Convert MtfConversion to scoped enum Change-Id: I694fe139531a10467265b028ad15df0eda6d723a Reviewed-on: https://gerrit.libreoffice.org/25442 Tested-by: Jenkins Reviewed-by: Noel Grandin --- filter/source/msfilter/msdffimp.cxx | 4 ++-- include/vcl/gdimtf.hxx | 8 ++++---- svtools/source/graphic/grfmgr2.cxx | 4 ++-- vcl/source/gdi/gdimtf.cxx | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 1728f90553a0..cf802ecbdede 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -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; diff --git a/include/vcl/gdimtf.hxx b/include/vcl/gdimtf.hxx index 332e110c99b4..e75107f1b4e1 100644 --- a/include/vcl/gdimtf.hxx +++ b/include/vcl/gdimtf.hxx @@ -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 }; diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx index 70291ebbea8e..1f934f786c69 100644 --- a/svtools/source/graphic/grfmgr2.cxx +++ b/svtools/source/graphic/grfmgr2.cxx @@ -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: diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 9185ded909c5..ea29eef04680 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -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(pColParam)->eConversion ) + if( MtfConversion::N1BitThreshold == static_cast(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 ); }