libreoffice/libreoffice-3.3.1.2-make-sure-this-is-thread-safe.patch

56 lines
1.8 KiB
Diff
Raw Permalink Normal View History

--- 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 <basegfx/polygon/b2dpolygontools.hxx>
#include <osl/diagnose.h>
#include <rtl/math.hxx>
+#include <rtl/instance.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <basegfx/range/b2drange.hxx>
@@ -1836,22 +1837,31 @@
return aRetval;
}
- B2DPolygon createUnitPolygon()
+ namespace
{
- static B2DPolygon aRetval;
-
- if(!aRetval.count())
+ struct theUnitPolygon :
+ public rtl::StaticWithInit<B2DPolygon, theUnitPolygon>
{
- 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 )