Kaydet (Commit) 699ba641 authored tarafından Noel Grandin's avatar Noel Grandin

convert ADJUSTMENT_ flags to scoped enum

Change-Id: I2b3d50eb7cbc3abc4cdc7e94219852f678b45e13
üst 24724aad
...@@ -46,14 +46,20 @@ namespace o3tl ...@@ -46,14 +46,20 @@ namespace o3tl
#define GRFMGR_AUTOSWAPSTREAM_NONE reinterpret_cast<SvStream*>(sal_IntPtr(-1)) #define GRFMGR_AUTOSWAPSTREAM_NONE reinterpret_cast<SvStream*>(sal_IntPtr(-1))
// Adjustment defines // Adjustment defines
enum class GraphicAdjustmentFlags
#define ADJUSTMENT_NONE 0x00000000UL {
#define ADJUSTMENT_DRAWMODE 0x00000001UL NONE = 0x00,
#define ADJUSTMENT_COLORS 0x00000002UL DRAWMODE = 0x01,
#define ADJUSTMENT_MIRROR 0x00000004UL COLORS = 0x02,
#define ADJUSTMENT_ROTATE 0x00000008UL MIRROR = 0x04,
#define ADJUSTMENT_TRANSPARENCY 0x00000010UL ROTATE = 0x08,
#define ADJUSTMENT_ALL 0xFFFFFFFFUL TRANSPARENCY = 0x10,
ALL = 0x1f,
};
namespace o3tl
{
template<> struct typed_flags<GraphicAdjustmentFlags> : is_typed_flags<GraphicAdjustmentFlags, 0x1f> {};
}
enum GraphicDrawMode enum GraphicDrawMode
{ {
...@@ -566,17 +572,17 @@ private: ...@@ -566,17 +572,17 @@ private:
static void SVT_DLLPRIVATE ImplAdjust( static void SVT_DLLPRIVATE ImplAdjust(
BitmapEx& rBmpEx, BitmapEx& rBmpEx,
const GraphicAttr& rAttr, const GraphicAttr& rAttr,
sal_uLong nAdjustmentFlags GraphicAdjustmentFlags nAdjustmentFlags
); );
static void SVT_DLLPRIVATE ImplAdjust( static void SVT_DLLPRIVATE ImplAdjust(
GDIMetaFile& rMtf, GDIMetaFile& rMtf,
const GraphicAttr& rAttr, const GraphicAttr& rAttr,
sal_uLong nAdjustmentFlags GraphicAdjustmentFlags nAdjustmentFlags
); );
static void SVT_DLLPRIVATE ImplAdjust( static void SVT_DLLPRIVATE ImplAdjust(
Animation& rAnimation, Animation& rAnimation,
const GraphicAttr& rAttr, const GraphicAttr& rAttr,
sal_uLong nAdjustmentFlags GraphicAdjustmentFlags nAdjustmentFlags
); );
static void SVT_DLLPRIVATE ImplDraw( static void SVT_DLLPRIVATE ImplDraw(
......
...@@ -956,21 +956,21 @@ Graphic GraphicObject::GetTransformedGraphic( const GraphicAttr* pAttr ) const / ...@@ -956,21 +956,21 @@ Graphic GraphicObject::GetTransformedGraphic( const GraphicAttr* pAttr ) const /
if( IsAnimated() ) if( IsAnimated() )
{ {
Animation aAnimation( maGraphic.GetAnimation() ); Animation aAnimation( maGraphic.GetAnimation() );
GraphicManager::ImplAdjust( aAnimation, aAttr, ADJUSTMENT_ALL ); GraphicManager::ImplAdjust( aAnimation, aAttr, GraphicAdjustmentFlags::ALL );
aAnimation.SetLoopCount( mnAnimationLoopCount ); aAnimation.SetLoopCount( mnAnimationLoopCount );
aGraphic = aAnimation; aGraphic = aAnimation;
} }
else else
{ {
BitmapEx aBmpEx( maGraphic.GetBitmapEx() ); BitmapEx aBmpEx( maGraphic.GetBitmapEx() );
GraphicManager::ImplAdjust( aBmpEx, aAttr, ADJUSTMENT_ALL ); GraphicManager::ImplAdjust( aBmpEx, aAttr, GraphicAdjustmentFlags::ALL );
aGraphic = aBmpEx; aGraphic = aBmpEx;
} }
} }
else else
{ {
GDIMetaFile aMtf( maGraphic.GetGDIMetaFile() ); GDIMetaFile aMtf( maGraphic.GetGDIMetaFile() );
GraphicManager::ImplAdjust( aMtf, aAttr, ADJUSTMENT_ALL ); GraphicManager::ImplAdjust( aMtf, aAttr, GraphicAdjustmentFlags::ALL );
aGraphic = aMtf; aGraphic = aMtf;
} }
} }
......
...@@ -998,7 +998,7 @@ bool GraphicManager::ImplCreateOutput( OutputDevice* pOutputDevice, ...@@ -998,7 +998,7 @@ bool GraphicManager::ImplCreateOutput( OutputDevice* pOutputDevice,
{ {
// Attribute adjustment if necessary // Attribute adjustment if necessary
if( rAttributes.IsSpecialDrawMode() || rAttributes.IsAdjusted() || rAttributes.IsTransparent() ) 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 // OutDev adjustment if necessary
if( pOutputDevice->GetOutDevType() != OUTDEV_PRINTER && pOutputDevice->GetBitCount() <= 8 && aOutBmpEx.GetBitCount() >= 8 ) if( pOutputDevice->GetOutDevType() != OUTDEV_PRINTER && pOutputDevice->GetBitCount() <= 8 && aOutBmpEx.GetBitCount() >= 8 )
...@@ -1388,7 +1388,7 @@ bool GraphicManager::ImplCreateOutput( OutputDevice* pOut, ...@@ -1388,7 +1388,7 @@ bool GraphicManager::ImplCreateOutput( OutputDevice* pOut,
if( nNumBitmaps != 1 || bNonBitmapActionEncountered ) if( nNumBitmaps != 1 || bNonBitmapActionEncountered )
{ {
if( rAttr.IsSpecialDrawMode() || rAttr.IsAdjusted() || rAttr.IsMirrored() || rAttr.IsRotated() || rAttr.IsTransparent() ) 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 ); ImplDraw( pOut, rPt, rSz, rOutMtf, rAttr );
rOutBmpEx = BitmapEx(); rOutBmpEx = BitmapEx();
...@@ -1397,11 +1397,11 @@ bool GraphicManager::ImplCreateOutput( OutputDevice* pOut, ...@@ -1397,11 +1397,11 @@ bool GraphicManager::ImplCreateOutput( OutputDevice* pOut,
return true; 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 ); GraphicAttr aAttr( rAttr );
if( ( nAdjustmentFlags & ADJUSTMENT_DRAWMODE ) && aAttr.IsSpecialDrawMode() ) if( ( nAdjustmentFlags & GraphicAdjustmentFlags::DRAWMODE ) && aAttr.IsSpecialDrawMode() )
{ {
switch( aAttr.GetDrawMode() ) switch( aAttr.GetDrawMode() )
{ {
...@@ -1425,24 +1425,24 @@ void GraphicManager::ImplAdjust( BitmapEx& rBmpEx, const GraphicAttr& rAttr, sal ...@@ -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(), rBmpEx.Adjust( aAttr.GetLuminance(), aAttr.GetContrast(),
aAttr.GetChannelR(), aAttr.GetChannelG(), aAttr.GetChannelB(), aAttr.GetChannelR(), aAttr.GetChannelG(), aAttr.GetChannelB(),
aAttr.GetGamma(), aAttr.IsInvert() ); aAttr.GetGamma(), aAttr.IsInvert() );
} }
if( ( nAdjustmentFlags & ADJUSTMENT_MIRROR ) && aAttr.IsMirrored() ) if( ( nAdjustmentFlags & GraphicAdjustmentFlags::MIRROR ) && aAttr.IsMirrored() )
{ {
rBmpEx.Mirror( aAttr.GetMirrorFlags() ); rBmpEx.Mirror( aAttr.GetMirrorFlags() );
} }
if( ( nAdjustmentFlags & ADJUSTMENT_ROTATE ) && aAttr.IsRotated() ) if( ( nAdjustmentFlags & GraphicAdjustmentFlags::ROTATE ) && aAttr.IsRotated() )
{ {
rBmpEx.Rotate( aAttr.GetRotation(), Color( COL_TRANSPARENT ) ); rBmpEx.Rotate( aAttr.GetRotation(), Color( COL_TRANSPARENT ) );
} }
if( ( nAdjustmentFlags & ADJUSTMENT_TRANSPARENCY ) && aAttr.IsTransparent() ) if( ( nAdjustmentFlags & GraphicAdjustmentFlags::TRANSPARENCY ) && aAttr.IsTransparent() )
{ {
AlphaMask aAlpha; AlphaMask aAlpha;
sal_uInt8 cTrans = aAttr.GetTransparency(); sal_uInt8 cTrans = aAttr.GetTransparency();
...@@ -1500,11 +1500,11 @@ void GraphicManager::ImplAdjust( BitmapEx& rBmpEx, const GraphicAttr& rAttr, sal ...@@ -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 ); GraphicAttr aAttr( rAttr );
if( ( nAdjustmentFlags & ADJUSTMENT_DRAWMODE ) && aAttr.IsSpecialDrawMode() ) if( ( nAdjustmentFlags & GraphicAdjustmentFlags::DRAWMODE ) && aAttr.IsSpecialDrawMode() )
{ {
switch( aAttr.GetDrawMode() ) switch( aAttr.GetDrawMode() )
{ {
...@@ -1528,34 +1528,34 @@ void GraphicManager::ImplAdjust( GDIMetaFile& rMtf, const GraphicAttr& rAttr, sa ...@@ -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(), rMtf.Adjust( aAttr.GetLuminance(), aAttr.GetContrast(),
aAttr.GetChannelR(), aAttr.GetChannelG(), aAttr.GetChannelB(), aAttr.GetChannelR(), aAttr.GetChannelG(), aAttr.GetChannelB(),
aAttr.GetGamma(), aAttr.IsInvert() ); aAttr.GetGamma(), aAttr.IsInvert() );
} }
if( ( nAdjustmentFlags & ADJUSTMENT_MIRROR ) && aAttr.IsMirrored() ) if( ( nAdjustmentFlags & GraphicAdjustmentFlags::MIRROR ) && aAttr.IsMirrored() )
{ {
rMtf.Mirror( aAttr.GetMirrorFlags() ); rMtf.Mirror( aAttr.GetMirrorFlags() );
} }
if( ( nAdjustmentFlags & ADJUSTMENT_ROTATE ) && aAttr.IsRotated() ) if( ( nAdjustmentFlags & GraphicAdjustmentFlags::ROTATE ) && aAttr.IsRotated() )
{ {
rMtf.Rotate( aAttr.GetRotation() ); rMtf.Rotate( aAttr.GetRotation() );
} }
if( ( nAdjustmentFlags & ADJUSTMENT_TRANSPARENCY ) && aAttr.IsTransparent() ) if( ( nAdjustmentFlags & GraphicAdjustmentFlags::TRANSPARENCY ) && aAttr.IsTransparent() )
{ {
OSL_FAIL( "Missing implementation: Mtf-Transparency" ); 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 ); GraphicAttr aAttr( rAttr );
if( ( nAdjustmentFlags & ADJUSTMENT_DRAWMODE ) && aAttr.IsSpecialDrawMode() ) if( ( nAdjustmentFlags & GraphicAdjustmentFlags::DRAWMODE ) && aAttr.IsSpecialDrawMode() )
{ {
switch( aAttr.GetDrawMode() ) switch( aAttr.GetDrawMode() )
{ {
...@@ -1579,24 +1579,24 @@ void GraphicManager::ImplAdjust( Animation& rAnimation, const GraphicAttr& rAttr ...@@ -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(), rAnimation.Adjust( aAttr.GetLuminance(), aAttr.GetContrast(),
aAttr.GetChannelR(), aAttr.GetChannelG(), aAttr.GetChannelB(), aAttr.GetChannelR(), aAttr.GetChannelG(), aAttr.GetChannelB(),
aAttr.GetGamma(), aAttr.IsInvert() ); aAttr.GetGamma(), aAttr.IsInvert() );
} }
if( ( nAdjustmentFlags & ADJUSTMENT_MIRROR ) && aAttr.IsMirrored() ) if( ( nAdjustmentFlags & GraphicAdjustmentFlags::MIRROR ) && aAttr.IsMirrored() )
{ {
rAnimation.Mirror( aAttr.GetMirrorFlags() ); rAnimation.Mirror( aAttr.GetMirrorFlags() );
} }
if( ( nAdjustmentFlags & ADJUSTMENT_ROTATE ) && aAttr.IsRotated() ) if( ( nAdjustmentFlags & GraphicAdjustmentFlags::ROTATE ) && aAttr.IsRotated() )
{ {
OSL_FAIL( "Missing implementation: Animation-Rotation" ); OSL_FAIL( "Missing implementation: Animation-Rotation" );
} }
if( ( nAdjustmentFlags & ADJUSTMENT_TRANSPARENCY ) && aAttr.IsTransparent() ) if( ( nAdjustmentFlags & GraphicAdjustmentFlags::TRANSPARENCY ) && aAttr.IsTransparent() )
{ {
OSL_FAIL( "Missing implementation: Animation-Transparency" ); OSL_FAIL( "Missing implementation: Animation-Transparency" );
} }
......
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