summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorJoseph Powers <jpowers27@cox.net>2011-07-23 05:27:53 -0700
committerJoseph Powers <jpowers27@cox.net>2011-07-23 05:27:53 -0700
commitc8d8c442760f35b48606b9dfbec80ac217e0752d (patch)
treecf228de7e2161c4e3933ea7a47731ad52ae89a5d /svtools
parent8ebb30fbc4e2f33bf76ccbacf1b569d68ae46e62 (diff)
Replace List with std::vector< BSaveStruct* >
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/filter/wmf/enhwmf.cxx51
-rw-r--r--svtools/source/filter/wmf/winmtf.cxx26
-rw-r--r--svtools/source/filter/wmf/winmtf.hxx15
-rw-r--r--svtools/source/filter/wmf/winwmf.cxx25
4 files changed, 76 insertions, 41 deletions
diff --git a/svtools/source/filter/wmf/enhwmf.cxx b/svtools/source/filter/wmf/enhwmf.cxx
index ce7842b0c270..654f8a19a5c0 100644
--- a/svtools/source/filter/wmf/enhwmf.cxx
+++ b/svtools/source/filter/wmf/enhwmf.cxx
@@ -376,8 +376,11 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
break;
}
- if( aBmpSaveList.Count() && ( nRecType != EMR_STRETCHBLT ) && ( nRecType != EMR_STRETCHDIBITS ) )
- pOut->ResolveBitmapActions( aBmpSaveList );
+ if( !aBmpSaveList.empty()
+ && ( nRecType != EMR_STRETCHBLT )
+ && ( nRecType != EMR_STRETCHDIBITS )
+ )
+ pOut->ResolveBitmapActions( aBmpSaveList );
bFlag = sal_False;
@@ -1016,7 +1019,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
/* Pseudocomment to add more context so that make patch.unapply
* works better. Ha!
*/
- aBmpSaveList.Insert( new BSaveStruct( aBitmap, aRect, dwRop, pOut->GetFillStyle () ), LIST_APPEND );
+ aBmpSaveList.push_back( new BSaveStruct( aBitmap, aRect, dwRop, pOut->GetFillStyle () ) );
}
}
}
@@ -1029,8 +1032,20 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
sal_uInt32 nStart = pWMF->Tell() - 8;
pWMF->SeekRel( 0x10 );
- *pWMF >> xDest >> yDest >> xSrc >> ySrc >> cxSrc >> cySrc >> offBmiSrc >> cbBmiSrc >> offBitsSrc
- >> cbBitsSrc >> iUsageSrc >> dwRop >> cxDest >> cyDest;
+ *pWMF >> xDest
+ >> yDest
+ >> xSrc
+ >> ySrc
+ >> cxSrc
+ >> cySrc
+ >> offBmiSrc
+ >> cbBmiSrc
+ >> offBitsSrc
+ >> cbBitsSrc
+ >> iUsageSrc
+ >> dwRop
+ >> cxDest
+ >> cyDest;
Bitmap aBitmap;
Rectangle aRect( Point( xDest, yDest ), Size( cxDest+1, cyDest+1 ) );
@@ -1038,8 +1053,12 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
cxDest = abs( (int)cxDest ); // sj: i37894, size can be negative
cyDest = abs( (int)cyDest ); // and also 122889
- if ( (cbBitsSrc > (SAL_MAX_UINT32 - 14)) || ((SAL_MAX_UINT32 - 14) - cbBitsSrc < cbBmiSrc) )
+ if ( ((SAL_MAX_UINT32 - 14) < cbBitsSrc)
+ || ((SAL_MAX_UINT32 - 14) - cbBitsSrc < cbBmiSrc )
+ )
+ {
bStatus = sal_False;
+ }
else
{
sal_uInt32 nSize = cbBmiSrc + cbBitsSrc + 14;
@@ -1071,7 +1090,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
aBitmap.Crop( aCropRect );
}
/* Another pseudocomment to make make patch.unapply work better */
- aBmpSaveList.Insert( new BSaveStruct( aBitmap, aRect, dwRop, pOut->GetFillStyle () ), LIST_APPEND );
+ aBmpSaveList.push_back( new BSaveStruct( aBitmap, aRect, dwRop, pOut->GetFillStyle () ) );
}
}
}
@@ -1083,9 +1102,19 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
if ( ( nIndex & ENHMETA_STOCK_OBJECT ) == 0 )
{
LOGFONTW aLogFont;
- *pWMF >> aLogFont.lfHeight >> aLogFont.lfWidth >> aLogFont.lfEscapement >> aLogFont.lfOrientation >> aLogFont.lfWeight >> aLogFont.lfItalic
- >> aLogFont.lfUnderline >> aLogFont.lfStrikeOut >> aLogFont.lfCharSet >> aLogFont.lfOutPrecision >> aLogFont.lfClipPrecision
- >> aLogFont.lfQuality >> aLogFont.lfPitchAndFamily;
+ *pWMF >> aLogFont.lfHeight
+ >> aLogFont.lfWidth
+ >> aLogFont.lfEscapement
+ >> aLogFont.lfOrientation
+ >> aLogFont.lfWeight
+ >> aLogFont.lfItalic
+ >> aLogFont.lfUnderline
+ >> aLogFont.lfStrikeOut
+ >> aLogFont.lfCharSet
+ >> aLogFont.lfOutPrecision
+ >> aLogFont.lfClipPrecision
+ >> aLogFont.lfQuality
+ >> aLogFont.lfPitchAndFamily;
sal_Unicode lfFaceName[ LF_FACESIZE ];
@@ -1451,7 +1480,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
}
pWMF->Seek( nNextPos );
}
- if( aBmpSaveList.Count() )
+ if( !aBmpSaveList.empty() )
pOut->ResolveBitmapActions( aBmpSaveList );
if ( bStatus )
diff --git a/svtools/source/filter/wmf/winmtf.cxx b/svtools/source/filter/wmf/winmtf.cxx
index d2a4b0ec50c2..48acdcb9f52b 100644
--- a/svtools/source/filter/wmf/winmtf.cxx
+++ b/svtools/source/filter/wmf/winmtf.cxx
@@ -1682,19 +1682,20 @@ void WinMtfOutput::ImplDrawBitmap( const Point& rPos, const Size& rSize, const B
//-----------------------------------------------------------------------------------
-void WinMtfOutput::ResolveBitmapActions( List& rSaveList )
+void WinMtfOutput::ResolveBitmapActions( BSaveStructList_impl& rSaveList )
{
UpdateClipRegion();
- sal_uInt32 nObjects = rSaveList.Count();
- sal_uInt32 nObjectsLeft = nObjects;
+ size_t nObjects = rSaveList.size();
+ size_t nObjectsLeft = nObjects;
while ( nObjectsLeft )
{
- sal_uInt32 i, nObjectsOfSameSize = 0;
- sal_uInt32 nObjectStartIndex = nObjects - nObjectsLeft;
+ size_t i;
+ size_t nObjectsOfSameSize = 0;
+ size_t nObjectStartIndex = nObjects - nObjectsLeft;
- BSaveStruct* pSave = (BSaveStruct*)rSaveList.GetObject( nObjectStartIndex );
+ BSaveStruct* pSave = rSaveList[ nObjectStartIndex ];
Rectangle aRect( pSave->aOutRect );
for ( i = nObjectStartIndex; i < nObjects; )
@@ -1702,7 +1703,7 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList )
nObjectsOfSameSize++;
if ( ++i < nObjects )
{
- pSave = (BSaveStruct*)rSaveList.GetObject( i );
+ pSave = rSaveList[ i ];
if ( pSave->aOutRect != aRect )
break;
}
@@ -1712,7 +1713,7 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList )
for ( i = nObjectStartIndex; i < ( nObjectStartIndex + nObjectsOfSameSize ); i++ )
{
- pSave = (BSaveStruct*)rSaveList.GetObject( i );
+ pSave = rSaveList[ i ];
sal_uInt32 nWinRop = pSave->nWinRop;
sal_uInt8 nRasterOperation = (sal_uInt8)( nWinRop >> 16 );
@@ -1740,7 +1741,7 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList )
{
if ( nObjectsOfSameSize == 2 )
{
- BSaveStruct* pSave2 = (BSaveStruct*)rSaveList.GetObject( i + 1 );
+ BSaveStruct* pSave2 = rSaveList[ i + 1 ];
if ( ( pSave->aBmp.GetPrefSize() == pSave2->aBmp.GetPrefSize() ) &&
( pSave->aBmp.GetPrefMapMode() == pSave2->aBmp.GetPrefMapMode() ) )
{
@@ -1900,10 +1901,9 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList )
nObjectsLeft -= nObjectsOfSameSize;
}
- void* pPtr;
- for ( pPtr = rSaveList.First(); pPtr; pPtr = rSaveList.Next() )
- delete (BSaveStruct*)pPtr;
- rSaveList.Clear();
+ for( size_t i = 0, n = rSaveList.size(); i < n; ++i )
+ delete rSaveList[ i ];
+ rSaveList.clear();
}
//-----------------------------------------------------------------------------------
diff --git a/svtools/source/filter/wmf/winmtf.hxx b/svtools/source/filter/wmf/winmtf.hxx
index 270af93a4675..cd9e82b832b8 100644
--- a/svtools/source/filter/wmf/winmtf.hxx
+++ b/svtools/source/filter/wmf/winmtf.hxx
@@ -537,6 +537,8 @@ struct BSaveStruct
{}
};
+typedef ::std::vector< BSaveStruct* > BSaveStructList_impl;
+
// -----------------------------------------------------------------------------
enum GDIObjectType {
@@ -754,7 +756,7 @@ public:
sal_Bool bRecordPath = sal_False,
sal_Int32 nGraphicsMode = GM_COMPATIBLE
);
- void ResolveBitmapActions( List& rSaveList );
+ void ResolveBitmapActions( BSaveStructList_impl& rSaveList );
void IntersectClipRect( const Rectangle& rRect );
void ExcludeClipRect( const Rectangle& rRect );
@@ -780,11 +782,11 @@ class WinMtf
{
protected:
- WinMtfOutput* pOut; //
- SvStream* pWMF; // Die einzulesende WMF/EMF-Datei
+ WinMtfOutput* pOut;
+ SvStream* pWMF; // Die einzulesende WMF/EMF-Datei
- sal_uInt32 nStartPos, nEndPos;
- List aBmpSaveList;
+ sal_uInt32 nStartPos, nEndPos;
+ BSaveStructList_impl aBmpSaveList;
FilterConfigItem* pFilterConfigItem;
@@ -801,9 +803,6 @@ protected:
FilterConfigItem* pConfigItem = NULL
);
~WinMtf();
-
-public:
-
};
//============================ EMFReader ==================================
diff --git a/svtools/source/filter/wmf/winwmf.cxx b/svtools/source/filter/wmf/winwmf.cxx
index a794da5b3274..8ca9c0ac6d19 100644
--- a/svtools/source/filter/wmf/winwmf.cxx
+++ b/svtools/source/filter/wmf/winwmf.cxx
@@ -571,7 +571,7 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
aBmp.Crop( aCropRect );
}
Rectangle aDestRect( aPoint, Size( nSxe, nSye ) );
- aBmpSaveList.Insert( new BSaveStruct( aBmp, aDestRect, nWinROP, pOut->GetFillStyle () ), LIST_APPEND );
+ aBmpSaveList.push_back( new BSaveStruct( aBmp, aDestRect, nWinROP, pOut->GetFillStyle () ) );
}
}
}
@@ -621,7 +621,7 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
Rectangle aCropRect( Point( nSx, nSy ), Size( nSxe, nSye ) );
aBmp.Crop( aCropRect );
}
- aBmpSaveList.Insert( new BSaveStruct( aBmp, aDestRect, nWinROP, pOut->GetFillStyle () ), LIST_APPEND );
+ aBmpSaveList.push_back( new BSaveStruct( aBmp, aDestRect, nWinROP, pOut->GetFillStyle () ) );
}
}
}
@@ -1121,9 +1121,14 @@ void WMFReader::ReadWMF(WMF_APMFILEHEADER *pAPMHeader)
}
*pWMF >> nRecSize >> nFunction;
- if( pWMF->GetError() || ( nRecSize < 3 ) || ( nRecSize==3 && nFunction==0 ) || pWMF->IsEof() )
+ if( pWMF->GetError()
+ || ( nRecSize < 3 )
+ || ( nRecSize == 3
+ && nFunction == 0
+ )
+ || pWMF->IsEof()
+ )
{
-
if( pWMF->IsEof() )
pWMF->SetError( SVSTREAM_FILEFORMAT_ERROR );
@@ -1131,13 +1136,15 @@ void WMFReader::ReadWMF(WMF_APMFILEHEADER *pAPMHeader)
}
if ( !bEMFAvailable )
{
- if( aBmpSaveList.Count() &&
- ( nFunction != W_META_STRETCHDIB ) &&
- ( nFunction != W_META_DIBBITBLT ) &&
- ( nFunction != W_META_DIBSTRETCHBLT ) )
+ if( !aBmpSaveList.empty()
+ && ( nFunction != W_META_STRETCHDIB )
+ && ( nFunction != W_META_DIBBITBLT )
+ && ( nFunction != W_META_DIBSTRETCHBLT )
+ )
{
pOut->ResolveBitmapActions( aBmpSaveList );
}
+
if ( !nSkipActions )
ReadRecordParams( nFunction );
else
@@ -1181,7 +1188,7 @@ void WMFReader::ReadWMF(WMF_APMFILEHEADER *pAPMHeader)
else
pWMF->SetError( SVSTREAM_GENERALERROR );
- if( !pWMF->GetError() && aBmpSaveList.Count() )
+ if( !pWMF->GetError() && !aBmpSaveList.empty() )
pOut->ResolveBitmapActions( aBmpSaveList );
}
if ( pWMF->GetError() )