diff options
author | Noel Grandin <noel@peralex.com> | 2015-05-06 09:00:50 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-05-06 09:01:31 +0200 |
commit | 662fc8eaa94d766104bced33c18b4718722c6692 (patch) | |
tree | bdf3c702a3e1991e6e20cfd2d10615bf844930df /svtools | |
parent | b13fbd19b7282a1210a2e14bb5ede9ecdf944c1c (diff) |
convert BMP_MIRROR constants to scoped enum
and fix bug in svx/source/xoutdev/_xoutbmp.cxx,XOutBitmap::MirrorGraphic
where it was not correctly translating between different flags types.
Change-Id: I78b4965544da2aa54b67ec18307fa54c8ffc3aee
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/brwbox/editbrowsebox.cxx | 2 | ||||
-rw-r--r-- | svtools/source/graphic/grfattr.cxx | 11 | ||||
-rw-r--r-- | svtools/source/graphic/grfmgr.cxx | 8 | ||||
-rw-r--r-- | svtools/source/graphic/grfmgr2.cxx | 8 | ||||
-rw-r--r-- | svtools/source/toolpanel/paneltabbar.cxx | 4 |
5 files changed, 17 insertions, 16 deletions
diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx index d206ca7dfbed..f250efebfde9 100644 --- a/svtools/source/brwbox/editbrowsebox.cxx +++ b/svtools/source/brwbox/editbrowsebox.cxx @@ -333,7 +333,7 @@ namespace svt if ( bNeedMirror ) { BitmapEx aBitmap( aImage.GetBitmapEx() ); - aBitmap.Mirror( BMP_MIRROR_HORZ ); + aBitmap.Mirror( BmpMirrorFlags::Horizontal ); aImage = Image( aBitmap ); } return aImage; diff --git a/svtools/source/graphic/grfattr.cxx b/svtools/source/graphic/grfattr.cxx index 29e5e50b0bdd..26001ee13da0 100644 --- a/svtools/source/graphic/grfattr.cxx +++ b/svtools/source/graphic/grfattr.cxx @@ -27,7 +27,7 @@ GraphicAttr::GraphicAttr() : mfGamma ( 1.0 ), - mnMirrFlags ( 0 ), + mnMirrFlags ( BmpMirrorFlags::NONE ), mnLeftCrop ( 0 ), mnTopCrop ( 0 ), mnRightCrop ( 0 ), @@ -76,10 +76,11 @@ bool GraphicAttr::operator==( const GraphicAttr& rAttr ) const SvStream& ReadGraphicAttr( SvStream& rIStm, GraphicAttr& rAttr ) { VersionCompat aCompat( rIStm, StreamMode::READ ); - sal_uInt32 nTmp32; - sal_uInt16 nTmp16; + sal_uInt32 nTmp32, nTmpMirrFlags; + sal_uInt16 nTmp16; - rIStm.ReadUInt32( nTmp32 ).ReadUInt32( nTmp32 ).ReadDouble( rAttr.mfGamma ).ReadUInt32( rAttr.mnMirrFlags ).ReadUInt16( rAttr.mnRotate10 ); + rIStm.ReadUInt32( nTmp32 ).ReadUInt32( nTmp32 ).ReadDouble( rAttr.mfGamma ).ReadUInt32( nTmpMirrFlags ).ReadUInt16( rAttr.mnRotate10 ); + rAttr.mnMirrFlags = static_cast<BmpMirrorFlags>(nTmpMirrFlags); rIStm.ReadInt16( rAttr.mnContPercent ).ReadInt16( rAttr.mnLumPercent ).ReadInt16( rAttr.mnRPercent ).ReadInt16( rAttr.mnGPercent ).ReadInt16( rAttr.mnBPercent ); rIStm.ReadCharAsBool( rAttr.mbInvert ).ReadUChar( rAttr.mcTransparency ).ReadUInt16( nTmp16 ); rAttr.meDrawMode = (GraphicDrawMode) nTmp16; @@ -106,7 +107,7 @@ SvStream& WriteGraphicAttr( SvStream& rOStm, const GraphicAttr& rAttr ) rOStm.WriteUInt32( nTmp32 ).WriteUInt32( nTmp32 ); rOStm.WriteDouble( rAttr.mfGamma ); - rOStm.WriteUInt32( rAttr.mnMirrFlags ).WriteUInt16( rAttr.mnRotate10 ); + rOStm.WriteUInt32( static_cast<sal_uInt32>(rAttr.mnMirrFlags) ).WriteUInt16( rAttr.mnRotate10 ); rOStm.WriteInt16( rAttr.mnContPercent ).WriteInt16( rAttr.mnLumPercent ).WriteInt16( rAttr.mnRPercent ).WriteInt16( rAttr.mnGPercent ).WriteInt16( rAttr.mnBPercent ); rOStm.WriteBool( rAttr.mbInvert ).WriteUChar( rAttr.mcTransparency ).WriteUInt16( rAttr.meDrawMode ); rOStm.WriteInt32( rAttr.mnLeftCrop ) diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx index 4d60d73ddcaf..f6eae59e5281 100644 --- a/svtools/source/graphic/grfmgr.cxx +++ b/svtools/source/graphic/grfmgr.cxx @@ -303,7 +303,7 @@ bool GraphicObject::ImplGetCropParams( OutputDevice* pOut, Point& rPt, Size& rSz if( aSize100.Width() > 0 && aSize100.Height() > 0 && nTotalWidth > 0 && nTotalHeight > 0 ) { double fScale = (double) aSize100.Width() / nTotalWidth; - const long nNewLeft = -FRound( ( ( pAttr->GetMirrorFlags() & BMP_MIRROR_HORZ ) ? pAttr->GetRightCrop() : pAttr->GetLeftCrop() ) * fScale ); + const long nNewLeft = -FRound( ( ( pAttr->GetMirrorFlags() & BmpMirrorFlags::Horizontal ) ? pAttr->GetRightCrop() : pAttr->GetLeftCrop() ) * fScale ); const long nNewRight = nNewLeft + FRound( aSize100.Width() * fScale ) - 1; fScale = (double) rSz.Width() / aSize100.Width(); @@ -311,7 +311,7 @@ bool GraphicObject::ImplGetCropParams( OutputDevice* pOut, Point& rPt, Size& rSz rSz.Width() = FRound( ( nNewRight - nNewLeft + 1 ) * fScale ); fScale = (double) aSize100.Height() / nTotalHeight; - const long nNewTop = -FRound( ( ( pAttr->GetMirrorFlags() & BMP_MIRROR_VERT ) ? pAttr->GetBottomCrop() : pAttr->GetTopCrop() ) * fScale ); + const long nNewTop = -FRound( ( ( pAttr->GetMirrorFlags() & BmpMirrorFlags::Vertical ) ? pAttr->GetBottomCrop() : pAttr->GetTopCrop() ) * fScale ); const long nNewBottom = nNewTop + FRound( aSize100.Height() * fScale ) - 1; fScale = (double) rSz.Height() / aSize100.Height(); @@ -531,7 +531,7 @@ bool GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz, { aPt.X() += aSz.Width() + 1; aSz.Width() = -aSz.Width(); - aAttr.SetMirrorFlags( aAttr.GetMirrorFlags() ^ BMP_MIRROR_HORZ ); + aAttr.SetMirrorFlags( aAttr.GetMirrorFlags() ^ BmpMirrorFlags::Horizontal ); } // mirrored vertically @@ -539,7 +539,7 @@ bool GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz, { aPt.Y() += aSz.Height() + 1; aSz.Height() = -aSz.Height(); - aAttr.SetMirrorFlags( aAttr.GetMirrorFlags() ^ BMP_MIRROR_VERT ); + aAttr.SetMirrorFlags( aAttr.GetMirrorFlags() ^ BmpMirrorFlags::Vertical ); } if( bCropped ) diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx index 46b48091fb9f..202528d2e42e 100644 --- a/svtools/source/graphic/grfmgr2.cxx +++ b/svtools/source/graphic/grfmgr2.cxx @@ -331,8 +331,8 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib long nX, nY, nTmpX, nTmpY, nTmpFX, nTmpFY, nTmp; double fTmp; - bool bHMirr = ( rAttributes.GetMirrorFlags() & BMP_MIRROR_HORZ ) != 0; - bool bVMirr = ( rAttributes.GetMirrorFlags() & BMP_MIRROR_VERT ) != 0; + bool bHMirr( rAttributes.GetMirrorFlags() & BmpMirrorFlags::Horizontal ); + bool bVMirr( rAttributes.GetMirrorFlags() & BmpMirrorFlags::Vertical ); boost::scoped_array<long> pMapIX(new long[ aUnrotatedWidth ]); boost::scoped_array<long> pMapFX(new long[ aUnrotatedWidth ]); @@ -905,8 +905,8 @@ bool GraphicManager::ImplCreateOutput( OutputDevice* pOutputDevice, const long nW = rBmpSzPix.Width(); const long nH = rBmpSzPix.Height(); long nStartX = -1, nStartY = -1, nEndX = -1, nEndY = -1; - bool bHMirr = ( rAttributes.GetMirrorFlags() & BMP_MIRROR_HORZ ) != 0; - bool bVMirr = ( rAttributes.GetMirrorFlags() & BMP_MIRROR_VERT ) != 0; + bool bHMirr( rAttributes.GetMirrorFlags() & BmpMirrorFlags::Horizontal ); + bool bVMirr( rAttributes.GetMirrorFlags() & BmpMirrorFlags::Vertical ); // calculate output sizes if( !pBmpEx ) diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index 069211cf3143..62dccf961263 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -721,11 +721,11 @@ namespace svt { aBitmap.Rotate( 2700, COL_BLACK ); if ( m_eTabAlignment == TABS_LEFT ) - aBitmap.Mirror( BMP_MIRROR_HORZ ); + aBitmap.Mirror( BmpMirrorFlags::Horizontal ); } else if ( m_eTabAlignment == TABS_BOTTOM ) { - aBitmap.Mirror( BMP_MIRROR_VERT ); + aBitmap.Mirror( BmpMirrorFlags::Vertical ); } const Rectangle aActualRect( m_aNormalizer.getTransformed( i_rLogicalRect, m_eTabAlignment ) ); |