diff options
author | Noel Grandin <noel@peralex.com> | 2015-04-20 09:18:09 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-04-22 10:28:40 +0200 |
commit | 699ba641dbbe34df33c4a811492370720a36144f (patch) | |
tree | 56462d14b2b8b934529dc366def80f765ccb4a43 | |
parent | 24724aad8e24d0ef3006934a0de3f4b3f9bcd884 (diff) |
convert ADJUSTMENT_ flags to scoped enum
Change-Id: I2b3d50eb7cbc3abc4cdc7e94219852f678b45e13
-rw-r--r-- | include/svtools/grfmgr.hxx | 28 | ||||
-rw-r--r-- | svtools/source/graphic/grfmgr.cxx | 6 | ||||
-rw-r--r-- | svtools/source/graphic/grfmgr2.cxx | 40 |
3 files changed, 40 insertions, 34 deletions
diff --git a/include/svtools/grfmgr.hxx b/include/svtools/grfmgr.hxx index 7527d804d120..b4913398d549 100644 --- a/include/svtools/grfmgr.hxx +++ b/include/svtools/grfmgr.hxx @@ -46,14 +46,20 @@ namespace o3tl #define GRFMGR_AUTOSWAPSTREAM_NONE reinterpret_cast<SvStream*>(sal_IntPtr(-1)) // Adjustment defines - -#define ADJUSTMENT_NONE 0x00000000UL -#define ADJUSTMENT_DRAWMODE 0x00000001UL -#define ADJUSTMENT_COLORS 0x00000002UL -#define ADJUSTMENT_MIRROR 0x00000004UL -#define ADJUSTMENT_ROTATE 0x00000008UL -#define ADJUSTMENT_TRANSPARENCY 0x00000010UL -#define ADJUSTMENT_ALL 0xFFFFFFFFUL +enum class GraphicAdjustmentFlags +{ + NONE = 0x00, + DRAWMODE = 0x01, + COLORS = 0x02, + MIRROR = 0x04, + ROTATE = 0x08, + TRANSPARENCY = 0x10, + ALL = 0x1f, +}; +namespace o3tl +{ + template<> struct typed_flags<GraphicAdjustmentFlags> : is_typed_flags<GraphicAdjustmentFlags, 0x1f> {}; +} enum GraphicDrawMode { @@ -566,17 +572,17 @@ private: static void SVT_DLLPRIVATE ImplAdjust( BitmapEx& rBmpEx, const GraphicAttr& rAttr, - sal_uLong nAdjustmentFlags + GraphicAdjustmentFlags nAdjustmentFlags ); static void SVT_DLLPRIVATE ImplAdjust( GDIMetaFile& rMtf, const GraphicAttr& rAttr, - sal_uLong nAdjustmentFlags + GraphicAdjustmentFlags nAdjustmentFlags ); static void SVT_DLLPRIVATE ImplAdjust( Animation& rAnimation, const GraphicAttr& rAttr, - sal_uLong nAdjustmentFlags + GraphicAdjustmentFlags nAdjustmentFlags ); static void SVT_DLLPRIVATE ImplDraw( diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx index 2c2a72fd3d5b..b74c32486607 100644 --- a/svtools/source/graphic/grfmgr.cxx +++ b/svtools/source/graphic/grfmgr.cxx @@ -956,21 +956,21 @@ Graphic GraphicObject::GetTransformedGraphic( const GraphicAttr* pAttr ) const / if( IsAnimated() ) { Animation aAnimation( maGraphic.GetAnimation() ); - GraphicManager::ImplAdjust( aAnimation, aAttr, ADJUSTMENT_ALL ); + GraphicManager::ImplAdjust( aAnimation, aAttr, GraphicAdjustmentFlags::ALL ); aAnimation.SetLoopCount( mnAnimationLoopCount ); aGraphic = aAnimation; } else { BitmapEx aBmpEx( maGraphic.GetBitmapEx() ); - GraphicManager::ImplAdjust( aBmpEx, aAttr, ADJUSTMENT_ALL ); + GraphicManager::ImplAdjust( aBmpEx, aAttr, GraphicAdjustmentFlags::ALL ); aGraphic = aBmpEx; } } else { GDIMetaFile aMtf( maGraphic.GetGDIMetaFile() ); - GraphicManager::ImplAdjust( aMtf, aAttr, ADJUSTMENT_ALL ); + GraphicManager::ImplAdjust( aMtf, aAttr, GraphicAdjustmentFlags::ALL ); aGraphic = aMtf; } } diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx index a77d26ffef05..06f0397c5b4e 100644 --- a/svtools/source/graphic/grfmgr2.cxx +++ b/svtools/source/graphic/grfmgr2.cxx @@ -998,7 +998,7 @@ bool GraphicManager::ImplCreateOutput( OutputDevice* pOutputDevice, { // Attribute adjustment if necessary if( rAttributes.IsSpecialDrawMode() || rAttributes.IsAdjusted() || rAttributes.IsTransparent() ) - ImplAdjust( aOutBmpEx, rAttributes, ADJUSTMENT_DRAWMODE | ADJUSTMENT_COLORS | ADJUSTMENT_TRANSPARENCY ); + ImplAdjust( aOutBmpEx, rAttributes, GraphicAdjustmentFlags::DRAWMODE | GraphicAdjustmentFlags::COLORS | GraphicAdjustmentFlags::TRANSPARENCY ); // OutDev adjustment if necessary if( pOutputDevice->GetOutDevType() != OUTDEV_PRINTER && pOutputDevice->GetBitCount() <= 8 && aOutBmpEx.GetBitCount() >= 8 ) @@ -1388,7 +1388,7 @@ bool GraphicManager::ImplCreateOutput( OutputDevice* pOut, if( nNumBitmaps != 1 || bNonBitmapActionEncountered ) { if( rAttr.IsSpecialDrawMode() || rAttr.IsAdjusted() || rAttr.IsMirrored() || rAttr.IsRotated() || rAttr.IsTransparent() ) - ImplAdjust( rOutMtf, rAttr, ADJUSTMENT_ALL ); + ImplAdjust( rOutMtf, rAttr, GraphicAdjustmentFlags::ALL ); ImplDraw( pOut, rPt, rSz, rOutMtf, rAttr ); rOutBmpEx = BitmapEx(); @@ -1397,11 +1397,11 @@ bool GraphicManager::ImplCreateOutput( OutputDevice* pOut, return true; } -void GraphicManager::ImplAdjust( BitmapEx& rBmpEx, const GraphicAttr& rAttr, sal_uLong nAdjustmentFlags ) +void GraphicManager::ImplAdjust( BitmapEx& rBmpEx, const GraphicAttr& rAttr, GraphicAdjustmentFlags nAdjustmentFlags ) { GraphicAttr aAttr( rAttr ); - if( ( nAdjustmentFlags & ADJUSTMENT_DRAWMODE ) && aAttr.IsSpecialDrawMode() ) + if( ( nAdjustmentFlags & GraphicAdjustmentFlags::DRAWMODE ) && aAttr.IsSpecialDrawMode() ) { switch( aAttr.GetDrawMode() ) { @@ -1425,24 +1425,24 @@ void GraphicManager::ImplAdjust( BitmapEx& rBmpEx, const GraphicAttr& rAttr, sal } } - if( ( nAdjustmentFlags & ADJUSTMENT_COLORS ) && aAttr.IsAdjusted() ) + if( ( nAdjustmentFlags & GraphicAdjustmentFlags::COLORS ) && aAttr.IsAdjusted() ) { rBmpEx.Adjust( aAttr.GetLuminance(), aAttr.GetContrast(), aAttr.GetChannelR(), aAttr.GetChannelG(), aAttr.GetChannelB(), aAttr.GetGamma(), aAttr.IsInvert() ); } - if( ( nAdjustmentFlags & ADJUSTMENT_MIRROR ) && aAttr.IsMirrored() ) + if( ( nAdjustmentFlags & GraphicAdjustmentFlags::MIRROR ) && aAttr.IsMirrored() ) { rBmpEx.Mirror( aAttr.GetMirrorFlags() ); } - if( ( nAdjustmentFlags & ADJUSTMENT_ROTATE ) && aAttr.IsRotated() ) + if( ( nAdjustmentFlags & GraphicAdjustmentFlags::ROTATE ) && aAttr.IsRotated() ) { rBmpEx.Rotate( aAttr.GetRotation(), Color( COL_TRANSPARENT ) ); } - if( ( nAdjustmentFlags & ADJUSTMENT_TRANSPARENCY ) && aAttr.IsTransparent() ) + if( ( nAdjustmentFlags & GraphicAdjustmentFlags::TRANSPARENCY ) && aAttr.IsTransparent() ) { AlphaMask aAlpha; sal_uInt8 cTrans = aAttr.GetTransparency(); @@ -1500,11 +1500,11 @@ void GraphicManager::ImplAdjust( BitmapEx& rBmpEx, const GraphicAttr& rAttr, sal } } -void GraphicManager::ImplAdjust( GDIMetaFile& rMtf, const GraphicAttr& rAttr, sal_uLong nAdjustmentFlags ) +void GraphicManager::ImplAdjust( GDIMetaFile& rMtf, const GraphicAttr& rAttr, GraphicAdjustmentFlags nAdjustmentFlags ) { GraphicAttr aAttr( rAttr ); - if( ( nAdjustmentFlags & ADJUSTMENT_DRAWMODE ) && aAttr.IsSpecialDrawMode() ) + if( ( nAdjustmentFlags & GraphicAdjustmentFlags::DRAWMODE ) && aAttr.IsSpecialDrawMode() ) { switch( aAttr.GetDrawMode() ) { @@ -1528,34 +1528,34 @@ void GraphicManager::ImplAdjust( GDIMetaFile& rMtf, const GraphicAttr& rAttr, sa } } - if( ( nAdjustmentFlags & ADJUSTMENT_COLORS ) && aAttr.IsAdjusted() ) + if( ( nAdjustmentFlags & GraphicAdjustmentFlags::COLORS ) && aAttr.IsAdjusted() ) { rMtf.Adjust( aAttr.GetLuminance(), aAttr.GetContrast(), aAttr.GetChannelR(), aAttr.GetChannelG(), aAttr.GetChannelB(), aAttr.GetGamma(), aAttr.IsInvert() ); } - if( ( nAdjustmentFlags & ADJUSTMENT_MIRROR ) && aAttr.IsMirrored() ) + if( ( nAdjustmentFlags & GraphicAdjustmentFlags::MIRROR ) && aAttr.IsMirrored() ) { rMtf.Mirror( aAttr.GetMirrorFlags() ); } - if( ( nAdjustmentFlags & ADJUSTMENT_ROTATE ) && aAttr.IsRotated() ) + if( ( nAdjustmentFlags & GraphicAdjustmentFlags::ROTATE ) && aAttr.IsRotated() ) { rMtf.Rotate( aAttr.GetRotation() ); } - if( ( nAdjustmentFlags & ADJUSTMENT_TRANSPARENCY ) && aAttr.IsTransparent() ) + if( ( nAdjustmentFlags & GraphicAdjustmentFlags::TRANSPARENCY ) && aAttr.IsTransparent() ) { OSL_FAIL( "Missing implementation: Mtf-Transparency" ); } } -void GraphicManager::ImplAdjust( Animation& rAnimation, const GraphicAttr& rAttr, sal_uLong nAdjustmentFlags ) +void GraphicManager::ImplAdjust( Animation& rAnimation, const GraphicAttr& rAttr, GraphicAdjustmentFlags nAdjustmentFlags ) { GraphicAttr aAttr( rAttr ); - if( ( nAdjustmentFlags & ADJUSTMENT_DRAWMODE ) && aAttr.IsSpecialDrawMode() ) + if( ( nAdjustmentFlags & GraphicAdjustmentFlags::DRAWMODE ) && aAttr.IsSpecialDrawMode() ) { switch( aAttr.GetDrawMode() ) { @@ -1579,24 +1579,24 @@ void GraphicManager::ImplAdjust( Animation& rAnimation, const GraphicAttr& rAttr } } - if( ( nAdjustmentFlags & ADJUSTMENT_COLORS ) && aAttr.IsAdjusted() ) + if( ( nAdjustmentFlags & GraphicAdjustmentFlags::COLORS ) && aAttr.IsAdjusted() ) { rAnimation.Adjust( aAttr.GetLuminance(), aAttr.GetContrast(), aAttr.GetChannelR(), aAttr.GetChannelG(), aAttr.GetChannelB(), aAttr.GetGamma(), aAttr.IsInvert() ); } - if( ( nAdjustmentFlags & ADJUSTMENT_MIRROR ) && aAttr.IsMirrored() ) + if( ( nAdjustmentFlags & GraphicAdjustmentFlags::MIRROR ) && aAttr.IsMirrored() ) { rAnimation.Mirror( aAttr.GetMirrorFlags() ); } - if( ( nAdjustmentFlags & ADJUSTMENT_ROTATE ) && aAttr.IsRotated() ) + if( ( nAdjustmentFlags & GraphicAdjustmentFlags::ROTATE ) && aAttr.IsRotated() ) { OSL_FAIL( "Missing implementation: Animation-Rotation" ); } - if( ( nAdjustmentFlags & ADJUSTMENT_TRANSPARENCY ) && aAttr.IsTransparent() ) + if( ( nAdjustmentFlags & GraphicAdjustmentFlags::TRANSPARENCY ) && aAttr.IsTransparent() ) { OSL_FAIL( "Missing implementation: Animation-Transparency" ); } |