summaryrefslogtreecommitdiffstats
path: root/basegfx/source/polygon
diff options
context:
space:
mode:
Diffstat (limited to 'basegfx/source/polygon')
-rw-r--r--basegfx/source/polygon/b2dlinegeometry.cxx3
-rw-r--r--basegfx/source/polygon/b2dpolygon.cxx21
-rw-r--r--basegfx/source/polygon/b2dpolygonclipper.cxx3
-rw-r--r--basegfx/source/polygon/b2dpolygoncutandtouch.cxx3
-rw-r--r--basegfx/source/polygon/b2dpolygontools.cxx37
-rw-r--r--basegfx/source/polygon/b2dpolygontriangulator.cxx3
-rw-r--r--basegfx/source/polygon/b2dpolypolygon.cxx5
-rw-r--r--basegfx/source/polygon/b2dpolypolygoncutter.cxx7
-rw-r--r--basegfx/source/polygon/b2dpolypolygonrasterconverter.cxx10
-rw-r--r--basegfx/source/polygon/b2dpolypolygontools.cxx3
-rw-r--r--basegfx/source/polygon/b2dsvgpolypolygon.cxx11
-rw-r--r--basegfx/source/polygon/b2dtrapezoid.cxx12
-rw-r--r--basegfx/source/polygon/b3dpolygon.cxx9
-rw-r--r--basegfx/source/polygon/b3dpolygonclipper.cxx3
-rw-r--r--basegfx/source/polygon/b3dpolygontools.cxx3
-rw-r--r--basegfx/source/polygon/b3dpolypolygon.cxx3
-rw-r--r--basegfx/source/polygon/b3dpolypolygontools.cxx3
17 files changed, 99 insertions, 40 deletions
diff --git a/basegfx/source/polygon/b2dlinegeometry.cxx b/basegfx/source/polygon/b2dlinegeometry.cxx
index 0db5efbfb86d..97551ff95c36 100644
--- a/basegfx/source/polygon/b2dlinegeometry.cxx
+++ b/basegfx/source/polygon/b2dlinegeometry.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -723,3 +724,5 @@ namespace basegfx
//////////////////////////////////////////////////////////////////////////////
// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx
index d8255dc7ec10..a7524ddcf5fe 100644
--- a/basegfx/source/polygon/b2dpolygon.cxx
+++ b/basegfx/source/polygon/b2dpolygon.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -167,8 +168,8 @@ public:
for(sal_uInt32 a(0); a < nHalfSize; a++)
{
::std::swap(*aStart, *aEnd);
- aStart++;
- aEnd--;
+ ++aStart;
+ --aEnd;
}
}
}
@@ -209,7 +210,7 @@ public:
CoordinateData2DVector::iterator aStart(maVector.begin());
CoordinateData2DVector::iterator aEnd(maVector.end());
- for(; aStart != aEnd; aStart++)
+ for(; aStart != aEnd; ++aStart)
{
aStart->transform(rMatrix);
}
@@ -256,6 +257,8 @@ class ControlVectorPair2D
basegfx::B2DVector maNextVector;
public:
+ ControlVectorPair2D() {}
+
const basegfx::B2DVector& getPrevVector() const
{
return maPrevVector;
@@ -314,7 +317,7 @@ public:
aEnd += nCount;
maVector.reserve(nCount);
- for(; aStart != aEnd; aStart++)
+ for(; aStart != aEnd; ++aStart)
{
if(!aStart->getPrevVector().equalZero())
mnUsedVectors++;
@@ -446,7 +449,7 @@ public:
ControlVectorPair2DVector::const_iterator aEnd(rSource.maVector.end());
maVector.insert(aIndex, aStart, aEnd);
- for(; aStart != aEnd; aStart++)
+ for(; aStart != aEnd; ++aStart)
{
if(!aStart->getPrevVector().equalZero())
mnUsedVectors++;
@@ -465,7 +468,7 @@ public:
const ControlVectorPair2DVector::iterator aDeleteEnd(aDeleteStart + nCount);
ControlVectorPair2DVector::const_iterator aStart(aDeleteStart);
- for(; mnUsedVectors && aStart != aDeleteEnd; aStart++)
+ for(; mnUsedVectors && aStart != aDeleteEnd; ++aStart)
{
if(!aStart->getPrevVector().equalZero())
mnUsedVectors--;
@@ -498,8 +501,8 @@ public:
// swap entries
::std::swap(*aStart, *aEnd);
- aStart++;
- aEnd--;
+ ++aStart;
+ --aEnd;
}
if(aStart == aEnd)
@@ -1650,3 +1653,5 @@ namespace basegfx
//////////////////////////////////////////////////////////////////////////////
// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basegfx/source/polygon/b2dpolygonclipper.cxx b/basegfx/source/polygon/b2dpolygonclipper.cxx
index 6e5c7701e2ec..e368f7dbb3bd 100644
--- a/basegfx/source/polygon/b2dpolygonclipper.cxx
+++ b/basegfx/source/polygon/b2dpolygonclipper.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -871,3 +872,5 @@ namespace basegfx
//////////////////////////////////////////////////////////////////////////////
// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
index e03aadfe1577..ac118e73356f 100644
--- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
+++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -1299,3 +1300,5 @@ namespace basegfx
//////////////////////////////////////////////////////////////////////////////
// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx
index e9db491ecd48..eb96cec171e9 100644
--- a/basegfx/source/polygon/b2dpolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolygontools.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,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>
@@ -1835,22 +1837,31 @@ namespace basegfx
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 );
- }
+ 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 ) );
- return aRetval;
+ // close
+ aRetval.setClosed( true );
+
+ return aRetval;
+ }
+ };
+ }
+
+ B2DPolygon createUnitPolygon()
+ {
+ return theUnitPolygon::get();
}
B2DPolygon createPolygonFromCircle( const B2DPoint& rCenter, double fRadius )
@@ -3611,3 +3622,5 @@ namespace basegfx
//////////////////////////////////////////////////////////////////////////////
// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basegfx/source/polygon/b2dpolygontriangulator.cxx b/basegfx/source/polygon/b2dpolygontriangulator.cxx
index 83fcc036c996..2454a3d1ab58 100644
--- a/basegfx/source/polygon/b2dpolygontriangulator.cxx
+++ b/basegfx/source/polygon/b2dpolygontriangulator.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -464,3 +465,5 @@ namespace basegfx
//////////////////////////////////////////////////////////////////////////////
// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx
index 9b28dffd19af..4c8ab7b44a45 100644
--- a/basegfx/source/polygon/b2dpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dpolypolygon.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -104,7 +105,7 @@ public:
for(sal_uInt32 a(0L); a < nCount; a++)
{
aIndex = maPolygons.insert(aIndex, rPolyPolygon.getB2DPolygon(a));
- aIndex++;
+ ++aIndex;
}
}
}
@@ -430,3 +431,5 @@ namespace basegfx
} // end of namespace basegfx
// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basegfx/source/polygon/b2dpolypolygoncutter.cxx b/basegfx/source/polygon/b2dpolypolygoncutter.cxx
index 4f9cf3a75f72..1b15b953e29e 100644
--- a/basegfx/source/polygon/b2dpolypolygoncutter.cxx
+++ b/basegfx/source/polygon/b2dpolypolygoncutter.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -932,7 +933,7 @@ namespace basegfx
// first step: prepareForPolygonOperation and simple merge of non-overlapping
// PolyPolygons for speedup; this is possible for the wanted OR-operation
- if(aInput.size())
+ if(!aInput.empty())
{
std::vector< basegfx::B2DPolyPolygon > aResult;
aResult.reserve(aInput.size());
@@ -941,7 +942,7 @@ namespace basegfx
{
const basegfx::B2DPolyPolygon aCandidate(prepareForPolygonOperation(aInput[a]));
- if(aResult.size())
+ if(!aResult.empty())
{
const B2DRange aCandidateRange(aCandidate.getB2DRange());
bool bCouldMergeSimple(false);
@@ -1012,3 +1013,5 @@ namespace basegfx
//////////////////////////////////////////////////////////////////////////////
// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basegfx/source/polygon/b2dpolypolygonrasterconverter.cxx b/basegfx/source/polygon/b2dpolypolygonrasterconverter.cxx
index b795c04e158e..95c310b7dcc9 100644
--- a/basegfx/source/polygon/b2dpolypolygonrasterconverter.cxx
+++ b/basegfx/source/polygon/b2dpolypolygonrasterconverter.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -349,12 +350,12 @@ namespace basegfx
return 0.0f;
}
- bool isEnded()
+ bool isEnded() const
{
return mnYCounter<=0;
}
- bool isDownwards()
+ bool isDownwards() const
{
return mbDownwards;
}
@@ -590,8 +591,7 @@ namespace basegfx
switch( eFillRule )
{
default:
- OSL_ENSURE(false,
- "B2DPolyPolygonRasterConverter::rasterConvert(): Unexpected fill rule");
+ OSL_FAIL("B2DPolyPolygonRasterConverter::rasterConvert(): Unexpected fill rule");
return;
case FillRule_EVEN_ODD:
@@ -700,3 +700,5 @@ namespace basegfx
}
}
// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basegfx/source/polygon/b2dpolypolygontools.cxx b/basegfx/source/polygon/b2dpolypolygontools.cxx
index dcfa34f93c02..06e9da5fa305 100644
--- a/basegfx/source/polygon/b2dpolypolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolypolygontools.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -583,3 +584,5 @@ namespace basegfx
//////////////////////////////////////////////////////////////////////////////
// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basegfx/source/polygon/b2dsvgpolypolygon.cxx b/basegfx/source/polygon/b2dsvgpolypolygon.cxx
index d2815337edaf..50a04dbaa075 100644
--- a/basegfx/source/polygon/b2dsvgpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dsvgpolypolygon.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -786,9 +787,9 @@ namespace basegfx
// (since
// createPolygonFromEllipseSegment()
// normalizes to e.g. cw arc)
- const bool bFlipSegment( (bLargeArcFlag!=0) ==
- (fmod(fTheta2+2*M_PI-fTheta1,
- 2*M_PI)<M_PI) );
+ const bool bLessThanPi(fmod(fTheta2+2*M_PI-fTheta1,
+ 2*M_PI)<M_PI);
+ const bool bFlipSegment( (bLargeArcFlag!=0) == bLessThanPi );
if( bFlipSegment )
std::swap(fTheta1,fTheta2);
@@ -825,7 +826,7 @@ namespace basegfx
default:
{
- OSL_ENSURE(false, "importFromSvgD(): skipping tags in svg:d element (unknown)!");
+ OSL_FAIL("importFromSvgD(): skipping tags in svg:d element (unknown)!");
OSL_TRACE("importFromSvgD(): skipping tags in svg:d element (unknown: \"%c\")!", aCurrChar);
++nPos;
break;
@@ -1106,3 +1107,5 @@ namespace basegfx
}
// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basegfx/source/polygon/b2dtrapezoid.cxx b/basegfx/source/polygon/b2dtrapezoid.cxx
index d89ec7c6cf73..ad9c2dbecce4 100644
--- a/basegfx/source/polygon/b2dtrapezoid.cxx
+++ b/basegfx/source/polygon/b2dtrapezoid.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -6,9 +7,6 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: b2dpolygontriangulator.cxx,v $
- * $Revision: 1.7 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -223,7 +221,7 @@ namespace basegfx
// Loop while new entry is bigger, use operator<
while(aCurrent != maTrDeEdgeEntries.end() && (*aCurrent) < rNewEdge)
{
- aCurrent++;
+ ++aCurrent;
}
// Insert before first which is smaller or equal or at end
@@ -624,7 +622,7 @@ namespace basegfx
// to not have an endless loop and start next. During development
// i constantly had breakpoints here, so i am sure enough to add an
// assertion here
- OSL_ENSURE(false, "Trapeziod decomposer in illegal state (!)");
+ OSL_FAIL("Trapeziod decomposer in illegal state (!)");
maTrDeEdgeEntries.pop_front();
continue;
}
@@ -638,7 +636,7 @@ namespace basegfx
// line; consume the single edge to not have an endless loop and start
// next. During development i constantly had breakpoints here, so i am
// sure enough to add an assertion here
- OSL_ENSURE(false, "Trapeziod decomposer in illegal state (!)");
+ OSL_FAIL("Trapeziod decomposer in illegal state (!)");
maTrDeEdgeEntries.pop_front();
continue;
}
@@ -1226,3 +1224,5 @@ namespace basegfx
//////////////////////////////////////////////////////////////////////////////
// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basegfx/source/polygon/b3dpolygon.cxx b/basegfx/source/polygon/b3dpolygon.cxx
index 1985d3301d4b..06d01fc4cc29 100644
--- a/basegfx/source/polygon/b3dpolygon.cxx
+++ b/basegfx/source/polygon/b3dpolygon.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -241,8 +242,8 @@ public:
for(sal_uInt32 a(0); a < nHalfSize; a++)
{
::std::swap(*aStart, *aEnd);
- aStart++;
- aEnd--;
+ ++aStart;
+ --aEnd;
}
}
}
@@ -252,7 +253,7 @@ public:
CoordinateData3DVector::iterator aStart(maVector.begin());
CoordinateData3DVector::iterator aEnd(maVector.end());
- for(; aStart != aEnd; aStart++)
+ for(; aStart != aEnd; ++aStart)
{
aStart->transform(rMatrix);
}
@@ -1814,3 +1815,5 @@ namespace basegfx
//////////////////////////////////////////////////////////////////////////////
// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basegfx/source/polygon/b3dpolygonclipper.cxx b/basegfx/source/polygon/b3dpolygonclipper.cxx
index 88ebf12dae7b..c0b36ccf5205 100644
--- a/basegfx/source/polygon/b3dpolygonclipper.cxx
+++ b/basegfx/source/polygon/b3dpolygonclipper.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -572,3 +573,5 @@ namespace basegfx
//////////////////////////////////////////////////////////////////////////////
// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basegfx/source/polygon/b3dpolygontools.cxx b/basegfx/source/polygon/b3dpolygontools.cxx
index 77bbbd379d3c..ce76c3503dbf 100644
--- a/basegfx/source/polygon/b3dpolygontools.cxx
+++ b/basegfx/source/polygon/b3dpolygontools.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -1261,3 +1262,5 @@ namespace basegfx
//////////////////////////////////////////////////////////////////////////////
// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basegfx/source/polygon/b3dpolypolygon.cxx b/basegfx/source/polygon/b3dpolypolygon.cxx
index a29680b14a59..3a736573c8e7 100644
--- a/basegfx/source/polygon/b3dpolypolygon.cxx
+++ b/basegfx/source/polygon/b3dpolypolygon.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -444,3 +445,5 @@ namespace basegfx
} // end of namespace basegfx
// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basegfx/source/polygon/b3dpolypolygontools.cxx b/basegfx/source/polygon/b3dpolypolygontools.cxx
index d86a4526acfd..1cff2eaf1765 100644
--- a/basegfx/source/polygon/b3dpolypolygontools.cxx
+++ b/basegfx/source/polygon/b3dpolypolygontools.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -554,3 +555,5 @@ namespace basegfx
//////////////////////////////////////////////////////////////////////////////
// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */