[Libreoffice-commits] .: svtools/inc svtools/source
Joseph Powers
jpowers at kemper.freedesktop.org
Wed Jul 13 20:26:40 PDT 2011
svtools/inc/svtools/grfmgr.hxx | 8 ++++--
svtools/source/graphic/grfmgr2.cxx | 44 +++++++++++++++++++++----------------
2 files changed, 30 insertions(+), 22 deletions(-)
New commits:
commit e93a9aacc450c98b1b064dc8129b18e7ca54d88b
Author: Joseph Powers <jpowers27 at cox.net>
Date: Wed Jul 13 19:59:10 2011 -0700
Replace List with std::vector< GraphicObject* >
diff --git a/svtools/inc/svtools/grfmgr.hxx b/svtools/inc/svtools/grfmgr.hxx
index d48d828..f756005 100644
--- a/svtools/inc/svtools/grfmgr.hxx
+++ b/svtools/inc/svtools/grfmgr.hxx
@@ -548,6 +548,8 @@ public:
// - GraphicManager -
// ------------------
+typedef ::std::vector< GraphicObject* > GraphicObjectList_impl;
+
class SVT_DLLPUBLIC GraphicManager
{
friend class GraphicObject;
@@ -555,8 +557,8 @@ class SVT_DLLPUBLIC GraphicManager
private:
- List maObjList;
- GraphicCache* mpCache;
+ GraphicObjectList_impl maObjList;
+ GraphicCache* mpCache;
GraphicManager( const GraphicManager& ) {}
GraphicManager& operator=( const GraphicManager& ) { return *this; }
@@ -652,7 +654,7 @@ private:
const GraphicObject* pCopyObj = NULL
);
void SVT_DLLPRIVATE ImplUnregisterObj( const GraphicObject& rObj );
- inline sal_Bool SVT_DLLPRIVATE ImplHasObjects() const { return( maObjList.Count() > 0UL ); }
+ inline sal_Bool SVT_DLLPRIVATE ImplHasObjects() const { return !maObjList.empty(); }
// Only used in swap case by GraphicObject
void SVT_DLLPRIVATE ImplGraphicObjectWasSwappedOut( const GraphicObject& rObj );
diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx
index d1a6205..4ef795b 100644
--- a/svtools/source/graphic/grfmgr2.cxx
+++ b/svtools/source/graphic/grfmgr2.cxx
@@ -122,8 +122,8 @@ GraphicManager::GraphicManager( sal_uLong nCacheSize, sal_uLong nMaxObjCacheSize
GraphicManager::~GraphicManager()
{
- for( void* pObj = maObjList.First(); pObj; pObj = maObjList.Next() )
- ( (GraphicObject*) pObj )->GraphicManagerDestroyed();
+ for( size_t i = 0, n = maObjList.size(); i < n; ++i )
+ maObjList[ i ]->GraphicManagerDestroyed();
delete mpCache;
}
@@ -158,9 +158,9 @@ sal_uLong GraphicManager::GetMaxObjCacheSize() const
// -----------------------------------------------------------------------------
-sal_uLong GraphicManager::GetUsedCacheSize() const
-{
- return mpCache->GetUsedDisplayCacheSize();
+sal_uLong GraphicManager::GetUsedCacheSize() const
+{
+ return mpCache->GetUsedDisplayCacheSize();
}
// -----------------------------------------------------------------------------
@@ -201,7 +201,7 @@ void GraphicManager::ReleaseFromCache( const GraphicObject& /*rObj*/ )
// -----------------------------------------------------------------------------
sal_Bool GraphicManager::IsInCache( OutputDevice* pOut, const Point& rPt,
- const Size& rSz, const GraphicObject& rObj,
+ const Size& rSz, const GraphicObject& rObj,
const GraphicAttr& rAttr ) const
{
return mpCache->IsInDisplayCache( pOut, rPt, rSz, rObj, rAttr );
@@ -236,7 +236,7 @@ sal_Bool GraphicManager::DrawObj( OutputDevice* pOut, const Point& rPt, const Si
if( aGraphic.IsSupportedGraphic() )
{
const sal_uInt16 nRot10 = rAttr.GetRotation() % 3600;
-
+
if( nRot10 )
{
Polygon aPoly( Rectangle( aPt, aSz ) );
@@ -271,7 +271,7 @@ sal_Bool GraphicManager::DrawObj( OutputDevice* pOut, const Point& rPt, const Si
void GraphicManager::ImplRegisterObj( const GraphicObject& rObj, Graphic& rSubstitute,
const ByteString* pID, const GraphicObject* pCopyObj )
{
- maObjList.Insert( (void*) &rObj, LIST_APPEND );
+ maObjList.push_back( (GraphicObject*)&rObj );
mpCache->AddGraphicObject( rObj, rSubstitute, pID, pCopyObj );
}
@@ -280,7 +280,13 @@ void GraphicManager::ImplRegisterObj( const GraphicObject& rObj, Graphic& rSubst
void GraphicManager::ImplUnregisterObj( const GraphicObject& rObj )
{
mpCache->ReleaseGraphicObject( rObj );
- maObjList.Remove( (void*) &rObj );
+ for( GraphicObjectList_impl::iterator it = maObjList.begin(); it < maObjList.end(); ++it )
+ {
+ if ( *it == &rObj ) {
+ maObjList.erase( it );
+ break;
+ }
+ }
}
// -----------------------------------------------------------------------------
@@ -315,7 +321,7 @@ void GraphicManager::ImplGraphicObjectWasSwappedIn( const GraphicObject& rObj )
sal_Bool GraphicManager::ImplDraw( OutputDevice* pOut, const Point& rPt,
const Size& rSz, GraphicObject& rObj,
- const GraphicAttr& rAttr,
+ const GraphicAttr& rAttr,
const sal_uLong nFlags, sal_Bool& rCached )
{
const Graphic& rGraphic = rObj.GetGraphic();
@@ -394,7 +400,7 @@ sal_Bool GraphicManager::ImplDraw( OutputDevice* pOut, const Point& rPt,
// -----------------------------------------------------------------------------
-sal_Bool GraphicManager::ImplCreateOutput( OutputDevice* pOut,
+sal_Bool GraphicManager::ImplCreateOutput( OutputDevice* pOut,
const Point& rPt, const Size& rSz,
const BitmapEx& rBmpEx, const GraphicAttr& rAttr,
const sal_uLong nFlags, BitmapEx* pBmpEx )
@@ -1925,9 +1931,9 @@ struct ImplTileInfo
};
-bool GraphicObject::ImplRenderTempTile( VirtualDevice& rVDev, int nExponent,
- int nNumTilesX, int nNumTilesY,
- const Size& rTileSizePixel,
+bool GraphicObject::ImplRenderTempTile( VirtualDevice& rVDev, int nExponent,
+ int nNumTilesX, int nNumTilesY,
+ const Size& rTileSizePixel,
const GraphicAttr* pAttr, sal_uLong nFlags )
{
if( nExponent <= 1 )
@@ -1969,9 +1975,9 @@ bool GraphicObject::ImplRenderTempTile( VirtualDevice& rVDev, int nExponent,
// size is given by the decimal place of the corresponding decimal
// representation.
bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent, int nMSBFactor,
- int nNumOrigTilesX, int nNumOrigTilesY,
- int nRemainderTilesX, int nRemainderTilesY,
- const Size& rTileSizePixel, const GraphicAttr* pAttr,
+ int nNumOrigTilesX, int nNumOrigTilesY,
+ int nRemainderTilesX, int nRemainderTilesY,
+ const Size& rTileSizePixel, const GraphicAttr* pAttr,
sal_uLong nFlags, ImplTileInfo& rTileInfo )
{
// gets loaded with our tile bitmap
@@ -2256,8 +2262,8 @@ bool GraphicObject::ImplDrawTiled( OutputDevice* pOut, const Rectangle& rArea, c
// -----------------------------------------------------------------------------
-bool GraphicObject::ImplDrawTiled( OutputDevice& rOut, const Point& rPosPixel,
- int nNumTilesX, int nNumTilesY,
+bool GraphicObject::ImplDrawTiled( OutputDevice& rOut, const Point& rPosPixel,
+ int nNumTilesX, int nNumTilesY,
const Size& rTileSizePixel, const GraphicAttr* pAttr, sal_uLong nFlags )
{
Point aCurrPos( rPosPixel );
More information about the Libreoffice-commits
mailing list