--- basegfx/source/polygon/b2dpolygontools.cxx 2010-11-11 16:22:47.000000000 +0100 +++ basegfx/source/polygon/b2dpolygontools.cxx-gil 2011-03-15 02:12:41.000000000 +0100 @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -1836,22 +1837,31 @@ return aRetval; } - B2DPolygon createUnitPolygon() + namespace { - static B2DPolygon aRetval; - - if(!aRetval.count()) + struct theUnitPolygon : + public rtl::StaticWithInit { - aRetval.append( B2DPoint( 0.0, 0.0 ) ); - aRetval.append( B2DPoint( 1.0, 0.0 ) ); - aRetval.append( B2DPoint( 1.0, 1.0 ) ); - aRetval.append( B2DPoint( 0.0, 1.0 ) ); + B2DPolygon operator () () + { + B2DPolygon aRetval; - // close - aRetval.setClosed( true ); - } - - return aRetval; + aRetval.append( B2DPoint( 0.0, 0.0 ) ); + aRetval.append( B2DPoint( 1.0, 0.0 ) ); + aRetval.append( B2DPoint( 1.0, 1.0 ) ); + aRetval.append( B2DPoint( 0.0, 1.0 ) ); + + // close + aRetval.setClosed( true ); + + return aRetval; + } + }; + } + + B2DPolygon createUnitPolygon() + { + return theUnitPolygon::get(); } B2DPolygon createPolygonFromCircle( const B2DPoint& rCenter, double fRadius )