diff options
Diffstat (limited to 'basegfx/source')
68 files changed, 1662 insertions, 1662 deletions
diff --git a/basegfx/source/color/bcolor.cxx b/basegfx/source/color/bcolor.cxx index b02ccac901ed..37f7facd3fe3 100644 --- a/basegfx/source/color/bcolor.cxx +++ b/basegfx/source/color/bcolor.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/basegfx/source/color/bcolormodifier.cxx b/basegfx/source/color/bcolormodifier.cxx index d58672b72681..45b6c9088db7 100644 --- a/basegfx/source/color/bcolormodifier.cxx +++ b/basegfx/source/color/bcolormodifier.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/basegfx/source/color/bcolortools.cxx b/basegfx/source/color/bcolortools.cxx index d1fa6aa7ad0f..07e5af4187d8 100644 --- a/basegfx/source/color/bcolortools.cxx +++ b/basegfx/source/color/bcolortools.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -47,7 +47,7 @@ namespace basegfx { namespace tools double h=0, s=0, l=0; l = (maxVal + minVal) / 2.0; - + if( ::basegfx::fTools::equalZero(d) ) { s = h = 0; // hue undefined (achromatic case) @@ -88,7 +88,7 @@ namespace basegfx { namespace tools return nValue2; else if( nHue < 240.0 ) return nValue1 + (nValue2 - nValue1)*(240.0 - nHue)/60.0; - else + else return nValue1; } @@ -104,16 +104,16 @@ namespace basegfx { namespace tools return BColor( hsl2rgbHelper(nVal2, - nVal1, + nVal1, h + 120.0), - hsl2rgbHelper(nVal2, + hsl2rgbHelper(nVal2, nVal1, h), hsl2rgbHelper(nVal2, nVal1, h - 120.0) ); } - + BColor rgb2hsv(const BColor& rRGBColor) { const double r=rRGBColor.getRed(), g=rRGBColor.getGreen(), b=rRGBColor.getBlue(); diff --git a/basegfx/source/curve/b2dbeziertools.cxx b/basegfx/source/curve/b2dbeziertools.cxx index 2865d18aaa17..e8f2e71fb4b1 100644 --- a/basegfx/source/curve/b2dbeziertools.cxx +++ b/basegfx/source/curve/b2dbeziertools.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -37,7 +37,7 @@ namespace basegfx { B2DCubicBezierHelper::B2DCubicBezierHelper(const B2DCubicBezier& rBase, sal_uInt32 nDivisions) - : maLengthArray(), + : maLengthArray(), mnEdgeCount(0) { const bool bIsBezier(rBase.isBezier()); @@ -115,7 +115,7 @@ namespace basegfx // not a bezier, linear edge return fDistance / fLength; } - + // it is a bezier ::std::vector< double >::const_iterator aIter = ::std::lower_bound(maLengthArray.begin(), maLengthArray.end(), fDistance); const sal_uInt32 nIndex(aIter - maLengthArray.begin()); diff --git a/basegfx/source/curve/b2dcubicbezier.cxx b/basegfx/source/curve/b2dcubicbezier.cxx index 3e7fdedeeee8..7d55f6fd10f6 100644 --- a/basegfx/source/curve/b2dcubicbezier.cxx +++ b/basegfx/source/curve/b2dcubicbezier.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -35,8 +35,8 @@ #include <limits> -// #i37443# -#define FACTOR_FOR_UNSHARPEN (1.6) +// #i37443# +#define FACTOR_FOR_UNSHARPEN (1.6) #ifdef DBG_UTIL static double fMultFactUnsharpen = FACTOR_FOR_UNSHARPEN; #endif @@ -48,21 +48,21 @@ namespace basegfx namespace { void ImpSubDivAngle( - const B2DPoint& rfPA, // start point - const B2DPoint& rfEA, // edge on A - const B2DPoint& rfEB, // edge on B - const B2DPoint& rfPB, // end point - B2DPolygon& rTarget, // target polygon - double fAngleBound, // angle bound in [0.0 .. 2PI] - bool bAllowUnsharpen, // #i37443# allow the criteria to get unsharp in recursions - sal_uInt16 nMaxRecursionDepth) // endless loop protection + const B2DPoint& rfPA, // start point + const B2DPoint& rfEA, // edge on A + const B2DPoint& rfEB, // edge on B + const B2DPoint& rfPB, // end point + B2DPolygon& rTarget, // target polygon + double fAngleBound, // angle bound in [0.0 .. 2PI] + bool bAllowUnsharpen, // #i37443# allow the criteria to get unsharp in recursions + sal_uInt16 nMaxRecursionDepth) // endless loop protection { if(nMaxRecursionDepth) { // do angle test B2DVector aLeft(rfEA - rfPA); B2DVector aRight(rfEB - rfPB); - + // #i72104# if(aLeft.equalZero()) { @@ -118,13 +118,13 @@ namespace basegfx } void ImpSubDivAngleStart( - const B2DPoint& rfPA, // start point - const B2DPoint& rfEA, // edge on A - const B2DPoint& rfEB, // edge on B - const B2DPoint& rfPB, // end point - B2DPolygon& rTarget, // target polygon - const double& rfAngleBound, // angle bound in [0.0 .. 2PI] - bool bAllowUnsharpen) // #i37443# allow the criteria to get unsharp in recursions + const B2DPoint& rfPA, // start point + const B2DPoint& rfEA, // edge on A + const B2DPoint& rfEB, // edge on B + const B2DPoint& rfPB, // end point + B2DPolygon& rTarget, // target polygon + const double& rfAngleBound, // angle bound in [0.0 .. 2PI] + bool bAllowUnsharpen) // #i37443# allow the criteria to get unsharp in recursions { sal_uInt16 nMaxRecursionDepth(8); const B2DVector aLeft(rfEA - rfPA); @@ -154,7 +154,7 @@ namespace basegfx if(!bLeftEqualZero) { double fFactor; - + if(fabs(aBase.getX()) > fabs(aBase.getY())) { fFactor = aLeft.getX() / aBase.getX(); @@ -173,7 +173,7 @@ namespace basegfx if(!bRightEqualZero) { double fFactor; - + if(fabs(aBase.getX()) > fabs(aBase.getY())) { fFactor = aRight.getX() / -aBase.getX(); @@ -263,14 +263,14 @@ namespace basegfx } void ImpSubDivDistance( - const B2DPoint& rfPA, // start point - const B2DPoint& rfEA, // edge on A - const B2DPoint& rfEB, // edge on B - const B2DPoint& rfPB, // end point - B2DPolygon& rTarget, // target polygon - double fDistanceBound2, // quadratic distance criteria - double fLastDistanceError2, // the last quadratic distance error - sal_uInt16 nMaxRecursionDepth) // endless loop protection + const B2DPoint& rfPA, // start point + const B2DPoint& rfEA, // edge on A + const B2DPoint& rfEB, // edge on B + const B2DPoint& rfPB, // end point + B2DPolygon& rTarget, // target polygon + double fDistanceBound2, // quadratic distance criteria + double fLastDistanceError2, // the last quadratic distance error + sal_uInt16 nMaxRecursionDepth) // endless loop protection { if(nMaxRecursionDepth) { @@ -339,19 +339,19 @@ namespace basegfx namespace basegfx { B2DCubicBezier::B2DCubicBezier(const B2DCubicBezier& rBezier) - : maStartPoint(rBezier.maStartPoint), + : maStartPoint(rBezier.maStartPoint), maEndPoint(rBezier.maEndPoint), maControlPointA(rBezier.maControlPointA), maControlPointB(rBezier.maControlPointB) { } - + B2DCubicBezier::B2DCubicBezier() { } - + B2DCubicBezier::B2DCubicBezier(const B2DPoint& rStart, const B2DPoint& rEnd) - : maStartPoint(rStart), + : maStartPoint(rStart), maEndPoint(rEnd), maControlPointA(rStart), maControlPointB(rEnd) @@ -359,7 +359,7 @@ namespace basegfx } B2DCubicBezier::B2DCubicBezier(const B2DPoint& rStart, const B2DPoint& rControlPointA, const B2DPoint& rControlPointB, const B2DPoint& rEnd) - : maStartPoint(rStart), + : maStartPoint(rStart), maEndPoint(rEnd), maControlPointA(rControlPointA), maControlPointB(rControlPointB) @@ -377,7 +377,7 @@ namespace basegfx maEndPoint = rBezier.maEndPoint; maControlPointA = rBezier.maControlPointA; maControlPointB = rBezier.maControlPointB; - + return *this; } @@ -428,8 +428,8 @@ namespace basegfx if(maControlPointA != maStartPoint || maControlPointB != maEndPoint) { const B2DVector aEdge(maEndPoint - maStartPoint); - - // controls parallel to edge can be trivial. No edge -> not parallel -> control can + + // controls parallel to edge can be trivial. No edge -> not parallel -> control can // still not be trivial (e.g. ballon loop) if(!aEdge.equalZero()) { @@ -448,8 +448,8 @@ namespace basegfx // vector would need to be used too, but to be trivial it is assumed to // be of roughly equal length to the edge, so edge length can be used // for both. Only needed when one of both is not trivial per se. - const double fInverseEdgeLength(bAIsTrivial && bBIsTrivial - ? 1.0 + const double fInverseEdgeLength(bAIsTrivial && bBIsTrivial + ? 1.0 : 1.0 / aEdge.getLength()); // if A is not zero, check if it could be @@ -462,8 +462,8 @@ namespace basegfx if(fTools::equalZero(fCross)) { // get scale to edge. Use bigger distance for numeric quality - const double fScale(fabs(aEdge.getX()) > fabs(aEdge.getY()) - ? aVecA.getX() / aEdge.getX() + const double fScale(fabs(aEdge.getX()) > fabs(aEdge.getY()) + ? aVecA.getX() / aEdge.getX() : aVecA.getY() / aEdge.getY()); // relative end point of vector in edge range? @@ -480,12 +480,12 @@ namespace basegfx { // parallel to edge? Check aVecB, aEdge const double fCross(aVecB.cross(aEdge) * fInverseEdgeLength); - + if(fTools::equalZero(fCross)) { // get scale to edge. Use bigger distance for numeric quality - const double fScale(fabs(aEdge.getX()) > fabs(aEdge.getY()) - ? aVecB.getX() / aEdge.getX() + const double fScale(fabs(aEdge.getX()) > fabs(aEdge.getY()) + ? aVecB.getX() / aEdge.getX() : aVecB.getY() / aEdge.getY()); // end point of vector in edge range? Caution: controlB is directed AGAINST edge @@ -659,7 +659,7 @@ namespace basegfx { if(isBezier()) { - ImpSubDivDistance(maStartPoint, maControlPointA, maControlPointB, maEndPoint, rTarget, + ImpSubDivDistance(maStartPoint, maControlPointA, maControlPointB, maEndPoint, rTarget, fDistanceBound * fDistanceBound, ::std::numeric_limits<double>::max(), 30); } else @@ -679,7 +679,7 @@ namespace basegfx const B2DPoint aS1R(interpolate(maControlPointB, maEndPoint, t)); const B2DPoint aS2L(interpolate(aS1L, aS1C, t)); const B2DPoint aS2R(interpolate(aS1C, aS1R, t)); - + return interpolate(aS2L, aS2R, t); } else @@ -851,7 +851,7 @@ namespace basegfx B2DCubicBezier B2DCubicBezier::snippet(double fStart, double fEnd) const { B2DCubicBezier aRetval; - + if(fTools::more(fStart, 1.0)) { fStart = 1.0; @@ -1077,7 +1077,7 @@ namespace basegfx // derivative is polynomial of order 2 // check if the polynomial has non-imaginary roots const double fD = fB*fB - fA*fC; - if( fD >= 0.0 ) // TODO: is this test needed? geometrically not IMHO + if( fD >= 0.0 ) // TODO: is this test needed? geometrically not IMHO { // calculate the first root const double fS = sqrt(fD); diff --git a/basegfx/source/curve/b2dquadraticbezier.cxx b/basegfx/source/curve/b2dquadraticbezier.cxx index 488e0ecd459e..46ed7d84364d 100644 --- a/basegfx/source/curve/b2dquadraticbezier.cxx +++ b/basegfx/source/curve/b2dquadraticbezier.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -36,24 +36,24 @@ namespace basegfx { B2DQuadraticBezier::B2DQuadraticBezier(const B2DQuadraticBezier& rBezier) - : maStartPoint(rBezier.maStartPoint), + : maStartPoint(rBezier.maStartPoint), maEndPoint(rBezier.maEndPoint), maControlPoint(rBezier.maControlPoint) { } - + B2DQuadraticBezier::B2DQuadraticBezier() { } - + B2DQuadraticBezier::B2DQuadraticBezier(const ::basegfx::B2DPoint& rStart, const ::basegfx::B2DPoint& rEnd) - : maStartPoint(rStart), + : maStartPoint(rStart), maEndPoint(rEnd) { } B2DQuadraticBezier::B2DQuadraticBezier(const ::basegfx::B2DPoint& rStart, const ::basegfx::B2DPoint& rControl, const ::basegfx::B2DPoint& rEnd) - : maStartPoint(rStart), + : maStartPoint(rStart), maEndPoint(rEnd), maControlPoint(rControl) { @@ -69,7 +69,7 @@ namespace basegfx maStartPoint = rBezier.maStartPoint; maEndPoint = rBezier.maEndPoint; maControlPoint = rBezier.maControlPoint; - + return *this; } diff --git a/basegfx/source/inc/PolygonPoint.hxx b/basegfx/source/inc/PolygonPoint.hxx index b2c7aa8bf855..f14cc8633031 100644 --- a/basegfx/source/inc/PolygonPoint.hxx +++ b/basegfx/source/inc/PolygonPoint.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -35,16 +35,16 @@ template < class Point > class SimplePointEntry { - Point maPoint; + Point maPoint; public: SimplePointEntry() - : maPoint(Point::getEmptyPoint()) + : maPoint(Point::getEmptyPoint()) { } SimplePointEntry(const Point& rInitPoint) - : maPoint(rInitPoint) + : maPoint(rInitPoint) { } @@ -52,7 +52,7 @@ public: { return maPoint; } - + void setPoint(const Point& rValue) { maPoint = rValue; @@ -68,18 +68,18 @@ public: template < class Vector > class SimpleBezierEntry { - Vector maBackward; - Vector maForward; + Vector maBackward; + Vector maForward; public: SimpleBezierEntry() - : maBackward(Vector::getEmptyVector()), + : maBackward(Vector::getEmptyVector()), maForward(Vector::getEmptyVector()) { } SimpleBezierEntry(const Vector& rInitBackward, const Vector& rInitForward) - : maBackward(rInitBackward), + : maBackward(rInitBackward), maForward(rInitForward) { } @@ -88,7 +88,7 @@ public: { return maBackward; } - + void setBackwardVector(const Vector& rValue) { maBackward = rValue; @@ -132,11 +132,11 @@ template < class Point, class Vector > class PolygonPointList typedef ::std::vector< LocalSimplePointEntry > SimplePointVector; typedef ::std::vector< LocalSimpleBezierEntry > SimpleBezierVector; - sal_uInt32 mnBezierCount; - SimplePointVector maPoints; - SimpleBezierVector* mpVectors; + sal_uInt32 mnBezierCount; + SimplePointVector maPoints; + SimpleBezierVector* mpVectors; - unsigned mbIsClosed : 1; + unsigned mbIsClosed : 1; void implTryToReduceToPointVector() { @@ -169,7 +169,7 @@ public: } PolygonPointList() - : mnBezierCount(0L), + : mnBezierCount(0L), mpVectors(0L), mbIsClosed(false) { @@ -177,7 +177,7 @@ public: } PolygonPointList(const PolygonPointList& rSource) - : mnBezierCount(0L), + : mnBezierCount(0L), maPoints(rSource.maPoints), mpVectors(0L), mbIsClosed(rSource.mbIsClosed) @@ -191,7 +191,7 @@ public: } PolygonPointList(const PolygonPointList& rSource, sal_uInt32 nIndex, sal_uInt32 nCount) - : mnBezierCount(0L), + : mnBezierCount(0L), maPoints(nCount), mpVectors(0L), mbIsClosed(rSource.mbIsClosed) @@ -310,7 +310,7 @@ public: else { bool bEmptyVector(rValue == Vector::getEmptyVector()); - + if(bEmptyVector) return; @@ -319,7 +319,7 @@ public: mnBezierCount++; } } - + const Vector& getForwardVector(sal_uInt32 nIndex) const { if(mpVectors) @@ -348,7 +348,7 @@ public: else { bool bEmptyVector(rValue == Vector::getEmptyVector()); - + if(bEmptyVector) return; @@ -463,7 +463,7 @@ public: if(mnBezierCount) { SimpleBezierVector::iterator aTestIter(aStart); - + for( ; mnBezierCount && aTestIter != aEnd; ++aTestIter) { if(aTestIter->isBezierNeeded()) @@ -499,7 +499,7 @@ public: { SimplePointVector::iterator aStart(maPoints.begin()); SimplePointVector::iterator aEnd(maPoints.end()); - + for(sal_uInt32 a(0); a < nHalfSize; a++) { LocalSimplePointEntry aTemp = *aStart; @@ -513,7 +513,7 @@ public: { SimpleBezierVector::iterator aStart(mpVectors->begin()); SimpleBezierVector::iterator aEnd(mpVectors->end()); - + for(sal_uInt32 a(0); a < nHalfSize; a++) { LocalSimpleBezierEntry aTemp = *aStart; diff --git a/basegfx/source/inc/hommatrixtemplate.hxx b/basegfx/source/inc/hommatrixtemplate.hxx index d3d1a837225d..5389fd76cde2 100644 --- a/basegfx/source/inc/hommatrixtemplate.hxx +++ b/basegfx/source/inc/hommatrixtemplate.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -50,7 +50,7 @@ namespace basegfx { enum { RowSize = _RowSize }; - double mfValue[RowSize]; + double mfValue[RowSize]; public: ImplMatLine() @@ -87,8 +87,8 @@ namespace basegfx { enum { RowSize = _RowSize }; - ImplMatLine< RowSize > maLine[RowSize - 1]; - ImplMatLine< RowSize >* mpLine; + ImplMatLine< RowSize > maLine[RowSize - 1]; + ImplMatLine< RowSize >* mpLine; public: // Is last line used? @@ -116,7 +116,7 @@ namespace basegfx } ImplHomMatrixTemplate() - : mpLine(0L) + : mpLine(0L) { // complete initialization with identity matrix, all lines // were initialized with a trailing 1 followed by 0's. @@ -128,7 +128,7 @@ namespace basegfx } ImplHomMatrixTemplate(const ImplHomMatrixTemplate& rToBeCopied) - : mpLine(0L) + : mpLine(0L) { // complete initialization using copy for(sal_uInt16 a(0); a < (RowSize - 1); a++) @@ -158,7 +158,7 @@ namespace basegfx { return maLine[nRow].get(nColumn); } - + if(mpLine) { return mpLine->get(nColumn); @@ -220,12 +220,12 @@ namespace basegfx double fBig, fSum, fDum; double fStorage[RowSize]; sal_uInt16 a, b, c; - + // #i30874# Initialize nAMax (compiler warns) sal_uInt16 nAMax = 0; - + nParity = 1; - + // Calc the max of each line. If a line is empty, // stop immediately since matrix is not invertible then. for(a = 0; a < RowSize; a++) @@ -256,7 +256,7 @@ namespace basegfx for(a = 0; a < b; a++) { fSum = get(a, b); - + for(c = 0; c < a; c++) { fSum -= get(a, c) * get(c, b); @@ -266,11 +266,11 @@ namespace basegfx } fBig = 0.0; - + for(a = b; a < RowSize; a++) { fSum = get(a, b); - + for(c = 0; c < b; c++) { fSum -= get(a, c) * get(c, b); @@ -278,7 +278,7 @@ namespace basegfx set(a, b, fSum); fDum = fStorage[a] * fabs(fSum); - + if(::basegfx::fTools::moreOrEqual(fDum, fBig)) { fBig = fDum; @@ -300,15 +300,15 @@ namespace basegfx } nIndex[b] = nAMax; - + // here the failure of precision occurs const double fValBB(fabs(get(b, b))); - + if(::basegfx::fTools::equalZero(fValBB)) { return false; } - + if(b != (RowSize - 1)) { fDum = 1.0 / get(b, b); @@ -328,7 +328,7 @@ namespace basegfx sal_uInt16 b, ip; sal_Int16 a, a2 = -1; double fSum; - + for(a = 0; a < RowSize; a++) { ip = nIndex[a]; @@ -396,7 +396,7 @@ namespace basegfx ImplHomMatrixTemplate aWork(*this); sal_uInt16 nIndex[RowSize]; sal_Int16 nParity; - + return aWork.ludcmp(nIndex, nParity); } @@ -480,7 +480,7 @@ namespace basegfx fRetval = (double)nParity; // last line needs no multiply if not existing; default value would be 1. - const sal_uInt16 nMaxLine( + const sal_uInt16 nMaxLine( sal::static_int_cast<sal_uInt16>(aWork.mpLine ? RowSize : (RowSize - 1)) ); for(sal_uInt16 a(0); a < nMaxLine; a++) @@ -574,10 +574,10 @@ namespace basegfx for(sal_uInt16 b(0); b < RowSize; ++b) { fValue = 0.0; - + for(sal_uInt16 c(0); c < RowSize; ++c) fValue += aCopy.get(c, b) * rMat.get(a, c); - + set(a, b, fValue); } } diff --git a/basegfx/source/inc/polygontemplate.hxx b/basegfx/source/inc/polygontemplate.hxx index a74f004e5ec7..933c3c108def 100644 --- a/basegfx/source/inc/polygontemplate.hxx +++ b/basegfx/source/inc/polygontemplate.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -35,16 +35,16 @@ template < class Point > class ImplSimplePointEntry { - Point maPoint; + Point maPoint; public: ImplSimplePointEntry() - : maPoint(Point::getEmptyPoint()) + : maPoint(Point::getEmptyPoint()) { } ImplSimplePointEntry(const Point& rInitPoint) - : maPoint(rInitPoint) + : maPoint(rInitPoint) { } @@ -52,7 +52,7 @@ public: { return maPoint; } - + void setPoint(const Point& rValue) { maPoint = rValue; @@ -68,18 +68,18 @@ public: template < class Vector > class ImplSimpleBezierEntry { - Vector maBackward; - Vector maForward; + Vector maBackward; + Vector maForward; public: ImplSimpleBezierEntry() - : maBackward(Vector::getEmptyVector()), + : maBackward(Vector::getEmptyVector()), maForward(Vector::getEmptyVector()) { } ImplSimpleBezierEntry(const Vector& rInitBackward, const Vector& rInitForward) - : maBackward(rInitBackward), + : maBackward(rInitBackward), maForward(rInitForward) { } @@ -88,7 +88,7 @@ public: { return maBackward; } - + void setBackwardVector(const Vector& rValue) { maBackward = rValue; @@ -132,11 +132,11 @@ template < class Point, class Vector > class ImplPolygonTemplate typedef ::std::vector< LocalImplSimplePointEntry > SimplePointVector; typedef ::std::vector< LocalImplSimpleBezierEntry > SimpleBezierVector; - sal_uInt32 mnBezierCount; - SimplePointVector maPoints; - SimpleBezierVector* mpVectors; + sal_uInt32 mnBezierCount; + SimplePointVector maPoints; + SimpleBezierVector* mpVectors; - unsigned mbIsClosed : 1; + unsigned mbIsClosed : 1; void implTryToReduceToPointVector() { @@ -169,7 +169,7 @@ public: } ImplPolygonTemplate() - : mnBezierCount(0L), + : mnBezierCount(0L), mpVectors(0L), mbIsClosed(false) { @@ -177,7 +177,7 @@ public: } ImplPolygonTemplate(const ImplPolygonTemplate& rSource) - : mnBezierCount(0L), + : mnBezierCount(0L), maPoints(rSource.maPoints), mpVectors(0L), mbIsClosed(rSource.mbIsClosed) @@ -191,7 +191,7 @@ public: } ImplPolygonTemplate(const ImplPolygonTemplate& rSource, sal_uInt32 nIndex, sal_uInt32 nCount) - : mnBezierCount(0L), + : mnBezierCount(0L), maPoints(nCount), mpVectors(0L), mbIsClosed(rSource.mbIsClosed) @@ -310,7 +310,7 @@ public: else { bool bEmptyVector(rValue.equalZero()); - + if(bEmptyVector) return; @@ -319,7 +319,7 @@ public: mnBezierCount++; } } - + const Vector& getForwardVector(sal_uInt32 nIndex) const { if(mpVectors) @@ -348,7 +348,7 @@ public: else { bool bEmptyVector(rValue.equalZero()); - + if(bEmptyVector) return; @@ -463,7 +463,7 @@ public: if(mnBezierCount) { SimpleBezierVector::iterator aTestIter(aStart); - + for( ; mnBezierCount && aTestIter != aEnd; ++aTestIter) { if(aTestIter->isBezierNeeded()) @@ -499,7 +499,7 @@ public: { SimplePointVector::iterator aStart(maPoints.begin()); SimplePointVector::iterator aEnd(maPoints.end()); - + for(sal_uInt32 a(0); a < nHalfSize; a++) { LocalImplSimplePointEntry aTemp = *aStart; @@ -513,7 +513,7 @@ public: { SimpleBezierVector::iterator aStart(mpVectors->begin()); SimpleBezierVector::iterator aEnd(mpVectors->end()); - + for(sal_uInt32 a(0); a < nHalfSize; a++) { LocalImplSimpleBezierEntry aTemp = *aStart; diff --git a/basegfx/source/matrix/b2dhommatrix.cxx b/basegfx/source/matrix/b2dhommatrix.cxx index 3ce43c739442..ca21f627c571 100644 --- a/basegfx/source/matrix/b2dhommatrix.cxx +++ b/basegfx/source/matrix/b2dhommatrix.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -43,8 +43,8 @@ namespace basegfx class Impl2DHomMatrix : public ::basegfx::internal::ImplHomMatrixTemplate< 3 > { }; - - namespace { struct IdentityMatrix : public rtl::Static< B2DHomMatrix::ImplType, + + namespace { struct IdentityMatrix : public rtl::Static< B2DHomMatrix::ImplType, IdentityMatrix > {}; } B2DHomMatrix::B2DHomMatrix() : @@ -62,7 +62,7 @@ namespace basegfx } B2DHomMatrix::B2DHomMatrix(double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2) - : mpImpl( IdentityMatrix::get() ) // use common identity matrix, will be made unique with 1st set-call + : mpImpl( IdentityMatrix::get() ) // use common identity matrix, will be made unique with 1st set-call { mpImpl->set(0, 0, f_0x0); mpImpl->set(0, 1, f_0x1); @@ -232,7 +232,7 @@ namespace basegfx tools::createSinCosOrthogonal(fSin, fCos, fRadiant); Impl2DHomMatrix aRotMat; - + aRotMat.set(0, 0, fCos); aRotMat.set(1, 1, fCos); aRotMat.set(1, 0, fSin); @@ -247,7 +247,7 @@ namespace basegfx if(!fTools::equalZero(fX) || !fTools::equalZero(fY)) { Impl2DHomMatrix aTransMat; - + aTransMat.set(0, 2, fX); aTransMat.set(1, 2, fY); @@ -262,7 +262,7 @@ namespace basegfx if(!fTools::equal(fOne, fX) || !fTools::equal(fOne, fY)) { Impl2DHomMatrix aScaleMat; - + aScaleMat.set(0, 0, fX); aScaleMat.set(1, 1, fY); @@ -276,7 +276,7 @@ namespace basegfx if(!fTools::equalZero(fSx)) { Impl2DHomMatrix aShearXMat; - + aShearXMat.set(0, 1, fSx); mpImpl->doMulMatrix(aShearXMat); @@ -289,7 +289,7 @@ namespace basegfx if(!fTools::equalZero(fSy)) { Impl2DHomMatrix aShearYMat; - + aShearYMat.set(1, 0, fSy); mpImpl->doMulMatrix(aShearYMat); @@ -357,7 +357,7 @@ namespace basegfx // and correct rotation, it's the Y-Axis rotation minus 90 degrees rRotate = atan2(aUnitVecY.getY(), aUnitVecY.getX()) - M_PI_2; } - + // one or both unit vectors do not extist, determinant is zero, no decomposition possible. // Eventually used rotations or shears are lost return false; @@ -412,7 +412,7 @@ namespace basegfx if(!fTools::equalZero(rRotate)) { - // To be able to correct the shear for aUnitVecY, rotation needs to be + // To be able to correct the shear for aUnitVecY, rotation needs to be // removed first. Correction of aUnitVecX is easy, it will be rotated back to (1, 0). aUnitVecX.setX(rScale.getX()); aUnitVecX.setY(0.0); @@ -421,7 +421,7 @@ namespace basegfx const double fNegRotate(-rRotate); const double fSin(sin(fNegRotate)); const double fCos(cos(fNegRotate)); - + const double fNewX(aUnitVecY.getX() * fCos - aUnitVecY.getY() * fSin); const double fNewY(aUnitVecY.getX() * fSin + aUnitVecY.getY() * fCos); diff --git a/basegfx/source/matrix/b2dhommatrixtools.cxx b/basegfx/source/matrix/b2dhommatrixtools.cxx index 8c4b2d68a79b..90c5f47b8e2a 100644 --- a/basegfx/source/matrix/b2dhommatrixtools.cxx +++ b/basegfx/source/matrix/b2dhommatrixtools.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -70,7 +70,7 @@ namespace basegfx if( fTools::equalZero( fmod( fRadiant, F_PI2 ) ) ) { // determine quadrant - const sal_Int32 nQuad( + const sal_Int32 nQuad( (4 + fround( 4/F_2PI*fmod( fRadiant, F_2PI ) )) % 4 ); switch( nQuad ) { @@ -220,7 +220,7 @@ namespace basegfx /* Row 1, Column 0 */ fSin * fScaleX, /* Row 1, Column 1 */ fScaleY * fCos, /* Row 1, Column 2 */ fTranslateY); - + return aRetval; } } @@ -255,13 +255,13 @@ namespace basegfx /* Row 1, Column 0 */ fSin * fScaleX, /* Row 1, Column 1 */ fScaleY * ((fSin * fShearX) + fCos), /* Row 1, Column 2 */ fTranslateY); - + return aRetval; } } } } - + B2DHomMatrix createShearXRotateTranslateB2DHomMatrix( double fShearX, double fRadiant, @@ -290,7 +290,7 @@ namespace basegfx /* Row 1, Column 0 */ fSin, /* Row 1, Column 1 */ fCos, /* Row 1, Column 2 */ fTranslateY); - + return aRetval; } } @@ -307,7 +307,7 @@ namespace basegfx /* Row 1, Column 0 */ 0.0, /* Row 1, Column 1 */ 1.0, /* Row 1, Column 2 */ fTranslateY); - + return aRetval; } else @@ -325,12 +325,12 @@ namespace basegfx /* Row 1, Column 0 */ fSin, /* Row 1, Column 1 */ (fSin * fShearX) + fCos, /* Row 1, Column 2 */ fTranslateY); - + return aRetval; } } } - + B2DHomMatrix createScaleTranslateB2DHomMatrix( double fScaleX, double fScaleY, double fTranslateX, double fTranslateY) @@ -349,7 +349,7 @@ namespace basegfx { /// no translate, but scale. B2DHomMatrix aRetval; - + aRetval.set(0, 0, fScaleX); aRetval.set(1, 1, fScaleY); @@ -365,7 +365,7 @@ namespace basegfx /* Row 1, Column 0 */ 0.0, /* Row 1, Column 1 */ fScaleY, /* Row 1, Column 2 */ fTranslateY); - + return aRetval; } } @@ -376,14 +376,14 @@ namespace basegfx double fRadiant) { B2DHomMatrix aRetval; - + if(!fTools::equalZero(fRadiant)) { double fSin(0.0); double fCos(1.0); createSinCosOrthogonal(fSin, fCos, fRadiant); - + aRetval.set3x2( /* Row 0, Column 0 */ fCos, /* Row 0, Column 1 */ -fSin, diff --git a/basegfx/source/matrix/b3dhommatrix.cxx b/basegfx/source/matrix/b3dhommatrix.cxx index e665b47d58a6..ef1bd73bbce5 100644 --- a/basegfx/source/matrix/b3dhommatrix.cxx +++ b/basegfx/source/matrix/b3dhommatrix.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -39,8 +39,8 @@ namespace basegfx class Impl3DHomMatrix : public ::basegfx::internal::ImplHomMatrixTemplate< 4 > { }; - - namespace { struct IdentityMatrix : public rtl::Static< B3DHomMatrix::ImplType, + + namespace { struct IdentityMatrix : public rtl::Static< B3DHomMatrix::ImplType, IdentityMatrix > {}; } B3DHomMatrix::B3DHomMatrix() : @@ -229,7 +229,7 @@ namespace basegfx mpImpl->doMulMatrix(aRotMatY); } - + if(!fTools::equalZero(fAngleZ)) { Impl3DHomMatrix aRotMatZ; @@ -251,7 +251,7 @@ namespace basegfx if(!fTools::equalZero(fX) || !fTools::equalZero(fY) || !fTools::equalZero(fZ)) { Impl3DHomMatrix aTransMat; - + aTransMat.set(0, 3, fX); aTransMat.set(1, 3, fY); aTransMat.set(2, 3, fZ); @@ -267,7 +267,7 @@ namespace basegfx if(!fTools::equal(fOne, fX) || !fTools::equal(fOne, fY) ||!fTools::equal(fOne, fZ)) { Impl3DHomMatrix aScaleMat; - + aScaleMat.set(0, 0, fX); aScaleMat.set(1, 1, fY); aScaleMat.set(2, 2, fZ); @@ -282,7 +282,7 @@ namespace basegfx if(!fTools::equalZero(fSx) || !fTools::equalZero(fSy)) { Impl3DHomMatrix aShearXYMat; - + aShearXYMat.set(0, 2, fSx); aShearXYMat.set(1, 2, fSy); @@ -296,7 +296,7 @@ namespace basegfx if(!fTools::equalZero(fSy) || !fTools::equalZero(fSz)) { Impl3DHomMatrix aShearYZMat; - + aShearYZMat.set(1, 0, fSy); aShearYZMat.set(2, 0, fSz); @@ -310,7 +310,7 @@ namespace basegfx if(!fTools::equalZero(fSx) || !fTools::equalZero(fSz)) { Impl3DHomMatrix aShearXZMat; - + aShearXZMat.set(0, 1, fSx); aShearXZMat.set(2, 1, fSz); @@ -351,7 +351,7 @@ namespace basegfx } Impl3DHomMatrix aFrustumMat; - + aFrustumMat.set(0, 0, 2.0 * fNear / (fRight - fLeft)); aFrustumMat.set(1, 1, 2.0 * fNear / (fTop - fBottom)); aFrustumMat.set(0, 2, (fRight + fLeft) / (fRight - fLeft)); @@ -363,7 +363,7 @@ namespace basegfx mpImpl->doMulMatrix(aFrustumMat); } - + void B3DHomMatrix::ortho(double fLeft, double fRight, double fBottom, double fTop, double fNear, double fFar) { if(fTools::equal(fNear, fFar)) @@ -384,14 +384,14 @@ namespace basegfx } Impl3DHomMatrix aOrthoMat; - + aOrthoMat.set(0, 0, 2.0 / (fRight - fLeft)); aOrthoMat.set(1, 1, 2.0 / (fTop - fBottom)); aOrthoMat.set(2, 2, -1.0 * (2.0 / (fFar - fNear))); aOrthoMat.set(0, 3, -1.0 * ((fRight + fLeft) / (fRight - fLeft))); aOrthoMat.set(1, 3, -1.0 * ((fTop + fBottom) / (fTop - fBottom))); aOrthoMat.set(2, 3, -1.0 * ((fFar + fNear) / (fFar - fNear))); - + mpImpl->doMulMatrix(aOrthoMat); } @@ -502,7 +502,7 @@ namespace basegfx // get ShearYZ rShear.setZ(aCol1.scalar(aCol2)); - + if(fTools::equalZero(rShear.getZ())) { rShear.setZ(0.0); @@ -552,7 +552,7 @@ namespace basegfx { double fy=0; double cy=0; - + if( ::basegfx::fTools::equal( aCol0.getZ(), 1.0 ) || aCol0.getZ() > 1.0 ) { diff --git a/basegfx/source/numeric/ftools.cxx b/basegfx/source/numeric/ftools.cxx index 163920de33e0..fcfe2502037c 100644 --- a/basegfx/source/numeric/ftools.cxx +++ b/basegfx/source/numeric/ftools.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/basegfx/source/pixel/bpixel.cxx b/basegfx/source/pixel/bpixel.cxx index 40611b74098c..11248e8a4a97 100644 --- a/basegfx/source/pixel/bpixel.cxx +++ b/basegfx/source/pixel/bpixel.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/basegfx/source/point/b2dhompoint.cxx b/basegfx/source/point/b2dhompoint.cxx index babfbaae4d5c..aa9e01b4c88b 100644 --- a/basegfx/source/point/b2dhompoint.cxx +++ b/basegfx/source/point/b2dhompoint.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -34,10 +34,10 @@ namespace basegfx { - bool B2DHomPoint::implIsHomogenized() const - { + bool B2DHomPoint::implIsHomogenized() const + { const double fOne(1.0); - return ::basegfx::fTools::equal(fOne, mfW); + return ::basegfx::fTools::equal(fOne, mfW); } void B2DHomPoint::implHomogenize() @@ -61,15 +61,15 @@ namespace basegfx } double B2DHomPoint::getX() const - { + { implTestAndHomogenize(); - return maTuple.getX(); + return maTuple.getX(); } double B2DHomPoint::getY() const - { + { implTestAndHomogenize(); - return maTuple.getY(); + return maTuple.getY(); } void B2DHomPoint::setX(double fX) @@ -82,8 +82,8 @@ namespace basegfx maTuple.setY(implIsHomogenized() ? fY : fY * mfW ); } - B2DHomPoint& B2DHomPoint::operator+=( const B2DHomPoint& rPnt ) - { + B2DHomPoint& B2DHomPoint::operator+=( const B2DHomPoint& rPnt ) + { maTuple.setX(getX() * rPnt.mfW + rPnt.getX() * mfW); maTuple.setY(getY() * rPnt.mfW + rPnt.getY() * mfW); mfW = mfW * rPnt.mfW; @@ -91,8 +91,8 @@ namespace basegfx return *this; } - B2DHomPoint& B2DHomPoint::operator-=( const B2DHomPoint& rPnt ) - { + B2DHomPoint& B2DHomPoint::operator-=( const B2DHomPoint& rPnt ) + { maTuple.setX(getX() * rPnt.mfW - rPnt.getX() * mfW); maTuple.setY(getY() * rPnt.mfW - rPnt.getY() * mfW); mfW = mfW * rPnt.mfW; @@ -100,14 +100,14 @@ namespace basegfx return *this; } - B2DHomPoint& B2DHomPoint::operator*=(double t) - { + B2DHomPoint& B2DHomPoint::operator*=(double t) + { if(!::basegfx::fTools::equalZero(t)) { mfW /= t; } - return *this; + return *this; } B2DHomPoint& B2DHomPoint::operator*=( const B2DHomMatrix& rMat ) @@ -130,130 +130,130 @@ namespace basegfx return *this; } - B2DHomPoint& B2DHomPoint::operator/=(double t) - { + B2DHomPoint& B2DHomPoint::operator/=(double t) + { mfW *= t; - return *this; + return *this; } B2DHomPoint& B2DHomPoint::operator-(void) - { + { mfW = -mfW; return *this; } - bool B2DHomPoint::operator==( const B2DHomPoint& rPnt ) const - { + bool B2DHomPoint::operator==( const B2DHomPoint& rPnt ) const + { implTestAndHomogenize(); return (maTuple == rPnt.maTuple); } - bool B2DHomPoint::operator!=( const B2DHomPoint& rPnt ) const - { + bool B2DHomPoint::operator!=( const B2DHomPoint& rPnt ) const + { implTestAndHomogenize(); return (maTuple != rPnt.maTuple); } - B2DHomPoint& B2DHomPoint::operator=( const B2DHomPoint& rPnt ) - { + B2DHomPoint& B2DHomPoint::operator=( const B2DHomPoint& rPnt ) + { maTuple = rPnt.maTuple; mfW = rPnt.mfW; - return *this; + return *this; } - B2DHomPoint minimum(const B2DHomPoint& rVecA, const B2DHomPoint& rVecB) - { + B2DHomPoint minimum(const B2DHomPoint& rVecA, const B2DHomPoint& rVecB) + { B2DHomPoint aMin( (rVecB.getX() < rVecA.getX()) ? rVecB.getX() : rVecA.getX(), - (rVecB.getY() < rVecA.getY()) ? rVecB.getY() : rVecA.getY()); + (rVecB.getY() < rVecA.getY()) ? rVecB.getY() : rVecA.getY()); return aMin; } - B2DHomPoint maximum(const B2DHomPoint& rVecA, const B2DHomPoint& rVecB) - { + B2DHomPoint maximum(const B2DHomPoint& rVecA, const B2DHomPoint& rVecB) + { B2DHomPoint aMax( (rVecB.getX() > rVecA.getX()) ? rVecB.getX() : rVecA.getX(), - (rVecB.getY() > rVecA.getY()) ? rVecB.getY() : rVecA.getY()); + (rVecB.getY() > rVecA.getY()) ? rVecB.getY() : rVecA.getY()); return aMax; } - B2DHomPoint absolute(const B2DHomPoint& rVec) - { + B2DHomPoint absolute(const B2DHomPoint& rVec) + { B2DHomPoint aAbs( (0.0 > rVec.getX()) ? -rVec.getX() : rVec.getX(), - (0.0 > rVec.getY()) ? -rVec.getY() : rVec.getY()); + (0.0 > rVec.getY()) ? -rVec.getY() : rVec.getY()); return aAbs; } - B2DHomPoint interpolate(B2DHomPoint& rOld1, B2DHomPoint& rOld2, double t) - { + B2DHomPoint interpolate(B2DHomPoint& rOld1, B2DHomPoint& rOld2, double t) + { B2DHomPoint aInt( ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(), - ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY()); + ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY()); return aInt; } - B2DHomPoint average(B2DHomPoint& rOld1, B2DHomPoint& rOld2) - { + B2DHomPoint average(B2DHomPoint& rOld1, B2DHomPoint& rOld2) + { B2DHomPoint aAvg( (rOld1.getX() + rOld2.getX()) * 0.5, - (rOld1.getY() + rOld2.getY()) * 0.5); + (rOld1.getY() + rOld2.getY()) * 0.5); return aAvg; } - + B2DHomPoint average(B2DHomPoint& rOld1, B2DHomPoint& rOld2, B2DHomPoint& rOld3) - { + { B2DHomPoint aAvg( (rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0), - (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0)); + (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0)); return aAvg; } B2DHomPoint operator+(const B2DHomPoint& rVecA, const B2DHomPoint& rVecB) - { - B2DHomPoint aSum(rVecA); - aSum += rVecB; - return aSum; + { + B2DHomPoint aSum(rVecA); + aSum += rVecB; + return aSum; } B2DHomPoint operator-(const B2DHomPoint& rVecA, const B2DHomPoint& rVecB) - { - B2DHomPoint aSub(rVecA); - aSub -= rVecB; - return aSub; + { + B2DHomPoint aSub(rVecA); + aSub -= rVecB; + return aSub; } B2DHomPoint operator*(const B2DHomPoint& rVec, double t) - { - B2DHomPoint aNew(rVec); - aNew *= t; - return aNew; + { + B2DHomPoint aNew(rVec); + aNew *= t; + return aNew; } B2DHomPoint operator*(double t, const B2DHomPoint& rVec) - { - B2DHomPoint aNew(rVec); - aNew *= t; - return aNew; + { + B2DHomPoint aNew(rVec); + aNew *= t; + return aNew; } B2DHomPoint operator*( const B2DHomMatrix& rMat, const B2DHomPoint& rPoint ) { - B2DHomPoint aNew(rPoint); + B2DHomPoint aNew(rPoint); return aNew*=rMat; } B2DHomPoint operator/(const B2DHomPoint& rVec, double t) - { - B2DHomPoint aNew(rVec); - aNew /= t; - return aNew; + { + B2DHomPoint aNew(rVec); + aNew /= t; + return aNew; } B2DHomPoint operator/(double t, const B2DHomPoint& rVec) { - B2DHomPoint aNew(rVec); - aNew /= t; - return aNew; + B2DHomPoint aNew(rVec); + aNew /= t; + return aNew; } } // end of namespace basegfx diff --git a/basegfx/source/point/b2dpoint.cxx b/basegfx/source/point/b2dpoint.cxx index fbc14a082318..ac17aeef16cc 100644 --- a/basegfx/source/point/b2dpoint.cxx +++ b/basegfx/source/point/b2dpoint.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -36,30 +36,30 @@ namespace basegfx { - B2DPoint& B2DPoint::operator=( const ::basegfx::B2DTuple& rPoint ) - { + B2DPoint& B2DPoint::operator=( const ::basegfx::B2DTuple& rPoint ) + { mfX = rPoint.getX(); - mfY = rPoint.getY(); - return *this; + mfY = rPoint.getY(); + return *this; } B2DPoint& B2DPoint::operator*=( const ::basegfx::B2DHomMatrix& rMat ) { double fTempX( - rMat.get(0, 0) * mfX + - rMat.get(0, 1) * mfY + + rMat.get(0, 0) * mfX + + rMat.get(0, 1) * mfY + rMat.get(0, 2)); double fTempY( - rMat.get(1, 0) * mfX + - rMat.get(1, 1) * mfY + + rMat.get(1, 0) * mfX + + rMat.get(1, 1) * mfY + rMat.get(1, 2)); if(!rMat.isLastLineDefault()) { const double fOne(1.0); const double fTempM( - rMat.get(2, 0) * mfX + - rMat.get(2, 1) * mfY + + rMat.get(2, 0) * mfX + + rMat.get(2, 1) * mfY + rMat.get(2, 2)); if(!fTools::equalZero(fTempM) && !fTools::equal(fOne, fTempM)) diff --git a/basegfx/source/point/b2ipoint.cxx b/basegfx/source/point/b2ipoint.cxx index c5a055274634..ab70f7cc54da 100644 --- a/basegfx/source/point/b2ipoint.cxx +++ b/basegfx/source/point/b2ipoint.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -34,30 +34,30 @@ namespace basegfx { - B2IPoint& B2IPoint::operator=( const ::basegfx::B2ITuple& rPoint ) - { + B2IPoint& B2IPoint::operator=( const ::basegfx::B2ITuple& rPoint ) + { mnX = rPoint.getX(); - mnY = rPoint.getY(); - return *this; + mnY = rPoint.getY(); + return *this; } B2IPoint& B2IPoint::operator*=( const ::basegfx::B2DHomMatrix& rMat ) { double fTempX( - rMat.get(0, 0) * mnX + - rMat.get(0, 1) * mnY + + rMat.get(0, 0) * mnX + + rMat.get(0, 1) * mnY + rMat.get(0, 2)); double fTempY( - rMat.get(1, 0) * mnX + - rMat.get(1, 1) * mnY + + rMat.get(1, 0) * mnX + + rMat.get(1, 1) * mnY + rMat.get(1, 2)); if(!rMat.isLastLineDefault()) { const double fOne(1.0); const double fTempM( - rMat.get(2, 0) * mnX + - rMat.get(2, 1) * mnY + + rMat.get(2, 0) * mnX + + rMat.get(2, 1) * mnY + rMat.get(2, 2)); if(!fTools::equalZero(fTempM) && !fTools::equal(fOne, fTempM)) diff --git a/basegfx/source/point/b3dhompoint.cxx b/basegfx/source/point/b3dhompoint.cxx index 3a6c33a50262..3bc793fc871d 100644 --- a/basegfx/source/point/b3dhompoint.cxx +++ b/basegfx/source/point/b3dhompoint.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/basegfx/source/point/b3dpoint.cxx b/basegfx/source/point/b3dpoint.cxx index 8cf8ac983260..c6ff5303cfd3 100644 --- a/basegfx/source/point/b3dpoint.cxx +++ b/basegfx/source/point/b3dpoint.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -56,9 +56,9 @@ namespace basegfx { const double fOne(1.0); const double fTempM( - rMat.get(3, 0) * mfX + - rMat.get(3, 1) * mfY + - rMat.get(3, 2) * mfZ + + rMat.get(3, 0) * mfX + + rMat.get(3, 1) * mfY + + rMat.get(3, 2) * mfZ + rMat.get(3, 3)); if(!fTools::equalZero(fTempM) && !fTools::equal(fOne, fTempM)) diff --git a/basegfx/source/point/b3ipoint.cxx b/basegfx/source/point/b3ipoint.cxx index 8e5c0b3d9932..540979ac80b2 100644 --- a/basegfx/source/point/b3ipoint.cxx +++ b/basegfx/source/point/b3ipoint.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -56,9 +56,9 @@ namespace basegfx { const double fOne(1.0); const double fTempM( - rMat.get(3, 0) * mnX + - rMat.get(3, 1) * mnY + - rMat.get(3, 2) * mnZ + + rMat.get(3, 0) * mnX + + rMat.get(3, 1) * mnY + + rMat.get(3, 2) * mnZ + rMat.get(3, 3)); if(!fTools::equalZero(fTempM) && !fTools::equal(fOne, fTempM)) diff --git a/basegfx/source/polygon/b2dlinegeometry.cxx b/basegfx/source/polygon/b2dlinegeometry.cxx index 97551ff95c36..638b9e99f3e0 100644 --- a/basegfx/source/polygon/b2dlinegeometry.cxx +++ b/basegfx/source/polygon/b2dlinegeometry.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -47,8 +47,8 @@ namespace basegfx namespace tools { B2DPolyPolygon createAreaGeometryForLineStartEnd( - const B2DPolygon& rCandidate, - const B2DPolyPolygon& rArrow, + const B2DPolygon& rCandidate, + const B2DPolyPolygon& rArrow, bool bStart, double fWidth, double fCandidateLength, @@ -59,7 +59,7 @@ namespace basegfx OSL_ENSURE(rCandidate.count() > 1L, "createAreaGeometryForLineStartEnd: Line polygon has too less points (!)"); OSL_ENSURE(rArrow.count() > 0L, "createAreaGeometryForLineStartEnd: Empty arrow PolyPolygon (!)"); OSL_ENSURE(fWidth > 0.0, "createAreaGeometryForLineStartEnd: Width too small (!)"); - OSL_ENSURE(fDockingPosition >= 0.0 && fDockingPosition <= 1.0, + OSL_ENSURE(fDockingPosition >= 0.0 && fDockingPosition <= 1.0, "createAreaGeometryForLineStartEnd: fDockingPosition out of range [0.0 .. 1.0] (!)"); if(fWidth < 0.0) @@ -109,7 +109,7 @@ namespace basegfx // get the polygon vector we want to plant this arrow on const double fConsumedLength(fArrowYLength * (1.0 - fDockingPosition)); const B2DVector aHead(rCandidate.getB2DPoint((bStart) ? 0L : rCandidate.count() - 1L)); - const B2DVector aTail(getPositionAbsolute(rCandidate, + const B2DVector aTail(getPositionAbsolute(rCandidate, (bStart) ? fConsumedLength : fCandidateLength - fConsumedLength, fCandidateLength)); // from that vector, take the needed rotation and add rotate for arrow to transformation @@ -222,7 +222,7 @@ namespace basegfx { B2DCubicBezier aLeft, aRight; rCandidate.split(0.5, &aLeft, &aRight); - + impSubdivideToSimple(aLeft, rTarget, fMaxCosQuad, fMaxPartOfEdgeQuad, nMaxRecursionDepth - 1); impSubdivideToSimple(aRight, rTarget, fMaxCosQuad, fMaxPartOfEdgeQuad, nMaxRecursionDepth - 1); } @@ -249,7 +249,7 @@ namespace basegfx aEdge.setControlPointA(rCandidate.getNextControlPoint(a)); aEdge.setControlPointB(rCandidate.getPrevControlPoint(nNextIndex)); aEdge.setEndPoint(rCandidate.getB2DPoint(nNextIndex)); - + // get rid of unnecessary bezier segments aEdge.testAndSolveTrivialBezier(); @@ -261,7 +261,7 @@ namespace basegfx aExtremumPositions.reserve(4); aEdge.getAllExtremumPositions(aExtremumPositions); - + const sal_uInt32 nCount(aExtremumPositions.size()); if(nCount) @@ -277,7 +277,7 @@ namespace basegfx // split aEdge at next split pos B2DCubicBezier aLeft; const double fSplitPos(aExtremumPositions[b++]); - + aEdge.split(fSplitPos, &aLeft, &aEdge); aLeft.testAndSolveTrivialBezier(); @@ -290,7 +290,7 @@ namespace basegfx { aRetval.append(aLeft.getEndPoint()); } - + if(b < nCount) { // correct the remaining split positions to fit to shortened aEdge @@ -302,7 +302,7 @@ namespace basegfx } } } - + // test the shortened rest of aEdge aEdge.testAndSolveTrivialBezier(); @@ -367,7 +367,7 @@ namespace basegfx double fCut(0.0); const tools::CutFlagValue aCut(tools::findCut( rEdge.getStartPoint(), aPerpendStart, - rEdge.getEndPoint(), aPerpendEnd, + rEdge.getEndPoint(), aPerpendEnd, CUTFLAG_ALL, &fCut)); if(CUTFLAG_NONE != aCut) @@ -395,7 +395,7 @@ namespace basegfx // append original in-between point aBezierPolygon.append(rEdge.getEndPoint()); - // create lower edge. + // create lower edge. { // create displacement vectors and check if they cut const B2DVector aPerpendStart(getNormalizedPerpendicular(aTangentA) * fHalfLineWidth); @@ -403,7 +403,7 @@ namespace basegfx double fCut(0.0); const tools::CutFlagValue aCut(tools::findCut( rEdge.getEndPoint(), aPerpendEnd, - rEdge.getStartPoint(), aPerpendStart, + rEdge.getStartPoint(), aPerpendStart, CUTFLAG_ALL, &fCut)); if(CUTFLAG_NONE != aCut) @@ -443,11 +443,11 @@ namespace basegfx const B2DVector aEdgeTangent((rEdge.getEndPoint() - rEdge.getStartPoint()) * 0.3); const B2DVector aPerpendEdgeVector(getNormalizedPerpendicular(aEdgeTangent) * fHalfLineWidth); B2DPolygon aEdgePolygon; - + // create upper edge aEdgePolygon.append(rEdge.getStartPoint() - aPerpendEdgeVector); aEdgePolygon.append(rEdge.getEndPoint() - aPerpendEdgeVector); - + // append original in-between point aEdgePolygon.append(rEdge.getEndPoint()); @@ -465,13 +465,13 @@ namespace basegfx } B2DPolygon createAreaGeometryForJoin( - const B2DVector& rTangentPrev, + const B2DVector& rTangentPrev, const B2DVector& rTangentEdge, - const B2DVector& rPerpendPrev, + const B2DVector& rPerpendPrev, const B2DVector& rPerpendEdge, const B2DPoint& rPoint, - double fHalfLineWidth, - B2DLineJoin eJoin, + double fHalfLineWidth, + B2DLineJoin eJoin, double fMiterMinimumAngle) { OSL_ENSURE(fHalfLineWidth > 0.0, "createAreaGeometryForJoin: LineWidth too small (!)"); @@ -481,7 +481,7 @@ namespace basegfx B2DPolygon aEdgePolygon; const B2DPoint aStartPoint(rPoint + rPerpendPrev); const B2DPoint aEndPoint(rPoint + rPerpendEdge); - + // test if for Miter, the angle is too small and the fallback // to bevel needs to be used if(B2DLINEJOIN_MITER == eJoin) @@ -502,7 +502,7 @@ namespace basegfx aEdgePolygon.append(aEndPoint); aEdgePolygon.append(rPoint); aEdgePolygon.append(aStartPoint); - + // Look for the cut point between start point along rTangentPrev and // end point along rTangentEdge. -rTangentEdge should be used, but since // the cut value is used for interpolating along the first edge, the negation @@ -516,7 +516,7 @@ namespace basegfx const B2DPoint aCutPoint(interpolate(aStartPoint, aStartPoint + rTangentPrev, fCutPos)); aEdgePolygon.append(aCutPoint); } - + break; } case B2DLINEJOIN_ROUND : @@ -524,7 +524,7 @@ namespace basegfx // use tooling to add needed EllipseSegment double fAngleStart(atan2(rPerpendPrev.getY(), rPerpendPrev.getX())); double fAngleEnd(atan2(rPerpendEdge.getY(), rPerpendEdge.getX())); - + // atan2 results are [-PI .. PI], consolidate to [0.0 .. 2PI] if(fAngleStart < 0.0) { @@ -561,7 +561,7 @@ namespace basegfx aEdgePolygon.append(aEndPoint); aEdgePolygon.append(rPoint); aEdgePolygon.append(aStartPoint); - + break; } } @@ -576,10 +576,10 @@ namespace basegfx namespace tools { B2DPolyPolygon createAreaGeometry( - const B2DPolygon& rCandidate, - double fHalfLineWidth, - B2DLineJoin eJoin, - double fMaxAllowedAngle, + const B2DPolygon& rCandidate, + double fHalfLineWidth, + B2DLineJoin eJoin, + double fMaxAllowedAngle, double fMaxPartOfEdge, double fMiterMinimumAngle) { @@ -612,10 +612,10 @@ namespace basegfx B2DPolygon aCandidate(rCandidate); const double fMaxCos(cos(fMaxAllowedAngle)); - + aCandidate.removeDoublePoints(); aCandidate = subdivideToSimple(aCandidate, fMaxCos * fMaxCos, fMaxPartOfEdge * fMaxPartOfEdge); - + const sal_uInt32 nPointCount(aCandidate.count()); if(nPointCount) @@ -660,7 +660,7 @@ namespace basegfx if(ORIENTATION_NEUTRAL == aOrientation) { - // they are parallell or empty; if they are both not zero and point + // they are parallell or empty; if they are both not zero and point // in opposite direction, a half-circle is needed if(!aTangentPrev.equalZero() && !aTangentEdge.equalZero()) { @@ -679,11 +679,11 @@ namespace basegfx { const B2DVector aPerpendPrev(getNormalizedPerpendicular(aTangentPrev) * -fHalfLineWidth); const B2DVector aPerpendEdge(getNormalizedPerpendicular(aTangentEdge) * -fHalfLineWidth); - + aRetval.append(createAreaGeometryForJoin( aTangentPrev, aTangentEdge, - aPerpendPrev, aPerpendEdge, - aEdge.getStartPoint(), fHalfLineWidth, + aPerpendPrev, aPerpendEdge, + aEdge.getStartPoint(), fHalfLineWidth, eJoin, fMiterMinimumAngle)); } else if(ORIENTATION_NEGATIVE == aOrientation) @@ -693,8 +693,8 @@ namespace basegfx aRetval.append(createAreaGeometryForJoin( aTangentEdge, aTangentPrev, - aPerpendEdge, aPerpendPrev, - aEdge.getStartPoint(), fHalfLineWidth, + aPerpendEdge, aPerpendPrev, + aEdge.getStartPoint(), fHalfLineWidth, eJoin, fMiterMinimumAngle)); } } diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx index ccd2f3dce6e0..f88069b38629 100644 --- a/basegfx/source/polygon/b2dpolygon.cxx +++ b/basegfx/source/polygon/b2dpolygon.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -47,8 +47,8 @@ struct CoordinateData2D : public basegfx::B2DPoint public: CoordinateData2D() {} - explicit CoordinateData2D(const basegfx::B2DPoint& rData) - : B2DPoint(rData) + explicit CoordinateData2D(const basegfx::B2DPoint& rData) + : B2DPoint(rData) {} CoordinateData2D& operator=(const basegfx::B2DPoint& rData) @@ -57,9 +57,9 @@ public: return *this; } - void transform(const basegfx::B2DHomMatrix& rMatrix) - { - *this *= rMatrix; + void transform(const basegfx::B2DHomMatrix& rMatrix) + { + *this *= rMatrix; } }; @@ -69,21 +69,21 @@ class CoordinateDataArray2D { typedef ::std::vector< CoordinateData2D > CoordinateData2DVector; - CoordinateData2DVector maVector; + CoordinateData2DVector maVector; public: explicit CoordinateDataArray2D(sal_uInt32 nCount) - : maVector(nCount) + : maVector(nCount) { } explicit CoordinateDataArray2D(const CoordinateDataArray2D& rOriginal) - : maVector(rOriginal.maVector) + : maVector(rOriginal.maVector) { } CoordinateDataArray2D(const CoordinateDataArray2D& rOriginal, sal_uInt32 nIndex, sal_uInt32 nCount) - : maVector(rOriginal.maVector.begin() + nIndex, rOriginal.maVector.begin() + (nIndex + nCount)) + : maVector(rOriginal.maVector.begin() + nIndex, rOriginal.maVector.begin() + (nIndex + nCount)) { } @@ -164,7 +164,7 @@ public: const sal_uInt32 nHalfSize(bIsClosed ? (maVector.size() - 1) >> 1 : maVector.size() >> 1); CoordinateData2DVector::iterator aStart(bIsClosed ? maVector.begin() + 1 : maVector.begin()); CoordinateData2DVector::iterator aEnd(maVector.end() - 1); - + for(sal_uInt32 a(0); a < nHalfSize; a++) { ::std::swap(*aStart, *aEnd); @@ -253,35 +253,35 @@ public: class ControlVectorPair2D { - basegfx::B2DVector maPrevVector; - basegfx::B2DVector maNextVector; + basegfx::B2DVector maPrevVector; + basegfx::B2DVector maNextVector; public: - const basegfx::B2DVector& getPrevVector() const - { - return maPrevVector; + const basegfx::B2DVector& getPrevVector() const + { + return maPrevVector; } - - void setPrevVector(const basegfx::B2DVector& rValue) - { - if(rValue != maPrevVector) - maPrevVector = rValue; + + void setPrevVector(const basegfx::B2DVector& rValue) + { + if(rValue != maPrevVector) + maPrevVector = rValue; } - const basegfx::B2DVector& getNextVector() const - { - return maNextVector; + const basegfx::B2DVector& getNextVector() const + { + return maNextVector; } - void setNextVector(const basegfx::B2DVector& rValue) - { - if(rValue != maNextVector) - maNextVector = rValue; + void setNextVector(const basegfx::B2DVector& rValue) + { + if(rValue != maNextVector) + maNextVector = rValue; } - bool operator==(const ControlVectorPair2D& rData) const - { - return (maPrevVector == rData.getPrevVector() && maNextVector == rData.getNextVector()); + bool operator==(const ControlVectorPair2D& rData) const + { + return (maPrevVector == rData.getPrevVector() && maNextVector == rData.getNextVector()); } void flip() @@ -296,17 +296,17 @@ class ControlVectorArray2D { typedef ::std::vector< ControlVectorPair2D > ControlVectorPair2DVector; - ControlVectorPair2DVector maVector; - sal_uInt32 mnUsedVectors; + ControlVectorPair2DVector maVector; + sal_uInt32 mnUsedVectors; public: explicit ControlVectorArray2D(sal_uInt32 nCount) - : maVector(nCount), + : maVector(nCount), mnUsedVectors(0) {} ControlVectorArray2D(const ControlVectorArray2D& rOriginal, sal_uInt32 nIndex, sal_uInt32 nCount) - : maVector(), + : maVector(), mnUsedVectors(0) { ControlVectorPair2DVector::const_iterator aStart(rOriginal.maVector.begin()); @@ -337,8 +337,8 @@ public: return (maVector == rCandidate.maVector); } - bool isUsed() const - { + bool isUsed() const + { return (0 != mnUsedVectors); } @@ -489,7 +489,7 @@ public: const sal_uInt32 nHalfSize(bIsClosed ? (maVector.size() - 1) >> 1 : maVector.size() >> 1); ControlVectorPair2DVector::iterator aStart(bIsClosed ? maVector.begin() + 1 : maVector.begin()); ControlVectorPair2DVector::iterator aEnd(maVector.end() - 1); - + for(sal_uInt32 a(0); a < nHalfSize; a++) { // swap Prev and Next @@ -524,10 +524,10 @@ class ImplBufferedData { private: // Possibility to hold the last subdivision - boost::scoped_ptr< basegfx::B2DPolygon > mpDefaultSubdivision; + boost::scoped_ptr< basegfx::B2DPolygon > mpDefaultSubdivision; // Possibility to hold the last B2DRange calculation - boost::scoped_ptr< basegfx::B2DRange > mpB2DRange; + boost::scoped_ptr< basegfx::B2DRange > mpB2DRange; public: ImplBufferedData() @@ -544,7 +544,7 @@ public: return *mpDefaultSubdivision; } - + const basegfx::B2DRange& getB2DRange(const basegfx::B2DPolygon& rSource) const { if(!mpB2DRange) @@ -584,10 +584,10 @@ public: // the range with control points of the current edge is not completely // inside the current range without control points. Expand current range by // subdividing the bezier segment. - // Ideal here is a subdivision at the extreme values, so use + // Ideal here is a subdivision at the extreme values, so use // getAllExtremumPositions to get all extremas in one run ::std::vector< double > aExtremas; - + aExtremas.reserve(4); aEdge.getAllExtremumPositions(aExtremas); @@ -621,11 +621,11 @@ class ImplB2DPolygon private: // The point vector. This vector exists always and defines the // count of members. - CoordinateDataArray2D maPoints; + CoordinateDataArray2D maPoints; // The control point vectors. This vectors are created on demand // and may be zero. - boost::scoped_ptr< ControlVectorArray2D > mpControlVector; + boost::scoped_ptr< ControlVectorArray2D > mpControlVector; // buffered data for e.g. default subdivision and range boost::scoped_ptr< ImplBufferedData > mpBufferedData; @@ -660,14 +660,14 @@ public: } ImplB2DPolygon() - : maPoints(0), + : maPoints(0), mpControlVector(), mpBufferedData(), mbIsClosed(false) {} ImplB2DPolygon(const ImplB2DPolygon& rToBeCopied) - : maPoints(rToBeCopied.maPoints), + : maPoints(rToBeCopied.maPoints), mpControlVector(), mpBufferedData(), mbIsClosed(rToBeCopied.mbIsClosed) @@ -680,7 +680,7 @@ public: } ImplB2DPolygon(const ImplB2DPolygon& rToBeCopied, sal_uInt32 nIndex, sal_uInt32 nCount) - : maPoints(rToBeCopied.maPoints, nIndex, nCount), + : maPoints(rToBeCopied.maPoints, nIndex, nCount), mpControlVector(), mpBufferedData(), mbIsClosed(rToBeCopied.mbIsClosed) @@ -704,7 +704,7 @@ public: // complete initialization using copy if(rToBeCopied.mpControlVector && rToBeCopied.mpControlVector->isUsed()) - mpControlVector.reset( new ControlVectorArray2D(*rToBeCopied.mpControlVector) ); + mpControlVector.reset( new ControlVectorArray2D(*rToBeCopied.mpControlVector) ); return *this; } @@ -1070,7 +1070,7 @@ public: remove(nIndex, 1); } - } + } while(bRemove); } else @@ -1142,7 +1142,7 @@ public: { const basegfx::B2DVector& rPrevVector(mpControlVector->getPrevVector(a)); const basegfx::B2DVector& rNextVector(mpControlVector->getNextVector(a)); - + if(!rPrevVector.equalZero()) { basegfx::B2DVector aPrevVector(rMatrix * rPrevVector); @@ -1196,21 +1196,21 @@ public: namespace basegfx { - namespace - { - struct DefaultPolygon: public rtl::Static<B2DPolygon::ImplType, DefaultPolygon> {}; + namespace + { + struct DefaultPolygon: public rtl::Static<B2DPolygon::ImplType, DefaultPolygon> {}; } - B2DPolygon::B2DPolygon() - : mpPolygon(DefaultPolygon::get()) + B2DPolygon::B2DPolygon() + : mpPolygon(DefaultPolygon::get()) {} B2DPolygon::B2DPolygon(const B2DPolygon& rPolygon) - : mpPolygon(rPolygon.mpPolygon) + : mpPolygon(rPolygon.mpPolygon) {} B2DPolygon::B2DPolygon(const B2DPolygon& rPolygon, sal_uInt32 nIndex, sal_uInt32 nCount) - : mpPolygon(ImplB2DPolygon(*rPolygon.mpPolygon, nIndex, nCount)) + : mpPolygon(ImplB2DPolygon(*rPolygon.mpPolygon, nIndex, nCount)) { // TODO(P2): one extra temporary here (cow_wrapper copies // given ImplB2DPolygon into its internal impl_t wrapper type) @@ -1253,7 +1253,7 @@ namespace basegfx B2DPoint B2DPolygon::getB2DPoint(sal_uInt32 nIndex) const { OSL_ENSURE(nIndex < mpPolygon->count(), "B2DPolygon access outside range (!)"); - + return mpPolygon->getPoint(nIndex); } @@ -1275,7 +1275,7 @@ namespace basegfx void B2DPolygon::insert(sal_uInt32 nIndex, const B2DPoint& rPoint, sal_uInt32 nCount) { OSL_ENSURE(nIndex <= mpPolygon->count(), "B2DPolygon Insert outside range (!)"); - + if(nCount) { mpPolygon->insert(nIndex, rPoint, nCount); @@ -1298,7 +1298,7 @@ namespace basegfx B2DPoint B2DPolygon::getPrevControlPoint(sal_uInt32 nIndex) const { OSL_ENSURE(nIndex < mpPolygon->count(), "B2DPolygon access outside range (!)"); - + if(mpPolygon->areControlPointsUsed()) { return mpPolygon->getPoint(nIndex) + mpPolygon->getPrevControlVector(nIndex); @@ -1312,7 +1312,7 @@ namespace basegfx B2DPoint B2DPolygon::getNextControlPoint(sal_uInt32 nIndex) const { OSL_ENSURE(nIndex < mpPolygon->count(), "B2DPolygon access outside range (!)"); - + if(mpPolygon->areControlPointsUsed()) { return mpPolygon->getPoint(nIndex) + mpPolygon->getNextControlVector(nIndex); @@ -1382,7 +1382,7 @@ namespace basegfx { OSL_ENSURE(nIndex < mpPolygon->count(), "B2DPolygon access outside range (!)"); - if(mpPolygon->areControlPointsUsed() && + if(mpPolygon->areControlPointsUsed() && (!mpPolygon->getPrevControlVector(nIndex).equalZero() || !mpPolygon->getNextControlVector(nIndex).equalZero())) { mpPolygon->resetControlVectors(nIndex); @@ -1398,8 +1398,8 @@ namespace basegfx } void B2DPolygon::appendBezierSegment( - const B2DPoint& rNextControlPoint, - const B2DPoint& rPrevControlPoint, + const B2DPoint& rNextControlPoint, + const B2DPoint& rPrevControlPoint, const B2DPoint& rPoint) { const B2DVector aNewNextVector(mpPolygon->count() ? B2DVector(rNextControlPoint - mpPolygon->getPoint(mpPolygon->count() - 1)) : B2DVector::getEmptyVector()); @@ -1454,7 +1454,7 @@ namespace basegfx bool B2DPolygon::isBezierSegment(sal_uInt32 nIndex) const { OSL_ENSURE(nIndex < mpPolygon->count(), "B2DPolygon access outside range (!)"); - + if(mpPolygon->areControlPointsUsed()) { // Check if the edge exists @@ -1463,7 +1463,7 @@ namespace basegfx if(bNextIndexValidWithoutClose || mpPolygon->isClosed()) { const sal_uInt32 nNextIndex(bNextIndexValidWithoutClose ? nIndex + 1 : 0); - return (!mpPolygon->getPrevControlVector(nNextIndex).equalZero() + return (!mpPolygon->getPrevControlVector(nNextIndex).equalZero() || !mpPolygon->getNextControlVector(nIndex).equalZero()); } else @@ -1573,13 +1573,13 @@ namespace basegfx void B2DPolygon::remove(sal_uInt32 nIndex, sal_uInt32 nCount) { OSL_ENSURE(nIndex + nCount <= mpPolygon->count(), "B2DPolygon Remove outside range (!)"); - + if(nCount) { mpPolygon->remove(nIndex, nCount); } } - + void B2DPolygon::clear() { mpPolygon = DefaultPolygon::get(); diff --git a/basegfx/source/polygon/b2dpolygonclipper.cxx b/basegfx/source/polygon/b2dpolygonclipper.cxx index e368f7dbb3bd..6f38b54dd992 100644 --- a/basegfx/source/polygon/b2dpolygonclipper.cxx +++ b/basegfx/source/polygon/b2dpolygonclipper.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -94,15 +94,15 @@ namespace basegfx { // add cuts with axis to polygon, including bezier segments // Build edge to cut with. Make it a little big longer than needed for - // numerical stability. We want to cut against the edge seen as endless + // numerical stability. We want to cut against the edge seen as endless // ray here, but addPointsAtCuts() will limit itself to the // edge's range ]0.0 .. 1.0[. const double fSmallExtension((aCandidateRange.getWidth() + aCandidateRange.getHeight()) * (0.5 * 0.1)); const B2DPoint aStart( - bParallelToXAxis ? aCandidateRange.getMinX() - fSmallExtension : fValueOnOtherAxis, + bParallelToXAxis ? aCandidateRange.getMinX() - fSmallExtension : fValueOnOtherAxis, bParallelToXAxis ? fValueOnOtherAxis : aCandidateRange.getMinY() - fSmallExtension); const B2DPoint aEnd( - bParallelToXAxis ? aCandidateRange.getMaxX() + fSmallExtension : fValueOnOtherAxis, + bParallelToXAxis ? aCandidateRange.getMaxX() + fSmallExtension : fValueOnOtherAxis, bParallelToXAxis ? fValueOnOtherAxis : aCandidateRange.getMaxY() + fSmallExtension); const B2DPolygon aCandidate(addPointsAtCuts(rCandidate, aStart, aEnd)); const sal_uInt32 nPointCount(aCandidate.count()); @@ -249,7 +249,7 @@ namespace basegfx // This needs to be done with the topology knowlegde and is unfurtunately // more expensive, too. const B2DPolygon aClip(createPolygonFromRect(rRange)); - + return clipPolygonOnPolyPolygon(rCandidate, B2DPolyPolygon(aClip), bInside, bStroke); } @@ -338,10 +338,10 @@ namespace basegfx } else { - // for details, see comment in clipPolygonOnRange for the "cutting off + // for details, see comment in clipPolygonOnRange for the "cutting off // the outer parts of filled polygons at parallell lines" explanations const B2DPolygon aClip(createPolygonFromRect(rRange)); - + return clipPolyPolygonOnPolyPolygon(rCandidate, B2DPolyPolygon(aClip), bInside, bStroke); } @@ -419,7 +419,7 @@ namespace basegfx B2DPolyPolygon clipPolyPolygonOnPolyPolygon(const B2DPolyPolygon& rCandidate, const B2DPolyPolygon& rClip, bool bInside, bool bStroke) { B2DPolyPolygon aRetval; - + if(rCandidate.count() && rClip.count()) { if(bStroke) @@ -493,10 +493,10 @@ namespace basegfx // area clipping B2DPolyPolygon aMergePolyPolygonA(rClip); - // First solve all polygon-self and polygon-polygon intersections. - // Also get rid of some not-needed polygons (neutral, no area -> when + // First solve all polygon-self and polygon-polygon intersections. + // Also get rid of some not-needed polygons (neutral, no area -> when // no intersections, these are tubes). - // Now it is possible to correct the orientations in the cut-free + // Now it is possible to correct the orientations in the cut-free // polygons to values corresponding to painting the PolyPolygon with // a XOR-WindingRule. aMergePolyPolygonA = solveCrossovers(aMergePolyPolygonA); @@ -575,28 +575,28 @@ namespace basegfx * */ struct scissor_plane { - double nx,ny; // plane normal - double d; // [-] minimum distance from origin - sal_uInt32 clipmask; // clipping mask, e.g. 1000 1000 + double nx,ny; // plane normal + double d; // [-] minimum distance from origin + sal_uInt32 clipmask; // clipping mask, e.g. 1000 1000 }; /* * * polygon clipping rules (straight out of Foley and Van Dam) * =========================================================== - * current |next |emit + * current |next |emit * ____________________________________ - * inside |inside |next - * inside |outside |intersect with clip plane - * outside |outside |nothing - * outside |inside |intersect with clip plane follwed by next + * inside |inside |next + * inside |outside |intersect with clip plane + * outside |outside |nothing + * outside |inside |intersect with clip plane follwed by next * */ - sal_uInt32 scissorLineSegment( ::basegfx::B2DPoint *in_vertex, // input buffer - sal_uInt32 in_count, // number of verts in input buffer - ::basegfx::B2DPoint *out_vertex, // output buffer - scissor_plane *pPlane, // scissoring plane - const ::basegfx::B2DRectangle &rR ) // clipping rectangle + sal_uInt32 scissorLineSegment( ::basegfx::B2DPoint *in_vertex, // input buffer + sal_uInt32 in_count, // number of verts in input buffer + ::basegfx::B2DPoint *out_vertex, // output buffer + scissor_plane *pPlane, // scissoring plane + const ::basegfx::B2DRectangle &rR ) // clipping rectangle { ::basegfx::B2DPoint *curr; ::basegfx::B2DPoint *next; @@ -605,7 +605,7 @@ namespace basegfx // process all the verts for(sal_uInt32 i=0; i<in_count; i++) { - + // vertices are relative to the coordinate // system defined by the rectangle. curr = &in_vertex[i]; @@ -663,7 +663,7 @@ namespace basegfx return out_count; } - B2DPolygon clipTriangleListOnRange( const B2DPolygon& rCandidate, + B2DPolygon clipTriangleListOnRange( const B2DPolygon& rCandidate, const B2DRange& rRange ) { B2DPolygon aResult; @@ -699,13 +699,13 @@ namespace basegfx //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// - // + // // Upper bound for the maximal number of vertices when intersecting an // axis-aligned rectangle with a triangle in E2 - // + // // The rectangle and the triangle are in general position, and have 4 and 3 // vertices, respectively. - // + // // Lemma: Since the rectangle is a convex polygon ( see // http://mathworld.wolfram.com/ConvexPolygon.html for a definition), and // has no holes, it follows that any straight line will intersect the @@ -717,7 +717,7 @@ namespace basegfx // other 'outside') will at utmost add _one_ vertex to the resulting // intersection polygon (adding two intersection vertices, and removing at // least one rectangle vertex): - // + // // * // +--+-----------------+ // | * | @@ -726,7 +726,7 @@ namespace basegfx // *| | // * | | // +--------------------+ - // + // // Proof: If the straight line intersects the rectangle two // times, it does so for distinct edges, i.e. the intersection has // minimally one of the rectangle's vertices on either side of the straight @@ -734,17 +734,17 @@ namespace basegfx // minimally _one_ rectangle vertex removed from the resulting clip // polygon, and therefore, a clip against a half-plane has the net effect // of adding at utmost _one_ vertex to the resulting clip polygon. - // + // // Theorem: The intersection of a rectangle and a triangle results in a // polygon with at utmost 7 vertices. - // + // // Proof: The inside of the triangle can be described as the consecutive // intersection with three half-planes. Together with the lemma above, this // results in at utmost 3 additional vertices added to the already existing 4 // rectangle vertices. - // + // // This upper bound is attained with the following example configuration: - // + // // * // *** // ** * @@ -766,7 +766,7 @@ namespace basegfx // --*6-----5----- // ** * // ** - // + // // As we need to scissor all triangles against the // output rectangle we employ an output buffer for the // resulting vertices. the question is how large this @@ -801,7 +801,7 @@ namespace basegfx ::basegfx::B2DPoint stack[3]; unsigned int clipflag = 0; - for(sal_uInt32 nIndex=0; nIndex<nVertexCount; ++nIndex) + for(sal_uInt32 nIndex=0; nIndex<nVertexCount; ++nIndex) { // rotate stack stack[0] = stack[1]; @@ -811,14 +811,14 @@ namespace basegfx // clipping judgement clipflag |= !(rRange.isInside(stack[2])); - if(nIndex > 1) + if(nIndex > 1) { // consume vertices until a single seperate triangle has been visited. - if(!((nIndex+1)%3)) + if(!((nIndex+1)%3)) { // if any of the last three vertices was outside // we need to scissor against the destination rectangle - if(clipflag & 7) + if(clipflag & 7) { ::basegfx::B2DPoint buf0[16]; ::basegfx::B2DPoint buf1[16]; @@ -832,12 +832,12 @@ namespace basegfx vertex_count = scissorLineSegment(buf0,vertex_count,buf1,&sp[2],rRange); vertex_count = scissorLineSegment(buf1,vertex_count,buf0,&sp[3],rRange); - if(vertex_count >= 3) + if(vertex_count >= 3) { // convert triangle fan back to triangle list. ::basegfx::B2DPoint v0(buf0[0]); ::basegfx::B2DPoint v1(buf0[1]); - for(sal_uInt32 i=2; i<vertex_count; ++i) + for(sal_uInt32 i=2; i<vertex_count; ++i) { ::basegfx::B2DPoint v2(buf0[i]); aResult.append(v0); @@ -847,10 +847,10 @@ namespace basegfx } } } - else + else { // the last triangle has not been altered, simply copy to result - for(sal_uInt32 i=0; i<3; ++i) + for(sal_uInt32 i=0; i<3; ++i) aResult.append(stack[i]); } } diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx index ac118e73356f..31c4a518a0b1 100644 --- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx +++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -44,7 +44,7 @@ ////////////////////////////////////////////////////////////////////////////// // defines -#define SUBDIVIDE_FOR_CUT_TEST_COUNT (50) +#define SUBDIVIDE_FOR_CUT_TEST_COUNT (50) ////////////////////////////////////////////////////////////////////////////// @@ -56,13 +56,13 @@ namespace basegfx class temporaryPoint { - B2DPoint maPoint; // the new point - sal_uInt32 mnIndex; // index after which to insert - double mfCut; // parametric cut description [0.0 .. 1.0] + B2DPoint maPoint; // the new point + sal_uInt32 mnIndex; // index after which to insert + double mfCut; // parametric cut description [0.0 .. 1.0] public: temporaryPoint(const B2DPoint& rNewPoint, sal_uInt32 nIndex, double fCut) - : maPoint(rNewPoint), + : maPoint(rNewPoint), mnIndex(nIndex), mfCut(fCut) { @@ -91,9 +91,9 @@ namespace basegfx class temporaryPolygonData { - B2DPolygon maPolygon; - B2DRange maRange; - temporaryPointVector maPoints; + B2DPolygon maPolygon; + B2DRange maRange; + temporaryPointVector maPoints; public: const B2DPolygon& getPolygon() const { return maPolygon; } @@ -127,12 +127,12 @@ namespace basegfx // add start point aRetval.append(rCandidate.getB2DPoint(0)); - + for(sal_uInt32 a(0L); a < nCount; a++) { // get edge rCandidate.getBezierSegment(a, aEdge); - + if(aEdge.isBezier()) { // control vectors involved for this edge @@ -172,7 +172,7 @@ namespace basegfx aRetval.append(aNewPoint); } } - + // add edge end point aRetval.append(aEdge.getEndPoint()); } @@ -184,7 +184,7 @@ namespace basegfx // set closed flag and correct last point (which is added double now). tools::closeWithGeometryChange(aRetval); } - + return aRetval; } else @@ -239,8 +239,8 @@ namespace basegfx //////////////////////////////////////////////////////////////////////////////// void findEdgeCutsTwoEdges( - const B2DPoint& rCurrA, const B2DPoint& rNextA, - const B2DPoint& rCurrB, const B2DPoint& rNextB, + const B2DPoint& rCurrA, const B2DPoint& rNextA, + const B2DPoint& rCurrB, const B2DPoint& rNextB, sal_uInt32 nIndA, sal_uInt32 nIndB, temporaryPointVector& rTempPointsA, temporaryPointVector& rTempPointsB) { @@ -416,7 +416,7 @@ namespace basegfx void findEdgeCutsBezierAndEdge( const B2DCubicBezier& rCubicA, - const B2DPoint& rCurrB, const B2DPoint& rNextB, + const B2DPoint& rCurrB, const B2DPoint& rNextB, sal_uInt32 nIndA, sal_uInt32 nIndB, temporaryPointVector& rTempPointsA, temporaryPointVector& rTempPointsB) { @@ -430,7 +430,7 @@ namespace basegfx // create subdivided polygons and find cuts between them // Keep adaptiveSubdivideByCount due to needed quality - aTempPolygonA.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); + aTempPolygonA.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); aTempPolygonA.append(rCubicA.getStartPoint()); rCubicA.adaptiveSubdivideByCount(aTempPolygonA, SUBDIVIDE_FOR_CUT_TEST_COUNT); aTempPolygonEdge.append(rCurrB); @@ -471,10 +471,10 @@ namespace basegfx // create subdivided polygons and find cuts between them // Keep adaptiveSubdivideByCount due to needed quality - aTempPolygonA.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); + aTempPolygonA.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); aTempPolygonA.append(rCubicA.getStartPoint()); rCubicA.adaptiveSubdivideByCount(aTempPolygonA, SUBDIVIDE_FOR_CUT_TEST_COUNT); - aTempPolygonB.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); + aTempPolygonB.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); aTempPolygonB.append(rCubicB.getStartPoint()); rCubicB.adaptiveSubdivideByCount(aTempPolygonB, SUBDIVIDE_FOR_CUT_TEST_COUNT); @@ -515,7 +515,7 @@ namespace basegfx // create subdivided polygon and find cuts on it // Keep adaptiveSubdivideByCount due to needed quality - aTempPolygon.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); + aTempPolygon.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); aTempPolygon.append(rCubicA.getStartPoint()); rCubicA.adaptiveSubdivideByCount(aTempPolygon, SUBDIVIDE_FOR_CUT_TEST_COUNT); findCuts(aTempPolygon, aTempPointVector); @@ -595,7 +595,7 @@ namespace basegfx else { // test for simple edge-edge cuts - findEdgeCutsTwoEdges(aCubicA.getStartPoint(), aCubicA.getEndPoint(), aCubicB.getStartPoint(), aCubicB.getEndPoint(), + findEdgeCutsTwoEdges(aCubicA.getStartPoint(), aCubicA.getEndPoint(), aCubicB.getStartPoint(), aCubicB.getEndPoint(), a, b, rTempPoints, rTempPoints); } } @@ -616,7 +616,7 @@ namespace basegfx { const B2DPoint aNextB(rCandidate.getB2DPoint(b + 1L == nPointCount ? 0L : b + 1L)); const B2DRange aRangeB(aCurrB, aNextB); - + // consecutive segments touch of course bool bOverlap = false; if( b > a+1) @@ -627,7 +627,7 @@ namespace basegfx { findEdgeCutsTwoEdges(aCurrA, aNextA, aCurrB, aNextB, a, b, rTempPoints, rTempPoints); } - + // prepare next step aCurrB = aNextB; } @@ -654,13 +654,13 @@ namespace basegfx //////////////////////////////////////////////////////////////////////////////// void findTouchesOnEdge( - const B2DPoint& rCurr, const B2DPoint& rNext, const B2DPolygon& rPointPolygon, + const B2DPoint& rCurr, const B2DPoint& rNext, const B2DPolygon& rPointPolygon, sal_uInt32 nInd, temporaryPointVector& rTempPoints) { // find out if points from rPointPolygon are positioned on given edge. If Yes, add // points there to represent touches (which may be enter or leave nodes later). const sal_uInt32 nPointCount(rPointPolygon.count()); - + if(nPointCount) { const B2DRange aRange(rCurr, rNext); @@ -668,7 +668,7 @@ namespace basegfx B2DVector aNormalizedEdgeVector(aEdgeVector); aNormalizedEdgeVector.normalize(); bool bTestUsingX(fabs(aEdgeVector.getX()) > fabs(aEdgeVector.getY())); - + for(sal_uInt32 a(0L); a < nPointCount; a++) { const B2DPoint aTestPoint(rPointPolygon.getB2DPoint(a)); @@ -681,7 +681,7 @@ namespace basegfx if(areParallel(aNormalizedEdgeVector, aTestVector)) { - const double fCut((bTestUsingX) + const double fCut((bTestUsingX) ? aTestVector.getX() / aEdgeVector.getX() : aTestVector.getY() / aEdgeVector.getY()); const double fZero(0.0); @@ -701,7 +701,7 @@ namespace basegfx //////////////////////////////////////////////////////////////////////////////// void findTouchesOnCurve( - const B2DCubicBezier& rCubicA, const B2DPolygon& rPointPolygon, + const B2DCubicBezier& rCubicA, const B2DPolygon& rPointPolygon, sal_uInt32 nInd, temporaryPointVector& rTempPoints) { // find all points from rPointPolygon which touch the given bezier segment. Add an entry @@ -712,7 +712,7 @@ namespace basegfx // create subdivided polygon and find cuts on it // Keep adaptiveSubdivideByCount due to needed quality - aTempPolygon.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); + aTempPolygon.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); aTempPolygon.append(rCubicA.getStartPoint()); rCubicA.adaptiveSubdivideByCount(aTempPolygon, SUBDIVIDE_FOR_CUT_TEST_COUNT); findTouches(aTempPolygon, rPointPolygon, aTempPointVector); @@ -788,7 +788,7 @@ namespace basegfx void findCuts(const B2DPolygon& rCandidateA, const B2DPolygon& rCandidateB, temporaryPointVector& rTempPointsA, temporaryPointVector& rTempPointsB) { - // find out if edges from both polygons cut. If so, add entries to rTempPoints which + // find out if edges from both polygons cut. If so, add entries to rTempPoints which // should be added to the polygons accordingly const sal_uInt32 nPointCountA(rCandidateA.count()); const sal_uInt32 nPointCountB(rCandidateB.count()); @@ -847,7 +847,7 @@ namespace basegfx else { // test for simple edge-edge cuts - findEdgeCutsTwoEdges(aCubicA.getStartPoint(), aCubicA.getEndPoint(), aCubicB.getStartPoint(), aCubicB.getEndPoint(), + findEdgeCutsTwoEdges(aCubicA.getStartPoint(), aCubicA.getEndPoint(), aCubicB.getStartPoint(), aCubicB.getEndPoint(), a, b, rTempPointsA, rTempPointsB); } } @@ -911,7 +911,7 @@ namespace basegfx if(rCandidate.count()) { temporaryPointVector aTempPoints; - + findTouches(rCandidate, rCandidate, aTempPoints); findCuts(rCandidate, aTempPoints); @@ -1016,11 +1016,11 @@ namespace basegfx { temporaryPointVector aTempPoints; temporaryPointVector aTempPointsUnused; - + for(sal_uInt32 a(0L); a < rMask.count(); a++) { const B2DPolygon aPartMask(rMask.getB2DPolygon(a)); - + findTouches(rCandidate, aPartMask, aTempPoints); findCuts(rCandidate, aPartMask, aTempPoints, aTempPointsUnused); } @@ -1052,7 +1052,7 @@ namespace basegfx B2DPolygon addPointsAtCuts(const B2DPolygon& rCandidate, const B2DPoint& rStart, const B2DPoint& rEnd) { const sal_uInt32 nCount(rCandidate.count()); - + if(nCount && !rStart.equal(rEnd)) { const B2DRange aPolygonRange(rCandidate.getB2DRange()); @@ -1114,7 +1114,7 @@ namespace basegfx { const sal_uInt32 nCountA(rCandidate.count()); const sal_uInt32 nCountM(rPolyMask.count()); - + if(nCountA && nCountM) { const B2DRange aRangeA(rCandidate.getB2DRange()); @@ -1208,7 +1208,7 @@ namespace basegfx if(rCandidate.count()) { temporaryPointVector aTempPoints; - + findCuts(rCandidate, aTempPoints); return mergeTemporaryPointsAndPolygon(rCandidate, aTempPoints); diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index 5f053b4b22e2..1967e6ed098f 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -47,10 +47,10 @@ #include <numeric> #include <limits> -// #i37443# -#define ANGLE_BOUND_START_VALUE (2.25) -#define ANGLE_BOUND_MINIMUM_VALUE (0.1) -#define COUNT_SUBDIVIDE_DEFAULT (4L) +// #i37443# +#define ANGLE_BOUND_START_VALUE (2.25) +#define ANGLE_BOUND_MINIMUM_VALUE (0.1) +#define COUNT_SUBDIVIDE_DEFAULT (4L) #ifdef DBG_UTIL static double fAngleBoundStartValue = ANGLE_BOUND_START_VALUE; #endif @@ -103,7 +103,7 @@ namespace basegfx { // #i80172# Removed unnecessary assertion // OSL_ENSURE(!rCandidate.isClosed(), "checkClosed: already closed (!)"); - + if(rCandidate.count() > 1 && rCandidate.getB2DPoint(0) == rCandidate.getB2DPoint(rCandidate.count() - 1)) { closeWithGeometryChange(rCandidate); @@ -191,13 +191,13 @@ namespace basegfx const sal_uInt32 nEdgeCount(rCandidate.isClosed() ? nPointCount : nPointCount - 1); B2DCubicBezier aBezier; aBezier.setStartPoint(rCandidate.getB2DPoint(0)); - + // perf: try to avoid too many realloctions by guessing the result's pointcount aRetval.reserve(nPointCount*4); - + // add start point (always) aRetval.append(aBezier.getStartPoint()); - + for(sal_uInt32 a(0L); a < nEdgeCount; a++) { // get next and control points @@ -274,13 +274,13 @@ namespace basegfx const sal_uInt32 nEdgeCount(rCandidate.isClosed() ? nPointCount : nPointCount - 1); B2DCubicBezier aBezier; aBezier.setStartPoint(rCandidate.getB2DPoint(0)); - + // perf: try to avoid too many realloctions by guessing the result's pointcount aRetval.reserve(nPointCount*4); - + // add start point (always) aRetval.append(aBezier.getStartPoint()); - + // #i37443# prepare convenient AngleBound if none was given if(0.0 == fAngleBound) { @@ -294,7 +294,7 @@ namespace basegfx { fAngleBound = 0.1; } - + for(sal_uInt32 a(0L); a < nEdgeCount; a++) { // get next and control points @@ -347,19 +347,19 @@ namespace basegfx const sal_uInt32 nEdgeCount(rCandidate.isClosed() ? nPointCount : nPointCount - 1); B2DCubicBezier aBezier; aBezier.setStartPoint(rCandidate.getB2DPoint(0)); - + // perf: try to avoid too many realloctions by guessing the result's pointcount aRetval.reserve(nPointCount*4); - + // add start point (always) aRetval.append(aBezier.getStartPoint()); - + // #i37443# prepare convenient count if none was given if(0L == nCount) { nCount = COUNT_SUBDIVIDE_DEFAULT; } - + for(sal_uInt32 a(0L); a < nEdgeCount; a++) { // get next and control points @@ -420,7 +420,7 @@ namespace basegfx { const B2DPoint aPreviousPoint(aCurrentPoint); aCurrentPoint = aCandidate.getB2DPoint(a); - + // cross-over in Y? const bool bCompYA(fTools::more(aPreviousPoint.getY(), rPoint.getY())); const bool bCompYB(fTools::more(aCurrentPoint.getY(), rPoint.getY())); @@ -430,7 +430,7 @@ namespace basegfx // cross-over in X? const bool bCompXA(fTools::more(aPreviousPoint.getX(), rPoint.getX())); const bool bCompXB(fTools::more(aCurrentPoint.getX(), rPoint.getX())); - + if(bCompXA == bCompXB) { if(bCompXA) @@ -489,7 +489,7 @@ namespace basegfx for(sal_uInt32 a(0); a < nPointCount; a++) { aRetval.expand(rCandidate.getB2DPoint(a)); - + if(bControlPointsUsed) { aRetval.expand(rCandidate.getNextControlPoint(a)); @@ -593,7 +593,7 @@ namespace basegfx { double fRetval(0.0); const sal_uInt32 nPointCount(rCandidate.count()); - + if(nPointCount) { const sal_uInt32 nEdgeCount(rCandidate.isClosed() ? nPointCount : nPointCount - 1L); @@ -743,7 +743,7 @@ namespace basegfx { // get as bezier segment const B2DCubicBezier aBezierSegment( - aRetval, rCandidate.getNextControlPoint(nIndex), + aRetval, rCandidate.getNextControlPoint(nIndex), rCandidate.getPrevControlPoint(nNextIndex), aNextPoint); if(aBezierSegment.isBezier()) @@ -752,12 +752,12 @@ namespace basegfx // length and bezier distances const B2DCubicBezierHelper aBezierSegmentHelper(aBezierSegment); const double fBezierDistance(aBezierSegmentHelper.distanceToRelative(fDistance)); - + aRetval = aBezierSegment.interpolatePoint(fBezierDistance); bDone = true; } } - + if(!bDone) { const double fRelativeInEdge(fDistance / fEdgeLength); @@ -849,7 +849,7 @@ namespace basegfx if(fTools::equalZero(fEdgeLength)) { aRetval.append(rCandidate.getB2DPoint(a)); - + if(rCandidate.areControlPointsUsed()) { aRetval.setNextControlPoint(aRetval.count() - 1, rCandidate.getNextControlPoint(a)); @@ -861,11 +861,11 @@ namespace basegfx const B2DPoint aStart(rCandidate.getB2DPoint(a)); const B2DPoint aEnd(rCandidate.getB2DPoint(nNextIndex)); bool bDone(false); - + if(rCandidate.areControlPointsUsed()) { const B2DCubicBezier aBezierSegment( - aStart, rCandidate.getNextControlPoint(a), + aStart, rCandidate.getNextControlPoint(a), rCandidate.getPrevControlPoint(nNextIndex), aEnd); if(aBezierSegment.isBezier()) @@ -882,7 +882,7 @@ namespace basegfx bDone = true; } } - + if(!bDone) { const double fRelValue((fFrom - fPositionOfStart) / fEdgeLength); @@ -907,7 +907,7 @@ namespace basegfx { const sal_uInt32 nNextIndex((a + 1) % nPointCount); aRetval.append(rCandidate.getB2DPoint(nNextIndex)); - + if(rCandidate.areControlPointsUsed()) { aRetval.setPrevControlPoint(aRetval.count() - 1, rCandidate.getPrevControlPoint(nNextIndex)); @@ -919,11 +919,11 @@ namespace basegfx const B2DPoint aStart(rCandidate.getB2DPoint(a)); const B2DPoint aEnd(rCandidate.getB2DPoint(nNextIndex)); bool bDone(false); - + if(rCandidate.areControlPointsUsed()) { const B2DCubicBezier aBezierSegment( - aStart, rCandidate.getNextControlPoint(a), + aStart, rCandidate.getNextControlPoint(a), rCandidate.getPrevControlPoint(nNextIndex), aEnd); if(aBezierSegment.isBezier()) @@ -958,7 +958,7 @@ namespace basegfx // add segments end point const sal_uInt32 nNextIndex((a + 1) % nPointCount); aRetval.append(rCandidate.getB2DPoint(nNextIndex)); - + if(rCandidate.areControlPointsUsed()) { aRetval.setPrevControlPoint(aRetval.count() - 1, rCandidate.getPrevControlPoint(nNextIndex)); @@ -994,8 +994,8 @@ namespace basegfx CutFlagValue findCut( const B2DPolygon& rCandidate, - sal_uInt32 nIndex1, sal_uInt32 nIndex2, - CutFlagValue aCutFlags, + sal_uInt32 nIndex1, sal_uInt32 nIndex2, + CutFlagValue aCutFlags, double* pCut1, double* pCut2) { CutFlagValue aRetval(CUTFLAG_NONE); @@ -1025,7 +1025,7 @@ namespace basegfx CutFlagValue findCut( const B2DPolygon& rCandidate1, sal_uInt32 nIndex1, const B2DPolygon& rCandidate2, sal_uInt32 nIndex2, - CutFlagValue aCutFlags, + CutFlagValue aCutFlags, double* pCut1, double* pCut2) { CutFlagValue aRetval(CUTFLAG_NONE); @@ -1065,7 +1065,7 @@ namespace basegfx bool bFinished(!((bool)(aCutFlags & CUTFLAG_ALL))); // test for same points? - if(!bFinished + if(!bFinished && (aCutFlags & (CUTFLAG_START1|CUTFLAG_END1)) && (aCutFlags & (CUTFLAG_START2|CUTFLAG_END2))) { @@ -1133,7 +1133,7 @@ namespace basegfx aRetval = (CUTFLAG_LINE|CUTFLAG_START1); } } - + if(!bFinished && (aCutFlags & CUTFLAG_START2)) { // start2 on line 1 ? @@ -1155,7 +1155,7 @@ namespace basegfx aRetval = (CUTFLAG_LINE|CUTFLAG_END1); } } - + if(!bFinished && (aCutFlags & CUTFLAG_END2)) { // end2 on line 1 ? @@ -1224,8 +1224,8 @@ namespace basegfx bool isPointOnEdge( const B2DPoint& rPoint, - const B2DPoint& rEdgeStart, - const B2DVector& rEdgeDelta, + const B2DPoint& rEdgeStart, + const B2DVector& rEdgeDelta, double* pCut) { bool bDeltaXIsZero(fTools::equalZero(rEdgeDelta.getX())); @@ -1368,7 +1368,7 @@ namespace basegfx const double fBezierSplitStart(aCubicBezierHelper.distanceToRelative(fLastDotDashMovingLength)); const double fBezierSplitEnd(aCubicBezierHelper.distanceToRelative(fDotDashMovingLength)); B2DCubicBezier aBezierSnippet(aCurrentEdge.snippet(fBezierSplitStart, fBezierSplitEnd)); - + if(!aSnippet.count()) { aSnippet.append(aBezierSnippet.getStartPoint()); @@ -1387,7 +1387,7 @@ namespace basegfx aSnippet.clear(); } - + // prepare next DotDashArray step and flip line/gap flag fLastDotDashMovingLength = fDotDashMovingLength; fDotDashMovingLength += rDotDashArray[(++nDotDashIndex) % nDotDashCount]; @@ -1397,14 +1397,14 @@ namespace basegfx // append closing snippet [fLastDotDashMovingLength, fEdgeLength] const bool bHandleLine(bIsLine && pLineTarget); const bool bHandleGap(!bIsLine && pGapTarget); - + if(bHandleLine || bHandleGap) { B2DCubicBezier aRight; const double fBezierSplit(aCubicBezierHelper.distanceToRelative(fLastDotDashMovingLength)); aCurrentEdge.split(fBezierSplit, 0, &aRight); - + if(!aSnippet.count()) { aSnippet.append(aRight.getStartPoint()); @@ -1412,7 +1412,7 @@ namespace basegfx aSnippet.appendBezierSegment(aRight.getControlPointA(), aRight.getControlPointB(), aRight.getEndPoint()); } - + // prepare move to next edge fDotDashMovingLength -= fEdgeLength; } @@ -1450,7 +1450,7 @@ namespace basegfx aSnippet.clear(); } - + // prepare next DotDashArray step and flip line/gap flag fLastDotDashMovingLength = fDotDashMovingLength; fDotDashMovingLength += rDotDashArray[(++nDotDashIndex) % nDotDashCount]; @@ -1460,7 +1460,7 @@ namespace basegfx // append snippet [fLastDotDashMovingLength, fEdgeLength] const bool bHandleLine(bIsLine && pLineTarget); const bool bHandleGap(!bIsLine && pGapTarget); - + if(bHandleLine || bHandleGap) { if(!aSnippet.count()) @@ -1470,12 +1470,12 @@ namespace basegfx aSnippet.append(aCurrentEdge.getEndPoint()); } - + // prepare move to next edge fDotDashMovingLength -= fEdgeLength; } } - + // prepare next edge step (end point gets new start point) aCurrentEdge.setStartPoint(aCurrentEdge.getEndPoint()); } @@ -1632,7 +1632,7 @@ namespace basegfx return false; } - // test if point is inside epsilon-range around the given Polygon. Can be used + // test if point is inside epsilon-range around the given Polygon. Can be used // for HitTesting. The epsilon-range is defined to be the tube around the polygon // with distance fDistance and rounded edges (start and end point). bool isInEpsilonRange(const B2DPolygon& rCandidate, const B2DPoint& rTestPosition, double fDistance) @@ -1640,7 +1640,7 @@ namespace basegfx // force to non-bezier polygon const B2DPolygon aCandidate(rCandidate.getDefaultAdaptiveSubdivision()); const sal_uInt32 nPointCount(aCandidate.count()); - + if(nPointCount) { const sal_uInt32 nEdgeCount(aCandidate.isClosed() ? nPointCount : nPointCount - 1L); @@ -1832,7 +1832,7 @@ namespace basegfx // close aRetval.setClosed( true ); - + return aRetval; } @@ -1850,7 +1850,7 @@ namespace basegfx // close aRetval.setClosed( true ); } - + return aRetval; } @@ -1865,7 +1865,7 @@ namespace basegfx const double fKappa((M_SQRT2 - 1.0) * 4.0 / 3.0); const double fScaledKappa(fKappa * (1.0 / STEPSPERQUARTER)); const B2DHomMatrix aRotateMatrix(createRotateB2DHomMatrix(F_PI2 / STEPSPERQUARTER)); - + B2DPoint aPoint(1.0, 0.0); B2DPoint aForward(1.0, fScaledKappa); B2DPoint aBackward(1.0, -fScaledKappa); @@ -1901,7 +1901,7 @@ namespace basegfx case 1 : { static B2DPolygon aUnitCircleStartQuadrantOne; - + if(!aUnitCircleStartQuadrantOne.count()) { ::osl::Mutex m_mutex; @@ -1913,7 +1913,7 @@ namespace basegfx case 2 : { static B2DPolygon aUnitCircleStartQuadrantTwo; - + if(!aUnitCircleStartQuadrantTwo.count()) { ::osl::Mutex m_mutex; @@ -1925,7 +1925,7 @@ namespace basegfx case 3 : { static B2DPolygon aUnitCircleStartQuadrantThree; - + if(!aUnitCircleStartQuadrantThree.count()) { ::osl::Mutex m_mutex; @@ -1937,7 +1937,7 @@ namespace basegfx default : // case 0 : { static B2DPolygon aUnitCircleStartQuadrantZero; - + if(!aUnitCircleStartQuadrantZero.count()) { ::osl::Mutex m_mutex; @@ -1955,7 +1955,7 @@ namespace basegfx const B2DHomMatrix aMatrix(createScaleTranslateB2DHomMatrix(fRadiusX, fRadiusY, rCenter.getX(), rCenter.getY())); aRetval.transform(aMatrix); - + return aRetval; } @@ -2018,7 +2018,7 @@ namespace basegfx double fSegEndRad((nStartSegment + 1) * fAnglePerSegment); double fFactor(fScaledKappa * ((fSegEndRad - fStart) / fAnglePerSegment)); B2DPoint aSegEnd(cos(fSegEndRad), sin(fSegEndRad)); - + aRetval.appendBezierSegment( aSegStart + (B2DPoint(-aSegStart.getY(), aSegStart.getX()) * fFactor), aSegEnd - (B2DPoint(-aSegEnd.getY(), aSegEnd.getX()) * fFactor), @@ -2046,7 +2046,7 @@ namespace basegfx const double fSegStartRad(nSegment * fAnglePerSegment); fFactor = fScaledKappa * ((fEnd - fSegStartRad) / fAnglePerSegment); aSegEnd = B2DPoint(cos(fEnd), sin(fEnd)); - + aRetval.appendBezierSegment( aSegStart + (B2DPoint(-aSegStart.getY(), aSegStart.getX()) * fFactor), aSegEnd - (B2DPoint(-aSegEnd.getY(), aSegEnd.getX()) * fFactor), @@ -2074,7 +2074,7 @@ namespace basegfx { OSL_ENSURE(!rCandidate.areControlPointsUsed(), "hasNeutralPoints: ATM works not for curves (!)"); const sal_uInt32 nPointCount(rCandidate.count()); - + if(nPointCount > 2L) { B2DPoint aPrevPoint(rCandidate.getB2DPoint(nPointCount - 1L)); @@ -2143,7 +2143,7 @@ namespace basegfx // copy closed state aRetval.setClosed(rCandidate.isClosed()); - + return aRetval; } else @@ -2226,7 +2226,7 @@ namespace basegfx { const double fZero(0.0); const double fOne(1.0); - const double fParamTestOnCurr(fabs(aEdgeVector.getX()) > fabs(aEdgeVector.getY()) + const double fParamTestOnCurr(fabs(aEdgeVector.getX()) > fabs(aEdgeVector.getY()) ? aTestVector.getX() / aEdgeVector.getX() : aTestVector.getY() / aEdgeVector.getY()); @@ -2399,7 +2399,7 @@ namespace basegfx if( !bNullVertex ) { // 2D cross product - is 1 for CW and -1 for CCW turns - const int nCrossProduct( nHorizontalEdgeType*nCurrVerticalEdgeType - + const int nCrossProduct( nHorizontalEdgeType*nCurrVerticalEdgeType - nVerticalEdgeType*nCurrHorizontalEdgeType ); if( !nCrossProduct ) @@ -2422,9 +2422,9 @@ namespace basegfx if( (nCrossProduct == 1) != bCWPolygon ) return false; } - + ++nNumTurns; - + // More than four 90 degree turns are an // indication that this must not be a rectangle. if( nNumTurns > 4 ) @@ -2432,9 +2432,9 @@ namespace basegfx } // store current state for the next turn - nVerticalEdgeType = nCurrVerticalEdgeType; + nVerticalEdgeType = nCurrVerticalEdgeType; nHorizontalEdgeType = nCurrHorizontalEdgeType; - bNullVertex = false; // won't reach this line, + bNullVertex = false; // won't reach this line, // if bCurrNullVertex is // true - see above } @@ -2506,7 +2506,7 @@ namespace basegfx const B2DVector aVector2(rTestPoint - rPointA); const double fDividend((aVector2.getX() * aVector1.getX()) + (aVector2.getY() * aVector1.getY())); const double fDivisor((aVector1.getX() * aVector1.getX()) + (aVector1.getY() * aVector1.getY())); - + rCut = fDividend / fDivisor; const B2DPoint aCutPoint(rPointA + rCut * aVector1); @@ -2672,7 +2672,7 @@ namespace basegfx { aRetval.setPrevControlPoint(a, distort(rCandidate.getPrevControlPoint(a), rOriginal, rTopLeft, rTopRight, rBottomLeft, rBottomRight)); } - + if(!rCandidate.getNextControlPoint(a).equalZero()) { aRetval.setNextControlPoint(a, distort(rCandidate.getNextControlPoint(a), rOriginal, rTopLeft, rTopRight, rBottomLeft, rBottomRight)); @@ -2799,7 +2799,7 @@ namespace basegfx bRetval = true; } - + if(rCandidate.isNextControlPointUsed(nIndex)) { if(!rCandidate.isClosed() && nIndex == nPointCount + 1) @@ -2815,7 +2815,7 @@ namespace basegfx bRetval = true; } - + break; } case CONTINUITY_C1 : @@ -2830,7 +2830,7 @@ namespace basegfx aVectorPrev.normalize(); aVectorNext.normalize(); const B2VectorOrientation aOrientation(getOrientation(aVectorPrev, aVectorNext)); - + if(ORIENTATION_NEUTRAL == aOrientation && aVectorPrev.scalar(aVectorNext) < 0.0) { // parallel and opposite direction; check length @@ -2841,9 +2841,9 @@ namespace basegfx const sal_uInt32 nNextIndex((nIndex + 1) % nPointCount); const double fLenPrevEdge(B2DVector(rCandidate.getB2DPoint(nPrevIndex) - aCurrentPoint).getLength() * (1.0 / 3.0)); const double fLenNextEdge(B2DVector(rCandidate.getB2DPoint(nNextIndex) - aCurrentPoint).getLength() * (1.0 / 3.0)); - - rCandidate.setControlPoints(nIndex, - aCurrentPoint + (aVectorPrev * fLenPrevEdge), + + rCandidate.setControlPoints(nIndex, + aCurrentPoint + (aVectorPrev * fLenPrevEdge), aCurrentPoint + (aVectorNext * fLenNextEdge)); bRetval = true; } @@ -2855,14 +2855,14 @@ namespace basegfx if(ORIENTATION_POSITIVE == aOrientation) { - rCandidate.setControlPoints(nIndex, - aCurrentPoint - (aNormalizedPerpendicular * fLenPrev), + rCandidate.setControlPoints(nIndex, + aCurrentPoint - (aNormalizedPerpendicular * fLenPrev), aCurrentPoint + (aNormalizedPerpendicular * fLenNext)); } else { - rCandidate.setControlPoints(nIndex, - aCurrentPoint + (aNormalizedPerpendicular * fLenPrev), + rCandidate.setControlPoints(nIndex, + aCurrentPoint + (aNormalizedPerpendicular * fLenPrev), aCurrentPoint - (aNormalizedPerpendicular * fLenNext)); } @@ -2882,14 +2882,14 @@ namespace basegfx aVectorPrev.normalize(); aVectorNext.normalize(); const B2VectorOrientation aOrientation(getOrientation(aVectorPrev, aVectorNext)); - + if(ORIENTATION_NEUTRAL == aOrientation && aVectorPrev.scalar(aVectorNext) < 0.0) { // parallel and opposite direction; set length. Use one direction for better numerical correctness const B2DVector aScaledDirection(aVectorPrev * fCommonLength); rCandidate.setControlPoints(nIndex, - aCurrentPoint + aScaledDirection, + aCurrentPoint + aScaledDirection, aCurrentPoint - aScaledDirection); } else @@ -2900,14 +2900,14 @@ namespace basegfx if(ORIENTATION_POSITIVE == aOrientation) { - rCandidate.setControlPoints(nIndex, - aCurrentPoint - aPerpendicular, + rCandidate.setControlPoints(nIndex, + aCurrentPoint - aPerpendicular, aCurrentPoint + aPerpendicular); } else { - rCandidate.setControlPoints(nIndex, - aCurrentPoint + aPerpendicular, + rCandidate.setControlPoints(nIndex, + aCurrentPoint + aPerpendicular, aCurrentPoint - aPerpendicular); } } @@ -3044,7 +3044,7 @@ namespace basegfx { const double fSplitPoint(1.0 / b); B2DCubicBezier aLeftPart; - + aCurrentEdge.split(fSplitPoint, &aLeftPart, &aCurrentEdge); aRetval.appendBezierSegment(aLeftPart.getControlPointA(), aLeftPart.getControlPointB(), aLeftPart.getEndPoint()); } @@ -3066,7 +3066,7 @@ namespace basegfx aCurrentEdge.setStartPoint(aSplitPoint); } } - + // copy remaining segment to target aRetval.append(aCurrentEdge.getEndPoint()); } @@ -3115,14 +3115,14 @@ namespace basegfx } bool isPolyPolygonEqualRectangle( const B2DPolyPolygon& rPolyPoly, - const B2DRange& rRect ) + const B2DRange& rRect ) { // exclude some cheap cases first if( rPolyPoly.count() != 1 ) return false; // fill array with rectangle vertices - const B2DPoint aPoints[] = + const B2DPoint aPoints[] = { B2DPoint(rRect.getMinX(),rRect.getMinY()), B2DPoint(rRect.getMaxX(),rRect.getMinY()), @@ -3143,9 +3143,9 @@ namespace basegfx { const B2DPoint p(rPoly.getB2DPoint(i)); - // 1 | x0 y0 1 | + // 1 | x0 y0 1 | // A = - | x1 y1 1 | - // 2 | x2 y2 1 | + // 2 | x2 y2 1 | double fDoubleArea = p2.getX()*p.getY() - p2.getY()*p.getX() - p1.getX()*p.getY() + @@ -3173,7 +3173,7 @@ namespace basegfx B2DPolygon createSimplifiedPolygon( const B2DPolygon& rCandidate ) { const sal_uInt32 nCount(rCandidate.count()); - + if(nCount && rCandidate.areControlPointsUsed()) { const sal_uInt32 nEdgeCount(rCandidate.isClosed() ? nCount : nCount - 1); @@ -3200,7 +3200,7 @@ namespace basegfx { // split off left, now extremum-free part and append B2DCubicBezier aLeft; - + aSegment.split(fExtremumPos, &aLeft, &aSegment); aLeft.testAndSolveTrivialBezier(); aSegment.testAndSolveTrivialBezier(); @@ -3388,7 +3388,7 @@ namespace basegfx const double fScalar(fPositionInEdge / fEdgeLength); aRetval.append(aCurrent + (aEdge * fScalar)); fPositionInEdge += fLength; - + if(bEndActive) { fAbsolutePosition += fLength; @@ -3434,12 +3434,12 @@ namespace basegfx { fWaveWidth = 0.0; } - + if(fWaveHeight < 0.0) { fWaveHeight = 0.0; } - + const bool bHasWidth(!fTools::equalZero(fWaveWidth)); const bool bHasHeight(!fTools::equalZero(fWaveHeight)); @@ -3492,7 +3492,7 @@ namespace basegfx { // no width -> no waveline, stay empty and return } - + return aRetval; } @@ -3554,7 +3554,7 @@ namespace basegfx if(nPointCount > 1) { - // Start by copying the source polygon to get a writeable copy. The closed state is + // Start by copying the source polygon to get a writeable copy. The closed state is // copied by aRetval's initialisation, too, so no need to copy it in this method B2DPolygon aRetval(rCandidate); diff --git a/basegfx/source/polygon/b2dpolygontriangulator.cxx b/basegfx/source/polygon/b2dpolygontriangulator.cxx index 2454a3d1ab58..f489712a88a1 100644 --- a/basegfx/source/polygon/b2dpolygontriangulator.cxx +++ b/basegfx/source/polygon/b2dpolygontriangulator.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -48,14 +48,14 @@ namespace basegfx { class EdgeEntry { - EdgeEntry* mpNext; - B2DPoint maStart; - B2DPoint maEnd; - double mfAtan2; + EdgeEntry* mpNext; + B2DPoint maStart; + B2DPoint maEnd; + double mfAtan2; public: EdgeEntry(const B2DPoint& rStart, const B2DPoint& rEnd) - : mpNext(0L), + : mpNext(0L), maStart(rStart), maEnd(rEnd), mfAtan2(0.0) @@ -130,11 +130,11 @@ namespace basegfx class Triangulator { - EdgeEntry* mpList; - EdgeEntries maStartEntries; - EdgeEntryPointers maNewEdgeEntries; - B2DPolygon maResult; - + EdgeEntry* mpList; + EdgeEntries maStartEntries; + EdgeEntryPointers maNewEdgeEntries; + B2DPolygon maResult; + void handleClosingEdge(const B2DPoint& rStart, const B2DPoint& rEnd); bool CheckPointInTriangle(EdgeEntry* pEdgeA, EdgeEntry* pEdgeB, const B2DPoint& rTestPoint); void createTriangle(const B2DPoint& rA, const B2DPoint& rB, const B2DPoint& rC); @@ -153,7 +153,7 @@ namespace basegfx EdgeEntry* pCurr = mpList; EdgeEntry* pPrev = 0L; - while(pCurr + while(pCurr && pCurr->getStart().getY() <= aNew.getStart().getY() && *pCurr != aNew) { @@ -213,7 +213,7 @@ namespace basegfx EdgeEntry* pEnd = new EdgeEntry(*pStart); maNewEdgeEntries.push_back(pStart); maNewEdgeEntries.push_back(pEnd); - + pStart->setNext(pEnd); pEnd->setNext(pEdgeA->getNext()); pEdgeA->setNext(pStart); @@ -234,7 +234,7 @@ namespace basegfx // consume as long as there are edges Triangulator::Triangulator(const B2DPolyPolygon& rCandidate) - : mpList(0L) + : mpList(0L) { // add all available edges to the single linked local list which will be sorted // by Y,X,atan2 when adding nodes @@ -344,7 +344,7 @@ namespace basegfx { // look for end point in triange pTestEdge = pEdgeB->getNext(); - + while(bNoPointInTriangle && pTestEdge) { if(aRange.getMaxY() < pTestEdge->getStart().getY()) diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx index af337a5bcc75..5c14997a0e36 100644 --- a/basegfx/source/polygon/b2dpolypolygon.cxx +++ b/basegfx/source/polygon/b2dpolypolygon.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -43,9 +43,9 @@ class ImplB2DPolyPolygon { - typedef ::std::vector< basegfx::B2DPolygon > PolygonVector; + typedef ::std::vector< basegfx::B2DPolygon > PolygonVector; - PolygonVector maPolygons; + PolygonVector maPolygons; public: ImplB2DPolyPolygon() : maPolygons() @@ -202,7 +202,7 @@ public: namespace basegfx { - namespace { struct DefaultPolyPolygon: public rtl::Static<B2DPolyPolygon::ImplType, + namespace { struct DefaultPolyPolygon: public rtl::Static<B2DPolyPolygon::ImplType, DefaultPolyPolygon> {}; } B2DPolyPolygon::B2DPolyPolygon() : @@ -257,7 +257,7 @@ namespace basegfx B2DPolygon B2DPolyPolygon::getB2DPolygon(sal_uInt32 nIndex) const { OSL_ENSURE(nIndex < mpPolyPolygon->count(), "B2DPolyPolygon access outside range (!)"); - + return mpPolyPolygon->getB2DPolygon(nIndex); } @@ -287,7 +287,7 @@ namespace basegfx void B2DPolyPolygon::insert(sal_uInt32 nIndex, const B2DPolygon& rPolygon, sal_uInt32 nCount) { OSL_ENSURE(nIndex <= mpPolyPolygon->count(), "B2DPolyPolygon Insert outside range (!)"); - + if(nCount) mpPolyPolygon->insert(nIndex, rPolygon, nCount); } @@ -325,7 +325,7 @@ namespace basegfx void B2DPolyPolygon::insert(sal_uInt32 nIndex, const B2DPolyPolygon& rPolyPolygon) { OSL_ENSURE(nIndex <= mpPolyPolygon->count(), "B2DPolyPolygon Insert outside range (!)"); - + if(rPolyPolygon.count()) mpPolyPolygon->insert(nIndex, rPolyPolygon); } @@ -339,11 +339,11 @@ namespace basegfx void B2DPolyPolygon::remove(sal_uInt32 nIndex, sal_uInt32 nCount) { OSL_ENSURE(nIndex + nCount <= mpPolyPolygon->count(), "B2DPolyPolygon Remove outside range (!)"); - + if(nCount) mpPolyPolygon->remove(nIndex, nCount); } - + void B2DPolyPolygon::clear() { mpPolyPolygon = DefaultPolyPolygon::get(); diff --git a/basegfx/source/polygon/b2dpolypolygoncutter.cxx b/basegfx/source/polygon/b2dpolypolygoncutter.cxx index b6dad1e917fa..5163f1e128d9 100644 --- a/basegfx/source/polygon/b2dpolypolygoncutter.cxx +++ b/basegfx/source/polygon/b2dpolypolygoncutter.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -52,9 +52,9 @@ namespace basegfx struct StripHelper { - B2DRange maRange; - sal_Int32 mnDepth; - B2VectorOrientation meOrinetation; + B2DRange maRange; + sal_Int32 mnDepth; + B2VectorOrientation meOrinetation; }; ////////////////////////////////////////////////////////////////////////////// @@ -120,7 +120,7 @@ namespace basegfx class solver { - private: + private: const B2DPolyPolygon maOriginal; PNV maPNV; VNV maVNV; @@ -175,7 +175,7 @@ namespace basegfx // b is right turn seen from a, test if Test is right of both and so outside (left is seeen as inside) const bool bBoolA(fTools::lessOrEqual(rVecA.cross(rTest), 0.0)); const bool bBoolB(fTools::moreOrEqual(rVecB.cross(rTest), 0.0)); - + return (!(bBoolA && bBoolB)); } } @@ -206,7 +206,7 @@ namespace basegfx // Use maOriginalNext, not maNext to create the original (yet unchanged) // curve segment. Otherwise, this segment would NOT ne correct. const B2DVector& rCPB(bPrev ? maVNV[maPNV[rPN.mnIP].mnI].maOriginalNext : maVNV[maPNV[rPN.mnIN].mnI].maPrev); - + return B2DCubicBezier(rStart, rStart + rCPA, rEnd + rCPB, rEnd); } @@ -222,7 +222,7 @@ namespace basegfx // deadend on A (identical edge) return; } - + const B2DCubicBezier aNextB(createSegment(rPNb, false)); const B2DCubicBezier aPrevB(createSegment(rPNb, true)); @@ -299,7 +299,7 @@ namespace basegfx const B2DVector aNextCA(aNextA.interpolatePoint(0.5) - aNextA.getStartPoint()); const B2DVector aPrevCB(aPrevB.interpolatePoint(0.5) - aPrevB.getStartPoint()); const bool bEnter(impLeftOfEdges(aPrevCA, aNextCA, aPrevCB)); - + const B2DCubicBezier aNextA2(createSegment(*pPNa2, false)); const B2DCubicBezier aPrevA2(createSegment(*pPNa2, true)); const B2DCubicBezier aNextB2(createSegment(*pPNb2, false)); @@ -307,7 +307,7 @@ namespace basegfx const B2DVector aNextCA2(aNextA2.interpolatePoint(0.5) - aNextA2.getStartPoint()); const B2DVector aNextCB2(aNextB2.interpolatePoint(0.5) - aNextB2.getStartPoint()); const bool bLeave(impLeftOfEdges(aPrevCA2, aNextCA2, aNextCB2)); - + if(bEnter != bLeave) { // crossover @@ -569,7 +569,7 @@ namespace basegfx // fill data sal_uInt32 nInsertIndex(0); - + for(a = 0; a < nOriginalCount; a++) { const B2DPolygon aCandidate(aGeometry.getB2DPolygon(a)); @@ -613,11 +613,11 @@ namespace basegfx { const B2DPoint& rPoint = pPNCurr->maPoint; aNewPart.append(rPoint); - + if(mbIsCurve) { const VN& rVNCurr = maVNV[pPNCurr->mnI]; - + if(!rVNCurr.maPrev.equalZero()) { aNewPart.setPrevControlPoint(aNewPart.count() - 1, rPoint + rVNCurr.maPrev); @@ -629,7 +629,7 @@ namespace basegfx } } - pPNCurr->mnI = SAL_MAX_UINT32; + pPNCurr->mnI = SAL_MAX_UINT32; nCountdown--; pPNCurr = &(maPNV[pPNCurr->mnIN]); } @@ -814,7 +814,7 @@ namespace basegfx { solver aSolver(rCandidate); B2DPolyPolygon aRetval(stripNeutralPolygons(aSolver.getB2DPolyPolygon())); - + return correctOrientations(aRetval); } @@ -822,7 +822,7 @@ namespace basegfx { solver aSolver(rCandidate); B2DPolyPolygon aRetval(stripNeutralPolygons(aSolver.getB2DPolyPolygon())); - + return correctOrientations(aRetval); } @@ -845,7 +845,7 @@ namespace basegfx aRetval.append(rCandidateB); aRetval = solveCrossovers(aRetval); aRetval = stripNeutralPolygons(aRetval); - + return stripDispensablePolygons(aRetval, false); } } @@ -870,7 +870,7 @@ namespace basegfx aRetval.append(rCandidateB); aRetval = solveCrossovers(aRetval); aRetval = stripNeutralPolygons(aRetval); - + return correctOrientations(aRetval); } } @@ -895,7 +895,7 @@ namespace basegfx aRetval.append(rCandidateB); aRetval = solveCrossovers(aRetval); aRetval = stripNeutralPolygons(aRetval); - + return stripDispensablePolygons(aRetval, true); } } @@ -914,11 +914,11 @@ namespace basegfx { // Make B topologically to holes and append to A B2DPolyPolygon aRetval(rCandidateB); - + aRetval.flip(); aRetval.append(rCandidateA); - // solve crossovers and throw away all sub-polygons which have a + // solve crossovers and throw away all sub-polygons which have a // depth other than 0. aRetval = basegfx::tools::solveCrossovers(aRetval); aRetval = basegfx::tools::stripNeutralPolygons(aRetval); @@ -930,7 +930,7 @@ namespace basegfx B2DPolyPolygon mergeToSinglePolyPolygon(const std::vector< basegfx::B2DPolyPolygon >& rInput) { std::vector< basegfx::B2DPolyPolygon > aInput(rInput); - + // first step: prepareForPolygonOperation and simple merge of non-overlapping // PolyPolygons for speedup; this is possible for the wanted OR-operation if(aInput.size()) diff --git a/basegfx/source/polygon/b2dpolypolygonrasterconverter.cxx b/basegfx/source/polygon/b2dpolypolygonrasterconverter.cxx index 421ec9c43078..21d1a7c96686 100644 --- a/basegfx/source/polygon/b2dpolypolygonrasterconverter.cxx +++ b/basegfx/source/polygon/b2dpolypolygonrasterconverter.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -62,7 +62,7 @@ namespace basegfx // current size of index list sal_uInt32 m_current_size; - + // last known size of index list sal_uInt32 m_previous_size; @@ -82,7 +82,7 @@ namespace basegfx }; inline radixSort::radixSort( void ) { - + m_indices1 = NULL; m_indices2 = NULL; m_current_size = 0; @@ -98,7 +98,7 @@ namespace basegfx } bool radixSort::resize( sal_uInt32 nNumElements ) { - + if(nNumElements==m_previous_size) return true; @@ -126,7 +126,7 @@ namespace basegfx m_current_size = nNumElements; } - + m_previous_size = nNumElements; // initialize indices @@ -145,7 +145,7 @@ namespace basegfx // clear counters sal_uInt32 *ptr = m_counter; - for(int i=0; i<64; ++i) + for(int i=0; i<64; ++i) { *ptr++ = 0; *ptr++ = 0; @@ -178,7 +178,7 @@ namespace basegfx bool bSorted = true; while(p!=pe) { float value = *(float *)(((sal_uInt8 *)pInput)+((*Indices++)*dwStride)); - if(value<previous_value) { + if(value<previous_value) { bSorted = false; break; } @@ -245,7 +245,7 @@ namespace basegfx sal_uInt32 id = *Indices++; m_indices2[m_offset[InputBytes[id*dwStride]]++] = id; } - sal_uInt32 *Tmp = m_indices1; + sal_uInt32 *Tmp = m_indices1; m_indices1 = m_indices2; m_indices2 = Tmp; } @@ -265,7 +265,7 @@ namespace basegfx if(Radix<128) m_indices2[m_offset[Radix]++] = m_indices1[i]; else m_indices2[--m_offset[Radix]] = m_indices1[i]; } - sal_uInt32 *Tmp = m_indices1; + sal_uInt32 *Tmp = m_indices1; m_indices1 = m_indices2; m_indices2 = Tmp; } @@ -273,7 +273,7 @@ namespace basegfx if(unique_value>=128) { for(i=0;i<nNumElements;i++) m_indices2[i] = m_indices1[nNumElements-i-1]; - sal_uInt32 *Tmp = m_indices1; + sal_uInt32 *Tmp = m_indices1; m_indices1 = m_indices2; m_indices2 = Tmp; } @@ -287,7 +287,7 @@ namespace basegfx //************************************************************ // Internal vertex storage of B2DPolyPolygonRasterConverter //************************************************************ - + inline B2DPolyPolygonRasterConverter::Vertex::Vertex() : aP1(), aP2(), @@ -313,14 +313,14 @@ namespace basegfx class ImplLineNode { public: - sal_Int32 mnYCounter; - float mfXPos; - float mfXDelta; - bool mbDownwards; - + sal_Int32 mnYCounter; + float mfXPos; + float mfXDelta; + bool mbDownwards; + public: /**rP1 and rP2 must not have equal y values, when rounded - to integer! + to integer! */ ImplLineNode(const B2DPoint& rP1, const B2DPoint& rP2, bool bDown) : mnYCounter( fround(rP2.getY()) - fround(rP1.getY()) ), @@ -331,11 +331,11 @@ namespace basegfx } /// get current x position - const float& getXPos() const - { - return mfXPos; + const float& getXPos() const + { + return mfXPos; } - + /// returns true, if line ends on this Y value float nextLine() { @@ -380,19 +380,19 @@ namespace basegfx } }; } - + void B2DPolyPolygonRasterConverter::init() { if(!maPolyPolyRectangle.isEmpty()) { - const sal_Int32 nMinY( fround(maPolyPolyRectangle.getMinY()) ); + const sal_Int32 nMinY( fround(maPolyPolyRectangle.getMinY()) ); const sal_Int32 nScanlines(fround(maPolyPolyRectangle.getMaxY()) - nMinY); maScanlines.resize( nScanlines+1 ); - // add all polygons - for( sal_uInt32 i(0), nCount(maPolyPolygon.count()); - i < nCount; + // add all polygons + for( sal_uInt32 i(0), nCount(maPolyPolygon.count()); + i < nCount; ++i ) { // add all vertices @@ -465,7 +465,7 @@ namespace basegfx B2DPolyPolygonRasterConverter::B2DPolyPolygonRasterConverter( const B2DPolyPolygon& rPolyPolyRaster, const B2DRectangle& rRasterArea ) : maPolyPolygon( rPolyPolyRaster ), - maPolyPolyRectangle( + maPolyPolyRectangle( getCombinedBounds( rPolyPolyRaster, rRasterArea ) ), maScanlines() @@ -512,12 +512,12 @@ namespace basegfx if( maScanlines.empty() ) return; // no scanlines at all -> bail out - const sal_Int32 nMinY( fround(maPolyPolyRectangle.getMinY()) ); + const sal_Int32 nMinY( fround(maPolyPolyRectangle.getMinY()) ); const sal_Int32 nScanlines(fround(maPolyPolyRectangle.getMaxY()) - nMinY); // Vector of currently active vertices. A vertex is active, if // it crosses or touches the current scanline. - VectorOfLineNodes aActiveVertices; + VectorOfLineNodes aActiveVertices; // mickey's optimized version... radixSort rs; @@ -541,7 +541,7 @@ namespace basegfx } // sort with increasing X - if(bSort) + if(bSort) { bSort = false; @@ -566,7 +566,7 @@ namespace basegfx else { const sal_Int32 nCurrY( nMinY + y ); - + // scanline not empty - forward all scans to derived, // according to selected fill rule @@ -610,14 +610,14 @@ namespace basegfx i % 2 == 0 ); float delta = aActiveVertices[nIndex].nextLine(); - if(delta > 0.0f) + if(delta > 0.0f) { if(aActiveVertices[nIndex].getXPos() > aActiveVertices[nNextIndex].getXPos()) bSort = true; } - else if(delta < 0.0f) + else if(delta < 0.0f) { - if(i) + if(i) { sal_uInt32 nPrevIndex = sorted[i-1]; if(aActiveVertices[nIndex].getXPos() < aActiveVertices[nPrevIndex].getXPos()) @@ -645,14 +645,14 @@ namespace basegfx nWindingNumber != 0 ); float delta = aActiveVertices[nIndex].nextLine(); - if(delta > 0.0f) + if(delta > 0.0f) { if(aActiveVertices[nIndex].getXPos() > aActiveVertices[nNextIndex].getXPos()) bSort = true; } - else if(delta < 0.0f) + else if(delta < 0.0f) { - if(i) + if(i) { sal_uInt32 nPrevIndex = sorted[i-1]; if(aActiveVertices[nIndex].getXPos() < aActiveVertices[nPrevIndex].getXPos()) @@ -674,10 +674,10 @@ namespace basegfx // also call nextLine on very last line node sal_uInt32 nIndex = sorted[nb-1]; - float delta = aActiveVertices[nIndex].nextLine(); + float delta = aActiveVertices[nIndex].nextLine(); if(delta < 0.0f) { - if(nb) + if(nb) { sal_uInt32 nPrevIndex = sorted[nb-2]; if(aActiveVertices[nIndex].getXPos() < aActiveVertices[nPrevIndex].getXPos()) @@ -692,7 +692,7 @@ namespace basegfx ::boost::mem_fn( &ImplLineNode::isEnded ) ), aActiveVertices.end() ); nb = aActiveVertices.size(); - if(nb != nb_previous) + if(nb != nb_previous) { nb_previous = nb; bSort = true; diff --git a/basegfx/source/polygon/b2dpolypolygontools.cxx b/basegfx/source/polygon/b2dpolypolygontools.cxx index 06e9da5fa305..aa8c27fc6ddf 100644 --- a/basegfx/source/polygon/b2dpolypolygontools.cxx +++ b/basegfx/source/polygon/b2dpolypolygontools.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -279,16 +279,16 @@ namespace basegfx if(rCandidate.count() && fFullDashDotLen > 0.0) { B2DPolyPolygon aLineTarget, aGapTarget; - + for(sal_uInt32 a(0L); a < rCandidate.count(); a++) { const B2DPolygon aCandidate(rCandidate.getB2DPolygon(a)); - + applyLineDashing( - aCandidate, - rDotDashArray, - pLineTarget ? &aLineTarget : 0, - pGapTarget ? &aGapTarget : 0, + aCandidate, + rDotDashArray, + pLineTarget ? &aLineTarget : 0, + pGapTarget ? &aGapTarget : 0, fFullDashDotLen); if(pLineTarget) @@ -503,7 +503,7 @@ namespace basegfx // exclude some cheap cases first if( rPoly.count() != 1 ) return false; - + return isRectangle( rPoly.getB2DPolygon(0) ); } diff --git a/basegfx/source/polygon/b2dsvgpolypolygon.cxx b/basegfx/source/polygon/b2dsvgpolypolygon.cxx index e17c5073954e..7f5ed0758696 100644 --- a/basegfx/source/polygon/b2dsvgpolypolygon.cxx +++ b/basegfx/source/polygon/b2dsvgpolypolygon.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -44,9 +44,9 @@ namespace basegfx { namespace { - void lcl_skipSpaces(sal_Int32& io_rPos, - const ::rtl::OUString& rStr, - const sal_Int32 nLen) + void lcl_skipSpaces(sal_Int32& io_rPos, + const ::rtl::OUString& rStr, + const sal_Int32 nLen) { while( io_rPos < nLen && sal_Unicode(' ') == rStr[io_rPos] ) @@ -55,11 +55,11 @@ namespace basegfx } } - void lcl_skipSpacesAndCommas(sal_Int32& io_rPos, - const ::rtl::OUString& rStr, - const sal_Int32 nLen) + void lcl_skipSpacesAndCommas(sal_Int32& io_rPos, + const ::rtl::OUString& rStr, + const sal_Int32 nLen) { - while(io_rPos < nLen + while(io_rPos < nLen && (sal_Unicode(' ') == rStr[io_rPos] || sal_Unicode(',') == rStr[io_rPos])) { ++io_rPos; @@ -81,10 +81,10 @@ namespace basegfx bSignAllowed); } - bool lcl_getDoubleChar(double& o_fRetval, - sal_Int32& io_rPos, - const ::rtl::OUString& rStr, - const sal_Int32 /*nLen*/) + bool lcl_getDoubleChar(double& o_fRetval, + sal_Int32& io_rPos, + const ::rtl::OUString& rStr, + const sal_Int32 /*nLen*/) { sal_Unicode aChar( rStr[io_rPos] ); ::rtl::OUStringBuffer sNumberString; @@ -106,7 +106,7 @@ namespace basegfx { sNumberString.append(rStr[io_rPos]); aChar = rStr[++io_rPos]; - + if(sal_Unicode('+') == aChar || sal_Unicode('-') == aChar) { sNumberString.append(rStr[io_rPos]); @@ -123,10 +123,10 @@ namespace basegfx if(sNumberString.getLength()) { rtl_math_ConversionStatus eStatus; - o_fRetval = ::rtl::math::stringToDouble( sNumberString.makeStringAndClear(), - (sal_Unicode)('.'), - (sal_Unicode)(','), - &eStatus, + o_fRetval = ::rtl::math::stringToDouble( sNumberString.makeStringAndClear(), + (sal_Unicode)('.'), + (sal_Unicode)(','), + &eStatus, NULL ); return ( eStatus == rtl_math_ConversionStatus_Ok ); } @@ -134,10 +134,10 @@ namespace basegfx return false; } - bool lcl_importDoubleAndSpaces( double& o_fRetval, - sal_Int32& io_rPos, - const ::rtl::OUString& rStr, - const sal_Int32 nLen ) + bool lcl_importDoubleAndSpaces( double& o_fRetval, + sal_Int32& io_rPos, + const ::rtl::OUString& rStr, + const sal_Int32 nLen ) { if( !lcl_getDoubleChar(o_fRetval, io_rPos, rStr, nLen) ) return false; @@ -148,9 +148,9 @@ namespace basegfx } bool lcl_importNumberAndSpaces(sal_Int32& o_nRetval, - sal_Int32& io_rPos, - const ::rtl::OUString& rStr, - const sal_Int32 nLen) + sal_Int32& io_rPos, + const ::rtl::OUString& rStr, + const sal_Int32 nLen) { sal_Unicode aChar( rStr[io_rPos] ); ::rtl::OUStringBuffer sNumberString; @@ -178,9 +178,9 @@ namespace basegfx return false; } - void lcl_skipNumber(sal_Int32& io_rPos, - const ::rtl::OUString& rStr, - const sal_Int32 nLen) + void lcl_skipNumber(sal_Int32& io_rPos, + const ::rtl::OUString& rStr, + const sal_Int32 nLen) { bool bSignAllowed(true); @@ -191,9 +191,9 @@ namespace basegfx } } - void lcl_skipDouble(sal_Int32& io_rPos, - const ::rtl::OUString& rStr, - const sal_Int32 /*nLen*/) + void lcl_skipDouble(sal_Int32& io_rPos, + const ::rtl::OUString& rStr, + const sal_Int32 /*nLen*/) { sal_Unicode aChar( rStr[io_rPos] ); @@ -209,7 +209,7 @@ namespace basegfx if(sal_Unicode('e') == aChar || sal_Unicode('E') == aChar) { aChar = rStr[++io_rPos]; - + if(sal_Unicode('+') == aChar || sal_Unicode('-') == aChar) aChar = rStr[++io_rPos]; @@ -219,33 +219,33 @@ namespace basegfx } } } - void lcl_skipNumberAndSpacesAndCommas(sal_Int32& io_rPos, - const ::rtl::OUString& rStr, - const sal_Int32 nLen) + void lcl_skipNumberAndSpacesAndCommas(sal_Int32& io_rPos, + const ::rtl::OUString& rStr, + const sal_Int32 nLen) { lcl_skipNumber(io_rPos, rStr, nLen); lcl_skipSpacesAndCommas(io_rPos, rStr, nLen); } // #100617# Allow to skip doubles, too. - void lcl_skipDoubleAndSpacesAndCommas(sal_Int32& io_rPos, - const ::rtl::OUString& rStr, - const sal_Int32 nLen) + void lcl_skipDoubleAndSpacesAndCommas(sal_Int32& io_rPos, + const ::rtl::OUString& rStr, + const sal_Int32 nLen) { lcl_skipDouble(io_rPos, rStr, nLen); lcl_skipSpacesAndCommas(io_rPos, rStr, nLen); } - void lcl_putNumberChar( ::rtl::OUStringBuffer& rStr, - double fValue ) + void lcl_putNumberChar( ::rtl::OUStringBuffer& rStr, + double fValue ) { rStr.append( fValue ); } - void lcl_putNumberCharWithSpace( ::rtl::OUStringBuffer& rStr, - double fValue, - double fOldValue, - bool bUseRelativeCoordinates ) + void lcl_putNumberCharWithSpace( ::rtl::OUStringBuffer& rStr, + double fValue, + double fOldValue, + bool bUseRelativeCoordinates ) { if( bUseRelativeCoordinates ) fValue -= fOldValue; @@ -253,7 +253,7 @@ namespace basegfx const sal_Int32 aLen( rStr.getLength() ); if(aLen) { - if( lcl_isOnNumberChar(rStr.charAt(aLen - 1), false) && + if( lcl_isOnNumberChar(rStr.charAt(aLen - 1), false) && fValue >= 0.0 ) { rStr.append( sal_Unicode(' ') ); @@ -265,13 +265,13 @@ namespace basegfx inline sal_Unicode lcl_getCommand( sal_Char cUpperCaseCommand, sal_Char cLowerCaseCommand, - bool bUseRelativeCoordinates ) + bool bUseRelativeCoordinates ) { return bUseRelativeCoordinates ? cLowerCaseCommand : cUpperCaseCommand; } } - bool importFromSvgD(B2DPolyPolygon& o_rPolyPolygon, const ::rtl::OUString& rSvgDStatement) + bool importFromSvgD(B2DPolyPolygon& o_rPolyPolygon, const ::rtl::OUString& rSvgDStatement) { o_rPolyPolygon.clear(); const sal_Int32 nLen(rSvgDStatement.getLength()); @@ -302,7 +302,7 @@ namespace basegfx bIsClosed = true; break; } - + case 'm' : case 'M' : { @@ -327,9 +327,9 @@ namespace basegfx { closeWithGeometryChange(aCurrPoly); } - + o_rPolyPolygon.append(aCurrPoly); - + // reset import values bIsClosed = false; aCurrPoly.clear(); @@ -355,7 +355,7 @@ namespace basegfx // set last position nLastX = nX; nLastY = nY; - + // add point aCurrPoly.append(B2DPoint(nX, nY)); } @@ -385,13 +385,13 @@ namespace basegfx // set last position nLastX = nX; - + // add point aCurrPoly.append(B2DPoint(nX, nY)); } break; } - + case 'v' : { bRelative = true; @@ -415,13 +415,13 @@ namespace basegfx // set last position nLastY = nY; - + // add point aCurrPoly.append(B2DPoint(nX, nY)); } break; } - + case 's' : { bRelative = true; @@ -480,7 +480,7 @@ namespace basegfx } break; } - + case 'c' : { bRelative = true; @@ -529,7 +529,7 @@ namespace basegfx } break; } - + // #100617# quadratic beziers are imported as cubic ones case 'q' : { @@ -580,7 +580,7 @@ namespace basegfx } break; } - + // #100617# relative quadratic beziers are imported as cubic case 't' : { @@ -634,11 +634,11 @@ namespace basegfx const B2DPoint aQuadControlPoint( ((3.0 * aPrevControl.getX()) - aPrevPoint.getX()) / 2.0, ((3.0 * aPrevControl.getY()) - aPrevPoint.getY()) / 2.0); - + // calculate the cubic bezier coefficients from the quadratic ones. const double nX2Prime((aQuadControlPoint.getX() * 2.0 + nX) / 3.0); const double nY2Prime((aQuadControlPoint.getY() * 2.0 + nY) / 3.0); - + // append curved edge, use mirrored cubic control point directly aCurrPoly.appendBezierSegment(aPrevControl, B2DPoint(nX2Prime, nY2Prime), B2DPoint(nX, nY)); } @@ -700,7 +700,7 @@ namespace basegfx { // normalize according to SVG spec fRX=fabs(fRX); fRY=fabs(fRY); - + // from the SVG spec, appendix F.6.4 // |x1'| |cos phi sin phi| |(x1 - x2)/2| @@ -708,12 +708,12 @@ namespace basegfx const B2DPoint p1(nLastX, nLastY); const B2DPoint p2(nX, nY); B2DHomMatrix aTransform(basegfx::tools::createRotateB2DHomMatrix(-fPhi*M_PI/180)); - + const B2DPoint p1_prime( aTransform * B2DPoint(((p1-p2)/2.0)) ); // ______________________________________ rx y1' // |cx'| + / rx^2 ry^2 - rx^2 y1'^2 - ry^2 x1^2 ry - // |cy'| =-/ rx^2y1'^2 + ry^2 x1'^2 - ry x1' + // |cy'| =-/ rx^2y1'^2 + ry^2 x1'^2 - ry x1' // rx // chose + if f_A != f_S // chose - if f_A = f_S @@ -742,7 +742,7 @@ namespace basegfx aCurrPoly.append(B2DPoint(nX, nY)); continue; } - + fRY=sqrt(fRadicant2); fRX=fRatio*fRY; @@ -760,7 +760,7 @@ namespace basegfx -fFactor*fRY*p1_prime.getX()/fRX); } - // + u - v + // + u - v // angle(u,v) = arccos( ------------ ) (take the sign of (ux vy - uy vx)) // - ||u|| ||v|| @@ -768,14 +768,14 @@ namespace basegfx // theta1 = angle(( ), | | ) // 0 | (y1' - cy')/ry | const B2DPoint aRadii(fRX,fRY); - double fTheta1( + double fTheta1( B2DVector(1.0,0.0).angle( (p1_prime-aCenter_prime)/aRadii)); // |1| | (-x1' - cx')/rx | // theta2 = angle( | | , | | ) // |0| | (-y1' - cy')/ry | - double fTheta2( + double fTheta2( B2DVector(1.0,0.0).angle( (-p1_prime-aCenter_prime)/aRadii)); @@ -787,7 +787,7 @@ namespace basegfx // (since // createPolygonFromEllipseSegment() // normalizes to e.g. cw arc) - const bool bFlipSegment( (bLargeArcFlag!=0) == + const bool bFlipSegment( (bLargeArcFlag!=0) == (fmod(fTheta2+2*M_PI-fTheta1, 2*M_PI)<M_PI) ); if( bFlipSegment ) @@ -795,11 +795,11 @@ namespace basegfx // finally, create bezier polygon from this B2DPolygon aSegment( - tools::createPolygonFromUnitEllipseSegment( + tools::createPolygonFromUnitEllipseSegment( fTheta1, fTheta2 )); // transform ellipse by rotation & move to final center - aTransform = basegfx::tools::createScaleB2DHomMatrix(fRX, fRY); + aTransform = basegfx::tools::createScaleB2DHomMatrix(fRX, fRY); aTransform.translate(aCenter_prime.getX(), aCenter_prime.getY()); aTransform.rotate(fPhi*M_PI/180); @@ -807,7 +807,7 @@ namespace basegfx aTransform.translate(aOffset.getX(), aOffset.getY()); aSegment.transform(aTransform); - + // createPolygonFromEllipseSegment() // always creates arcs that are // positively oriented - flip polygon @@ -863,8 +863,8 @@ namespace basegfx { if(!lcl_importDoubleAndSpaces(nX, nPos, rSvgPointsAttribute, nLen)) return false; if(!lcl_importDoubleAndSpaces(nY, nPos, rSvgPointsAttribute, nLen)) return false; - - // add point + + // add point o_rPoly.append(B2DPoint(nX, nY)); // skip to next number, or finish @@ -876,7 +876,7 @@ namespace basegfx ::rtl::OUString exportToSvgD( const B2DPolyPolygon& rPolyPolygon, - bool bUseRelativeCoordinates, + bool bUseRelativeCoordinates, bool bDetectQuadraticBeziers) { const sal_uInt32 nCount(rPolyPolygon.count()); @@ -910,7 +910,7 @@ namespace basegfx const B2DPoint aEdgeEnd(aPolygon.getB2DPoint(nNextIndex)); // handle edge from (aEdgeStart, aEdgeEnd) using indices (nIndex, nNextIndex) - const bool bEdgeIsBezier(bPolyUsesControlPoints + const bool bEdgeIsBezier(bPolyUsesControlPoints && (aPolygon.isNextControlPointUsed(nIndex) || aPolygon.isPrevControlPointUsed(nNextIndex))); if(bEdgeIsBezier) @@ -921,18 +921,18 @@ namespace basegfx bool bIsQuadraticBezier(false); // check continuity at current edge's start point. For SVG, do NOT use an - // existing continuity since no 'S' or 's' statement should be written. At - // import, that 'previous' control vector is not available. SVG documentation + // existing continuity since no 'S' or 's' statement should be written. At + // import, that 'previous' control vector is not available. SVG documentation // says for interpretation: // - // "(If there is no previous command or if the previous command was - // not an C, c, S or s, assume the first control point is coincident + // "(If there is no previous command or if the previous command was + // not an C, c, S or s, assume the first control point is coincident // with the current point.)" // // That's what is done from our import, so avoid exporting it as first statement // is necessary. const bool bSymmetricAtEdgeStart( - 0 != nIndex + 0 != nIndex && CONTINUITY_C2 == aPolygon.getContinuityInPoint(nIndex)); if(bDetectQuadraticBeziers) @@ -942,7 +942,7 @@ namespace basegfx // the same place when they are prolonged // to the common quadratic control point // - // Left: P = (3P1 - P0) / 2 + // Left: P = (3P1 - P0) / 2 // Right: P = (3P2 - P3) / 2 aLeft = B2DPoint((3.0 * aControlEdgeStart - aEdgeStart) / 2.0); aRight= B2DPoint((3.0 * aControlEdgeEnd - aEdgeEnd) / 2.0); @@ -961,7 +961,7 @@ namespace basegfx aResult.append(aCommand); aLastSVGCommand = aCommand; } - + lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates); lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates); aLastSVGCommand = aCommand; @@ -976,7 +976,7 @@ namespace basegfx aResult.append(aCommand); aLastSVGCommand = aCommand; } - + lcl_putNumberCharWithSpace(aResult, aLeft.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates); lcl_putNumberCharWithSpace(aResult, aLeft.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates); lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates); @@ -997,7 +997,7 @@ namespace basegfx aResult.append(aCommand); aLastSVGCommand = aCommand; } - + lcl_putNumberCharWithSpace(aResult, aControlEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates); lcl_putNumberCharWithSpace(aResult, aControlEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates); lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates); @@ -1014,7 +1014,7 @@ namespace basegfx aResult.append(aCommand); aLastSVGCommand = aCommand; } - + lcl_putNumberCharWithSpace(aResult, aControlEdgeStart.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates); lcl_putNumberCharWithSpace(aResult, aControlEdgeStart.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates); lcl_putNumberCharWithSpace(aResult, aControlEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates); diff --git a/basegfx/source/polygon/b2dtrapezoid.cxx b/basegfx/source/polygon/b2dtrapezoid.cxx index f095a6658119..5a626e9bdde6 100644 --- a/basegfx/source/polygon/b2dtrapezoid.cxx +++ b/basegfx/source/polygon/b2dtrapezoid.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -47,20 +47,20 @@ namespace basegfx // currently, thus the YPositions will be equal. I did not create a special // class for this since holdingthe pointers is more effective and also can be // used as baseclass for the traversing edges - + class TrDeSimpleEdge { protected: // pointers to start and end point - const B2DPoint* mpStart; - const B2DPoint* mpEnd; + const B2DPoint* mpStart; + const B2DPoint* mpEnd; public: // constructor TrDeSimpleEdge( const B2DPoint* pStart, const B2DPoint* pEnd) - : mpStart(pStart), + : mpStart(pStart), mpEnd(pEnd) { } @@ -76,7 +76,7 @@ namespace basegfx typedef ::std::vector< TrDeSimpleEdge > TrDeSimpleEdges; ////////////////////////////////////////////////////////////////////////////// - // helper class for holding a traversing edge. It will always have some + // helper class for holding a traversing edge. It will always have some // distance in YPos. The slope (in a numerically useful form, see comments) is // hold and used in SortValue to allow sorting traversing edges by Y, X and slope // (in that order) @@ -85,7 +85,7 @@ namespace basegfx { private: // the slope in a numerical useful form for sorting - sal_uInt32 mnSortValue; + sal_uInt32 mnSortValue; public: // convenience data read access @@ -105,7 +105,7 @@ namespace basegfx // convert to sal_uInt32 value const_cast< TrDeEdgeEntry* >(this)->mnSortValue = sal_uInt32(fRadiant); - + return mnSortValue; } @@ -114,7 +114,7 @@ namespace basegfx const B2DPoint* pStart, const B2DPoint* pEnd, sal_uInt32 nSortValue = 0) - : TrDeSimpleEdge(pStart, pEnd), + : TrDeSimpleEdge(pStart, pEnd), mnSortValue(nSortValue) { // force traversal of deltaY downward @@ -135,7 +135,7 @@ namespace basegfx if(mpStart != pNewStart) { mpStart = pNewStart; - + // no horizontal edges allowed, all neeed to traverse vertivally OSL_ENSURE(mpEnd->getY() > mpStart->getY(), "Illegal TrDeEdgeEntry constructed (!)"); } @@ -149,7 +149,7 @@ namespace basegfx if(mpEnd != pNewEnd) { mpEnd = pNewEnd; - + // no horizontal edges allowed, all neeed to traverse vertivally OSL_ENSURE(mpEnd->getY() > mpStart->getY(), "Illegal TrDeEdgeEntry constructed (!)"); } @@ -163,10 +163,10 @@ namespace basegfx if(fTools::equal(getStart().getX(), rComp.getStart().getX(), fTools::getSmallValue())) { // when start points are equal, use the direction the edge is pointing - // to. That value is created on demand and derived from atan2 in the + // to. That value is created on demand and derived from atan2 in the // range ]0.0 .. pi[ (without extremas, we always have a deltaY in this - // class) and scaled to sal_uInt32 range for best precision. 0 means no angle, - // while SAL_MAX_UINT32 means pi. Thus, the higher the value, the more left + // class) and scaled to sal_uInt32 range for best precision. 0 means no angle, + // while SAL_MAX_UINT32 means pi. Thus, the higher the value, the more left // the edge traverses. return (getSortValue() > rComp.getSortValue()); } @@ -184,11 +184,11 @@ namespace basegfx // method for cut support B2DPoint getCutPointForGivenY(double fGivenY) { - // Calculate cut point locally (do not use interpolate) since it is numerically + // Calculate cut point locally (do not use interpolate) since it is numerically // necessary to guarantee the new, equal Y-coordinate const double fFactor((fGivenY - getStart().getY()) / getDeltaY()); const double fDeltaXNew(fFactor * getDeltaX()); - + return B2DPoint(getStart().getX() + fDeltaXNew, fGivenY); } }; @@ -212,10 +212,10 @@ namespace basegfx { private: // local data - sal_uInt32 mnInitialEdgeEntryCount; - TrDeEdgeEntries maTrDeEdgeEntries; - ::std::vector< B2DPoint > maPoints; - ::std::vector< B2DPoint* > maNewPoints; + sal_uInt32 mnInitialEdgeEntryCount; + TrDeEdgeEntries maTrDeEdgeEntries; + ::std::vector< B2DPoint > maPoints; + ::std::vector< B2DPoint* > maNewPoints; void addEdgeSorted( TrDeEdgeEntries::iterator aCurrent, @@ -293,12 +293,12 @@ namespace basegfx { return false; } - + if(aEdgeA.getStart().equal(aEdgeB.getEnd(), fTools::getSmallValue())) { return false; } - + if(aEdgeA.getEnd().equal(aEdgeB.getStart(), fTools::getSmallValue())) { return false; @@ -379,7 +379,7 @@ namespace basegfx { delete pNewPoint; } - + return bRetval; } @@ -435,7 +435,7 @@ namespace basegfx { // cut is in XRange of horizontal edge, potenitally needed cut B2DPoint* pNewPoint = new B2DPoint(aSplit); - + if(splitEdgeAtGivenPoint(aCompare, *pNewPoint, aCurrent)) { maNewPoints.push_back(pNewPoint); @@ -456,7 +456,7 @@ namespace basegfx public: TrapezoidSubdivider( const B2DPolyPolygon& rSourcePolyPolygon) - : mnInitialEdgeEntryCount(0), + : mnInitialEdgeEntryCount(0), maTrDeEdgeEntries(), maPoints(), maNewPoints() @@ -507,8 +507,8 @@ namespace basegfx } // Moved the edge construction to a 3rd run: doing it in the 2nd run is - // possible(and i used it), but requires a working vector::reserve() - // implementation, else the vector will be reallocated and the pointers + // possible(and i used it), but requires a working vector::reserve() + // implementation, else the vector will be reallocated and the pointers // in the edges may be wrong. Security first here. sal_uInt32 nStartIndex(0); @@ -584,7 +584,7 @@ namespace basegfx // // There always must be two edges with the same YStart value: When adding the polygons // in the constructor, there is always a topmost point from which two edges start; when - // the topmost is an edge, there is a start and end of this edge from which two edges + // the topmost is an edge, there is a start and end of this edge from which two edges // start. All cases have two edges with same StartY (QED). // // Based on this these edges get corrected when: @@ -594,7 +594,7 @@ namespace basegfx // - another edge starts inside the thought trapezoid // // All this cases again produce a valid state so that the first two edges have a common - // Ystart again. Some cases lead to a restart of the process, some allow consuming the + // Ystart again. Some cases lead to a restart of the process, some allow consuming the // edges and create the intended trapezoid. // // Be careful when doing chages here: It is essential to keep all possible paths @@ -607,8 +607,8 @@ namespace basegfx { // measuring shows that the relation between edges and created trapezoids is // mostly in the 1:1 range, thus reserve as much trapezoids as edges exist. Do - // not use maTrDeEdgeEntries.size() since that may be a non-constant time - // operation for Lists. Instead, use mnInitialEdgeEntryCount which will contain + // not use maTrDeEdgeEntries.size() since that may be a non-constant time + // operation for Lists. Instead, use mnInitialEdgeEntryCount which will contain // the roughly counted adds to the List ro_Result.reserve(ro_Result.size() + mnInitialEdgeEntryCount); } @@ -635,9 +635,9 @@ namespace basegfx if(!fTools::equal(aLeft.getStart().getY(), aRight.getStart().getY(), fTools::getSmallValue())) { - // Should not happen: We have a 2nd edge, but YStart is on another + // Should not happen: We have a 2nd edge, but YStart is on another // line; consume the single edge to not have an endless loop and start - // next. During development i constantly had breakpoints here, so i am + // 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 (!)"); maTrDeEdgeEntries.pop_front(); @@ -647,7 +647,7 @@ namespace basegfx // aLeft and aRight build a thought trapezoid now. They have a common // start line (same Y for start points). Potentially, one of the edges // is longer than the other. It is only needed to look at the shorter - // length which build the potential trapezoid. To do so, get the end points + // length which build the potential trapezoid. To do so, get the end points // locally and adapt the evtl. longer one. Use only aLeftEnd and aRightEnd // from here on, not the aLeft.getEnd() or aRight.getEnd() accesses. B2DPoint aLeftEnd(aLeft.getEnd()); @@ -657,7 +657,7 @@ namespace basegfx // needs to be prepared. Also remember which one actually is longer. const bool bEndOnSameLine(fTools::equal(aLeftEnd.getY(), aRightEnd.getY(), fTools::getSmallValue())); bool bLeftIsLonger(false); - + if(!bEndOnSameLine) { // check which edge is longer and correct accordingly @@ -699,7 +699,7 @@ namespace basegfx else { B2DPoint* pNewPoint = new B2DPoint(aRightEnd); - + if(splitEdgeAtGivenPoint(aRight, *pNewPoint, aCurrent)) { maNewPoints.push_back(pNewPoint); @@ -714,10 +714,10 @@ namespace basegfx // consume both edges and start next run maTrDeEdgeEntries.pop_front(); maTrDeEdgeEntries.pop_front(); - + continue; } - + // check if the edges self-intersect. This can only happen when // start and end point are different bool bRangesSet(false); @@ -743,7 +743,7 @@ namespace basegfx // now we need to check if there are intersections with other edges // or if other edges start inside the candidate trapezoid - if(aCurrent != maTrDeEdgeEntries.end() + if(aCurrent != maTrDeEdgeEntries.end() && fTools::less(aCurrent->getStart().getY(), aLeftEnd.getY())) { // get XRanges of edges @@ -752,11 +752,11 @@ namespace basegfx aLeftRange = B1DRange(aLeft.getStart().getX(), aLeftEnd.getX()); aRightRange = B1DRange(aRight.getStart().getX(), aRightEnd.getX()); } - + // build full XRange for fast check B1DRange aAllRange(aLeftRange); aAllRange.expand(aRightRange); - + // prepare loop iterator; aCurrent needs to stay unchanged for // eventual sorted insertions of new EdgeNodes. Also prepare stop flag TrDeEdgeEntries::iterator aLoop(aCurrent); @@ -777,7 +777,7 @@ namespace basegfx // get compare XRange const B1DRange aCompareRange(aCompare.getStart().getX(), aCompare.getEnd().getX()); - + // use fast range test first if(aAllRange.overlaps(aCompareRange)) { @@ -790,12 +790,12 @@ namespace basegfx // check for start point of aCompare being inside thought // trapezoid - if(aCompare.getStart().getX() >= aSplitLeft.getX() && + if(aCompare.getStart().getX() >= aSplitLeft.getX() && aCompare.getStart().getX() <= aSplitRight.getX()) { // is inside, correct and restart loop B2DPoint* pNewLeft = new B2DPoint(aSplitLeft); - + if(splitEdgeAtGivenPoint(aLeft, *pNewLeft, aCurrent)) { maNewPoints.push_back(pNewLeft); @@ -805,9 +805,9 @@ namespace basegfx { delete pNewLeft; } - + B2DPoint* pNewRight = new B2DPoint(aSplitRight); - + if(splitEdgeAtGivenPoint(aRight, *pNewRight, aCurrent)) { maNewPoints.push_back(pNewRight); @@ -825,7 +825,7 @@ namespace basegfx // test for concrete cut of compare edge with left edge bDone = testAndCorrectEdgeIntersection(aLeft, aCompare, aCurrent); } - + if(!bDone && aRightRange.overlaps(aCompareRange)) { // test for concrete cut of compare edge with Right edge @@ -845,14 +845,14 @@ namespace basegfx } // when we get here, the intended trapezoid can be used. It needs to - // be corrected, eventually (if prepared); but this is no reason not to + // be corrected, eventually (if prepared); but this is no reason not to // use it in the same loop iteration if(!bEndOnSameLine) { if(bLeftIsLonger) { B2DPoint* pNewPoint = new B2DPoint(aLeftEnd); - + if(splitEdgeAtGivenPoint(aLeft, *pNewPoint, aCurrent)) { maNewPoints.push_back(pNewPoint); @@ -865,7 +865,7 @@ namespace basegfx else { B2DPoint* pNewPoint = new B2DPoint(aRightEnd); - + if(splitEdgeAtGivenPoint(aRight, *pNewPoint, aCurrent)) { maNewPoints.push_back(pNewPoint); @@ -888,7 +888,7 @@ namespace basegfx aLeftEnd.getX(), aRightEnd.getX(), aLeftEnd.getY())); - + maTrDeEdgeEntries.pop_front(); maTrDeEdgeEntries.pop_front(); } @@ -908,7 +908,7 @@ namespace basegfx const double& rfBottomXLeft, const double& rfBottomXRight, const double& rfBottomY) - : mfTopXLeft(rfTopXLeft), + : mfTopXLeft(rfTopXLeft), mfTopXRight(rfTopXRight), mfTopY(rfTopY), mfBottomXLeft(rfBottomXLeft), @@ -965,9 +965,9 @@ namespace basegfx } void createLineTrapezoidFromEdge( - B2DTrapezoidVector& ro_Result, - const B2DPoint& rPointA, - const B2DPoint& rPointB, + B2DTrapezoidVector& ro_Result, + const B2DPoint& rPointA, + const B2DPoint& rPointB, double fLineWidth) { if(fTools::lessOrEqual(fLineWidth, 0.0)) @@ -1037,14 +1037,14 @@ namespace basegfx aTrDeEdgeEntries.push_back(basegfx::trapezoidhelper::TrDeEdgeEntry(&aEndLow, &aStartLow, 0)); aTrDeEdgeEntries.sort(); - // here we know we have exactly four edges, and they do not cut, touch or + // here we know we have exactly four edges, and they do not cut, touch or // intersect. This makes processing much easier. Get the first two as start // edges for the thought trapezoid basegfx::trapezoidhelper::TrDeEdgeEntries::iterator aCurrent(aTrDeEdgeEntries.begin()); basegfx::trapezoidhelper::TrDeEdgeEntries::reference aLeft(*aCurrent++); basegfx::trapezoidhelper::TrDeEdgeEntries::reference aRight(*aCurrent++); const bool bEndOnSameLine(fTools::equal(aLeft.getEnd().getY(), aRight.getEnd().getY(), fTools::getSmallValue())); - + if(bEndOnSameLine) { // create two triangle trapezoids @@ -1071,7 +1071,7 @@ namespace basegfx } else { - // create three trapezoids. Check which edge is longer and + // create three trapezoids. Check which edge is longer and // correct accordingly const bool bLeftIsLonger(fTools::more(aLeft.getEnd().getY(), aRight.getEnd().getY())); @@ -1081,7 +1081,7 @@ namespace basegfx basegfx::trapezoidhelper::TrDeEdgeEntries::reference aLeft2(*aCurrent++); const B2DPoint aSplitLeft(aLeft.getCutPointForGivenY(aRight.getEnd().getY())); const B2DPoint aSplitRight(aRight2.getCutPointForGivenY(aLeft.getEnd().getY())); - + ro_Result.push_back( B2DTrapezoid( aLeft.getStart().getX(), @@ -1090,7 +1090,7 @@ namespace basegfx aSplitLeft.getX(), aRight.getEnd().getX(), aRight.getEnd().getY())); - + ro_Result.push_back( B2DTrapezoid( aSplitLeft.getX(), @@ -1099,7 +1099,7 @@ namespace basegfx aLeft2.getStart().getX(), aSplitRight.getX(), aLeft2.getStart().getY())); - + ro_Result.push_back( B2DTrapezoid( aLeft2.getStart().getX(), @@ -1148,7 +1148,7 @@ namespace basegfx } void createLineTrapezoidFromB2DPolygon( - B2DTrapezoidVector& ro_Result, + B2DTrapezoidVector& ro_Result, const B2DPolygon& rPolygon, double fLineWidth) { @@ -1167,7 +1167,7 @@ namespace basegfx } const sal_uInt32 nPointCount(aSource.count()); - + if(!nPointCount) { return; @@ -1182,14 +1182,14 @@ namespace basegfx { const sal_uInt32 nNextIndex((a + 1) % nPointCount); const B2DPoint aNext(aSource.getB2DPoint(nNextIndex)); - + createLineTrapezoidFromEdge(ro_Result, aCurrent, aNext, fLineWidth); aCurrent = aNext; } } void createLineTrapezoidFromB2DPolyPolygon( - B2DTrapezoidVector& ro_Result, + B2DTrapezoidVector& ro_Result, const B2DPolyPolygon& rPolyPolygon, double fLineWidth) { @@ -1207,7 +1207,7 @@ namespace basegfx } const sal_uInt32 nCount(aSource.count()); - + if(!nCount) { return; @@ -1216,7 +1216,7 @@ namespace basegfx for(sal_uInt32 a(0); a < nCount; a++) { createLineTrapezoidFromB2DPolygon( - ro_Result, + ro_Result, aSource.getB2DPolygon(a), fLineWidth); } diff --git a/basegfx/source/polygon/b3dpolygon.cxx b/basegfx/source/polygon/b3dpolygon.cxx index 019ed0fff970..684717bbbd72 100644 --- a/basegfx/source/polygon/b3dpolygon.cxx +++ b/basegfx/source/polygon/b3dpolygon.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -43,38 +43,38 @@ class CoordinateData3D { - basegfx::B3DPoint maPoint; + basegfx::B3DPoint maPoint; public: - CoordinateData3D() - : maPoint() + CoordinateData3D() + : maPoint() { } explicit CoordinateData3D(const basegfx::B3DPoint& rData) - : maPoint(rData) + : maPoint(rData) { } - const basegfx::B3DPoint& getCoordinate() const - { - return maPoint; + const basegfx::B3DPoint& getCoordinate() const + { + return maPoint; } - void setCoordinate(const basegfx::B3DPoint& rValue) - { - if(rValue != maPoint) - maPoint = rValue; + void setCoordinate(const basegfx::B3DPoint& rValue) + { + if(rValue != maPoint) + maPoint = rValue; } - bool operator==(const CoordinateData3D& rData) const - { - return (maPoint == rData.getCoordinate()); + bool operator==(const CoordinateData3D& rData) const + { + return (maPoint == rData.getCoordinate()); } - void transform(const basegfx::B3DHomMatrix& rMatrix) - { - maPoint *= rMatrix; + void transform(const basegfx::B3DHomMatrix& rMatrix) + { + maPoint *= rMatrix; } }; @@ -84,21 +84,21 @@ class CoordinateDataArray3D { typedef ::std::vector< CoordinateData3D > CoordinateData3DVector; - CoordinateData3DVector maVector; + CoordinateData3DVector maVector; public: explicit CoordinateDataArray3D(sal_uInt32 nCount) - : maVector(nCount) + : maVector(nCount) { } explicit CoordinateDataArray3D(const CoordinateDataArray3D& rOriginal) - : maVector(rOriginal.maVector) + : maVector(rOriginal.maVector) { } CoordinateDataArray3D(const CoordinateDataArray3D& rOriginal, sal_uInt32 nIndex, sal_uInt32 nCount) - : maVector(rOriginal.maVector.begin() + nIndex, rOriginal.maVector.begin() + (nIndex + nCount)) + : maVector(rOriginal.maVector.begin() + nIndex, rOriginal.maVector.begin() + (nIndex + nCount)) { } @@ -124,7 +124,7 @@ public: for(a = 1; a < nPointCount; a++) { const basegfx::B3DPoint& rCandidate = maVector[a].getCoordinate(); - + if((rCandidate.getX() < pSmallest->getX()) || (rCandidate.getX() == pSmallest->getX() && rCandidate.getY() < pSmallest->getY()) || (rCandidate.getX() == pSmallest->getX() && rCandidate.getY() == pSmallest->getY() && rCandidate.getZ() < pSmallest->getZ())) @@ -238,7 +238,7 @@ public: const sal_uInt32 nHalfSize(maVector.size() >> 1L); CoordinateData3DVector::iterator aStart(maVector.begin()); CoordinateData3DVector::iterator aEnd(maVector.end() - 1L); - + for(sal_uInt32 a(0); a < nHalfSize; a++) { ::std::swap(*aStart, *aEnd); @@ -266,24 +266,24 @@ class BColorArray { typedef ::std::vector< ::basegfx::BColor > BColorDataVector; - BColorDataVector maVector; - sal_uInt32 mnUsedEntries; + BColorDataVector maVector; + sal_uInt32 mnUsedEntries; public: explicit BColorArray(sal_uInt32 nCount) - : maVector(nCount), + : maVector(nCount), mnUsedEntries(0L) { } explicit BColorArray(const BColorArray& rOriginal) - : maVector(rOriginal.maVector), + : maVector(rOriginal.maVector), mnUsedEntries(rOriginal.mnUsedEntries) { } BColorArray(const BColorArray& rOriginal, sal_uInt32 nIndex, sal_uInt32 nCount) - : maVector(), + : maVector(), mnUsedEntries(0L) { BColorDataVector::const_iterator aStart(rOriginal.maVector.begin()); @@ -315,8 +315,8 @@ public: return (maVector == rCandidate.maVector); } - bool isUsed() const - { + bool isUsed() const + { return (0L != mnUsedEntries); } @@ -413,7 +413,7 @@ public: const sal_uInt32 nHalfSize(maVector.size() >> 1L); BColorDataVector::iterator aStart(maVector.begin()); BColorDataVector::iterator aEnd(maVector.end() - 1L); - + for(sal_uInt32 a(0); a < nHalfSize; a++) { ::std::swap(*aStart, *aEnd); @@ -430,24 +430,24 @@ class NormalsArray3D { typedef ::std::vector< ::basegfx::B3DVector > NormalsData3DVector; - NormalsData3DVector maVector; - sal_uInt32 mnUsedEntries; + NormalsData3DVector maVector; + sal_uInt32 mnUsedEntries; public: explicit NormalsArray3D(sal_uInt32 nCount) - : maVector(nCount), + : maVector(nCount), mnUsedEntries(0L) { } explicit NormalsArray3D(const NormalsArray3D& rOriginal) - : maVector(rOriginal.maVector), + : maVector(rOriginal.maVector), mnUsedEntries(rOriginal.mnUsedEntries) { } NormalsArray3D(const NormalsArray3D& rOriginal, sal_uInt32 nIndex, sal_uInt32 nCount) - : maVector(), + : maVector(), mnUsedEntries(0L) { NormalsData3DVector::const_iterator aStart(rOriginal.maVector.begin()); @@ -479,8 +479,8 @@ public: return (maVector == rCandidate.maVector); } - bool isUsed() const - { + bool isUsed() const + { return (0L != mnUsedEntries); } @@ -577,7 +577,7 @@ public: const sal_uInt32 nHalfSize(maVector.size() >> 1L); NormalsData3DVector::iterator aStart(maVector.begin()); NormalsData3DVector::iterator aEnd(maVector.end() - 1L); - + for(sal_uInt32 a(0); a < nHalfSize; a++) { ::std::swap(*aStart, *aEnd); @@ -605,24 +605,24 @@ class TextureCoordinate2D { typedef ::std::vector< ::basegfx::B2DPoint > TextureData2DVector; - TextureData2DVector maVector; - sal_uInt32 mnUsedEntries; + TextureData2DVector maVector; + sal_uInt32 mnUsedEntries; public: explicit TextureCoordinate2D(sal_uInt32 nCount) - : maVector(nCount), + : maVector(nCount), mnUsedEntries(0L) { } explicit TextureCoordinate2D(const TextureCoordinate2D& rOriginal) - : maVector(rOriginal.maVector), + : maVector(rOriginal.maVector), mnUsedEntries(rOriginal.mnUsedEntries) { } TextureCoordinate2D(const TextureCoordinate2D& rOriginal, sal_uInt32 nIndex, sal_uInt32 nCount) - : maVector(), + : maVector(), mnUsedEntries(0L) { TextureData2DVector::const_iterator aStart(rOriginal.maVector.begin()); @@ -654,8 +654,8 @@ public: return (maVector == rCandidate.maVector); } - bool isUsed() const - { + bool isUsed() const + { return (0L != mnUsedEntries); } @@ -752,7 +752,7 @@ public: const sal_uInt32 nHalfSize(maVector.size() >> 1L); TextureData2DVector::iterator aStart(maVector.begin()); TextureData2DVector::iterator aEnd(maVector.end() - 1L); - + for(sal_uInt32 a(0); a < nHalfSize; a++) { ::std::swap(*aStart, *aEnd); @@ -780,29 +780,29 @@ class ImplB3DPolygon { // The point vector. This vector exists always and defines the // count of members. - CoordinateDataArray3D maPoints; + CoordinateDataArray3D maPoints; // The BColor vector. This vectors are created on demand // and may be zero. - BColorArray* mpBColors; + BColorArray* mpBColors; // The Normals vector. This vectors are created on demand // and may be zero. - NormalsArray3D* mpNormals; + NormalsArray3D* mpNormals; // The TextureCoordinates vector. This vectors are created on demand // and may be zero. - TextureCoordinate2D* mpTextureCoordiantes; + TextureCoordinate2D* mpTextureCoordiantes; // The calculated plane normal. mbPlaneNormalValid says if it's valid. - ::basegfx::B3DVector maPlaneNormal; + ::basegfx::B3DVector maPlaneNormal; // bitfield // flag which decides if this polygon is opened or closed - unsigned mbIsClosed : 1; + unsigned mbIsClosed : 1; // flag which says if maPlaneNormal is up-to-date - unsigned mbPlaneNormalValid : 1; + unsigned mbPlaneNormalValid : 1; protected: void invalidatePlaneNormal() @@ -817,7 +817,7 @@ public: // This constructor is only used from the static identity polygon, thus // the RefCount is set to 1 to never 'delete' this static incarnation. ImplB3DPolygon() - : maPoints(0L), + : maPoints(0L), mpBColors(0L), mpNormals(0L), mpTextureCoordiantes(0L), @@ -829,7 +829,7 @@ public: } ImplB3DPolygon(const ImplB3DPolygon& rToBeCopied) - : maPoints(rToBeCopied.maPoints), + : maPoints(rToBeCopied.maPoints), mpBColors(0L), mpNormals(0L), mpTextureCoordiantes(0L), @@ -855,7 +855,7 @@ public: } ImplB3DPolygon(const ImplB3DPolygon& rToBeCopied, sal_uInt32 nIndex, sal_uInt32 nCount) - : maPoints(rToBeCopied.maPoints, nIndex, nCount), + : maPoints(rToBeCopied.maPoints, nIndex, nCount), mpBColors(0L), mpNormals(0L), mpTextureCoordiantes(0L), @@ -1536,7 +1536,7 @@ public: namespace basegfx { - namespace { struct DefaultPolygon : public rtl::Static< B3DPolygon::ImplType, + namespace { struct DefaultPolygon : public rtl::Static< B3DPolygon::ImplType, DefaultPolygon > {}; } B3DPolygon::B3DPolygon() : @@ -1593,7 +1593,7 @@ namespace basegfx basegfx::B3DPoint B3DPolygon::getB3DPoint(sal_uInt32 nIndex) const { OSL_ENSURE(nIndex < mpPolygon->count(), "B3DPolygon access outside range (!)"); - + return mpPolygon->getPoint(nIndex); } @@ -1608,7 +1608,7 @@ namespace basegfx BColor B3DPolygon::getBColor(sal_uInt32 nIndex) const { OSL_ENSURE(nIndex < mpPolygon->count(), "B3DPolygon access outside range (!)"); - + return mpPolygon->getBColor(nIndex); } @@ -1639,7 +1639,7 @@ namespace basegfx B3DVector B3DPolygon::getNormal(sal_uInt32 nIndex) const { OSL_ENSURE(nIndex < mpPolygon->count(), "B3DPolygon access outside range (!)"); - + return mpPolygon->getNormal(nIndex); } @@ -1671,7 +1671,7 @@ namespace basegfx B2DPoint B3DPolygon::getTextureCoordinate(sal_uInt32 nIndex) const { OSL_ENSURE(nIndex < mpPolygon->count(), "B3DPolygon access outside range (!)"); - + return mpPolygon->getTextureCoordinate(nIndex); } @@ -1703,7 +1703,7 @@ namespace basegfx void B3DPolygon::insert(sal_uInt32 nIndex, const ::basegfx::B3DPoint& rPoint, sal_uInt32 nCount) { OSL_ENSURE(nIndex <= mpPolygon->count(), "B3DPolygon Insert outside range (!)"); - + if(nCount) mpPolygon->insert(nIndex, rPoint, nCount); } @@ -1763,11 +1763,11 @@ namespace basegfx void B3DPolygon::remove(sal_uInt32 nIndex, sal_uInt32 nCount) { OSL_ENSURE(nIndex + nCount <= mpPolygon->count(), "B3DPolygon Remove outside range (!)"); - + if(nCount) mpPolygon->remove(nIndex, nCount); } - + void B3DPolygon::clear() { mpPolygon = DefaultPolygon::get(); diff --git a/basegfx/source/polygon/b3dpolygonclipper.cxx b/basegfx/source/polygon/b3dpolygonclipper.cxx index c0b36ccf5205..d8099b3e7b67 100644 --- a/basegfx/source/polygon/b3dpolygonclipper.cxx +++ b/basegfx/source/polygon/b3dpolygonclipper.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -246,7 +246,7 @@ namespace basegfx { impAppendCopy(aNewPolygon, rCandidate, nNextIndex); } - + // pepare next step aCurrent = aNext; } @@ -280,7 +280,7 @@ namespace basegfx { impAppendCopy(aNewPolygon, rCandidate, nNextIndex); } - + // pepare next step aCurrent = aNext; } @@ -338,7 +338,7 @@ namespace basegfx { const B3DRange aCandidateRange3D(getRange(rCandidate)); const B2DRange aCandidateRange( - aCandidateRange3D.getMinX(), aCandidateRange3D.getMinY(), + aCandidateRange3D.getMinX(), aCandidateRange3D.getMinY(), aCandidateRange3D.getMaxX(), aCandidateRange3D.getMaxY()); if(rRange.isInside(aCandidateRange)) diff --git a/basegfx/source/polygon/b3dpolygontools.cxx b/basegfx/source/polygon/b3dpolygontools.cxx index ce76c3503dbf..b56c837e2a09 100644 --- a/basegfx/source/polygon/b3dpolygontools.cxx +++ b/basegfx/source/polygon/b3dpolygontools.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -251,7 +251,7 @@ namespace basegfx { double fRetval(0.0); const sal_uInt32 nPointCount(rCandidate.count()); - + if(nPointCount > 1L) { const sal_uInt32 nLoopCount(rCandidate.isClosed() ? nPointCount : nPointCount - 1L); @@ -449,7 +449,7 @@ namespace basegfx aSnippet.clear(); } - + // prepare next DotDashArray step and flip line/gap flag fLastDotDashMovingLength = fDotDashMovingLength; fDotDashMovingLength += rDotDashArray[(++nDotDashIndex) % nDotDashCount]; @@ -459,7 +459,7 @@ namespace basegfx // append snippet [fLastDotDashMovingLength, fEdgeLength] const bool bHandleLine(bIsLine && pLineTarget); const bool bHandleGap(!bIsLine && pGapTarget); - + if(bHandleLine || bHandleGap) { if(!aSnippet.count()) @@ -469,10 +469,10 @@ namespace basegfx aSnippet.append(aNextPoint); } - + // prepare move to next edge fDotDashMovingLength -= fEdgeLength; - + // prepare next edge step (end point gets new start point) aCurrentPoint = aNextPoint; } @@ -674,7 +674,7 @@ namespace basegfx if(bChangeY) { aTexCoor.setY(fOne); - + if(bChangeX) { bPolarPoints = true; @@ -684,7 +684,7 @@ namespace basegfx else { double fX(fOne - ((atan2(aVector.getZ(), aVector.getX()) + F_PI) / F_2PI)); - + // correct cartesinan point coordiante dependent from center value if(fX > fXCenter + 0.5) { @@ -828,7 +828,7 @@ namespace basegfx bool isInEpsilonRange(const B3DPolygon& rCandidate, const B3DPoint& rTestPosition, double fDistance) { const sal_uInt32 nPointCount(rCandidate.count()); - + if(nPointCount) { const sal_uInt32 nEdgeCount(rCandidate.isClosed() ? nPointCount : nPointCount - 1L); @@ -895,7 +895,7 @@ namespace basegfx { const B3DPoint aPreviousPoint(aCurrentPoint); aCurrentPoint = rCandidate.getB3DPoint(a); - + // cross-over in Z? const bool bCompZA(fTools::more(aPreviousPoint.getZ(), rPoint.getZ())); const bool bCompZB(fTools::more(aCurrentPoint.getZ(), rPoint.getZ())); @@ -905,7 +905,7 @@ namespace basegfx // cross-over in Y? const bool bCompYA(fTools::more(aPreviousPoint.getY(), rPoint.getY())); const bool bCompYB(fTools::more(aCurrentPoint.getY(), rPoint.getY())); - + if(bCompYA == bCompYB) { if(bCompYA) @@ -936,7 +936,7 @@ namespace basegfx { const B3DPoint aPreviousPoint(aCurrentPoint); aCurrentPoint = rCandidate.getB3DPoint(a); - + // cross-over in Z? const bool bCompZA(fTools::more(aPreviousPoint.getZ(), rPoint.getZ())); const bool bCompZB(fTools::more(aCurrentPoint.getZ(), rPoint.getZ())); @@ -946,7 +946,7 @@ namespace basegfx // cross-over in X? const bool bCompXA(fTools::more(aPreviousPoint.getX(), rPoint.getX())); const bool bCompXB(fTools::more(aCurrentPoint.getX(), rPoint.getX())); - + if(bCompXA == bCompXB) { if(bCompXA) @@ -977,7 +977,7 @@ namespace basegfx { const B3DPoint aPreviousPoint(aCurrentPoint); aCurrentPoint = rCandidate.getB3DPoint(a); - + // cross-over in Y? const bool bCompYA(fTools::more(aPreviousPoint.getY(), rPoint.getY())); const bool bCompYB(fTools::more(aCurrentPoint.getY(), rPoint.getY())); @@ -987,7 +987,7 @@ namespace basegfx // cross-over in X? const bool bCompXA(fTools::more(aPreviousPoint.getX(), rPoint.getX())); const bool bCompXB(fTools::more(aCurrentPoint.getX(), rPoint.getX())); - + if(bCompXA == bCompXB) { if(bCompXA) @@ -1056,7 +1056,7 @@ namespace basegfx const double fZero(0.0); const double fOne(1.0); double fParamTestOnCurr(0.0); - + if(aEdgeVector.getX() > aEdgeVector.getY()) { if(aEdgeVector.getX() > aEdgeVector.getZ()) @@ -1134,7 +1134,7 @@ namespace basegfx { const B3DVector aCompareEdge(rPlanePoint - rEdgeStart); const double fScalarCompare(rPlaneNormal.scalar(aCompareEdge)); - + fCut = fScalarCompare / fScalarEdge; return true; } @@ -1158,7 +1158,7 @@ namespace basegfx return getCutBetweenLineAndPlane(aPlaneNormal, aPointOnPlane, rEdgeStart, rEdgeEnd, fCut); } } - + return false; } @@ -1202,7 +1202,7 @@ namespace basegfx if(nPointCount > 1) { - // Start by copying the source polygon to get a writeable copy. The closed state is + // Start by copying the source polygon to get a writeable copy. The closed state is // copied by aRetval's initialisation, too, so no need to copy it in this method B3DPolygon aRetval(rCandidate); diff --git a/basegfx/source/polygon/b3dpolypolygon.cxx b/basegfx/source/polygon/b3dpolypolygon.cxx index 3a736573c8e7..e86ddd1ef4e9 100644 --- a/basegfx/source/polygon/b3dpolypolygon.cxx +++ b/basegfx/source/polygon/b3dpolypolygon.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,9 +42,9 @@ class ImplB3DPolyPolygon { - typedef ::std::vector< ::basegfx::B3DPolygon > PolygonVector; + typedef ::std::vector< ::basegfx::B3DPolygon > PolygonVector; - PolygonVector maPolygons; + PolygonVector maPolygons; public: ImplB3DPolyPolygon() : maPolygons() @@ -209,7 +209,7 @@ public: namespace basegfx { - namespace { struct DefaultPolyPolygon : public rtl::Static<B3DPolyPolygon::ImplType, + namespace { struct DefaultPolyPolygon : public rtl::Static<B3DPolyPolygon::ImplType, DefaultPolyPolygon> {}; } B3DPolyPolygon::B3DPolyPolygon() : @@ -264,7 +264,7 @@ namespace basegfx B3DPolygon B3DPolyPolygon::getB3DPolygon(sal_uInt32 nIndex) const { OSL_ENSURE(nIndex < mpPolyPolygon->count(), "B3DPolyPolygon access outside range (!)"); - + return mpPolyPolygon->getB3DPolygon(nIndex); } @@ -348,7 +348,7 @@ namespace basegfx void B3DPolyPolygon::insert(sal_uInt32 nIndex, const B3DPolygon& rPolygon, sal_uInt32 nCount) { OSL_ENSURE(nIndex <= mpPolyPolygon->count(), "B3DPolyPolygon Insert outside range (!)"); - + if(nCount) mpPolyPolygon->insert(nIndex, rPolygon, nCount); } @@ -362,7 +362,7 @@ namespace basegfx void B3DPolyPolygon::insert(sal_uInt32 nIndex, const B3DPolyPolygon& rPolyPolygon) { OSL_ENSURE(nIndex <= mpPolyPolygon->count(), "B3DPolyPolygon Insert outside range (!)"); - + if(rPolyPolygon.count()) mpPolyPolygon->insert(nIndex, rPolyPolygon); } @@ -376,11 +376,11 @@ namespace basegfx void B3DPolyPolygon::remove(sal_uInt32 nIndex, sal_uInt32 nCount) { OSL_ENSURE(nIndex + nCount <= mpPolyPolygon->count(), "B3DPolyPolygon Remove outside range (!)"); - + if(nCount) mpPolyPolygon->remove(nIndex, nCount); } - + void B3DPolyPolygon::clear() { mpPolyPolygon = DefaultPolyPolygon::get(); diff --git a/basegfx/source/polygon/b3dpolypolygontools.cxx b/basegfx/source/polygon/b3dpolypolygontools.cxx index 1cff2eaf1765..f64388dae9ec 100644 --- a/basegfx/source/polygon/b3dpolypolygontools.cxx +++ b/basegfx/source/polygon/b3dpolypolygontools.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -70,16 +70,16 @@ namespace basegfx if(rCandidate.count() && fFullDashDotLen > 0.0) { B3DPolyPolygon aLineTarget, aGapTarget; - + for(sal_uInt32 a(0L); a < rCandidate.count(); a++) { const B3DPolygon aCandidate(rCandidate.getB3DPolygon(a)); - + applyLineDashing( - aCandidate, - rDotDashArray, - pLineTarget ? &aLineTarget : 0, - pGapTarget ? &aGapTarget : 0, + aCandidate, + rDotDashArray, + pLineTarget ? &aLineTarget : 0, + pGapTarget ? &aGapTarget : 0, fFullDashDotLen); if(pLineTarget) @@ -342,8 +342,8 @@ namespace basegfx return aRetval; } - - B3DPolyPolygon createSpherePolyPolygonFromB3DRange( const B3DRange& rRange, + + B3DPolyPolygon createSpherePolyPolygonFromB3DRange( const B3DRange& rRange, sal_uInt32 nHorSeg, sal_uInt32 nVerSeg, double fVerStart, double fVerStop, double fHorStart, double fHorStop) @@ -424,8 +424,8 @@ namespace basegfx return aRetval; } - - B3DPolyPolygon createSphereFillPolyPolygonFromB3DRange( const B3DRange& rRange, + + B3DPolyPolygon createSphereFillPolyPolygonFromB3DRange( const B3DRange& rRange, sal_uInt32 nHorSeg, sal_uInt32 nVerSeg, bool bNormals, double fVerStart, double fVerStop, diff --git a/basegfx/source/range/b1drange.cxx b/basegfx/source/range/b1drange.cxx index 5de4a342aab8..ff56ef032a8e 100644 --- a/basegfx/source/range/b1drange.cxx +++ b/basegfx/source/range/b1drange.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -34,7 +34,7 @@ namespace basegfx { - B1DRange::B1DRange( const B1IRange& rRange ) : + B1DRange::B1DRange( const B1IRange& rRange ) : maRange() { if( !rRange.isEmpty() ) @@ -46,7 +46,7 @@ namespace basegfx B1IRange fround(const B1DRange& rRange) { - return rRange.isEmpty() ? + return rRange.isEmpty() ? B1IRange() : B1IRange( fround( rRange.getMinimum()), fround( rRange.getMaximum()) ); diff --git a/basegfx/source/range/b2dpolyrange.cxx b/basegfx/source/range/b2dpolyrange.cxx index f0088bfc5793..d585270c84e7 100644 --- a/basegfx/source/range/b2dpolyrange.cxx +++ b/basegfx/source/range/b2dpolyrange.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -43,10 +43,10 @@ #include <algorithm> #include <vector> -static basegfx::B2VectorOrientation flipOrientation( +static basegfx::B2VectorOrientation flipOrientation( basegfx::B2VectorOrientation eOrient) { - return eOrient == basegfx::ORIENTATION_POSITIVE ? + return eOrient == basegfx::ORIENTATION_POSITIVE ? basegfx::ORIENTATION_NEGATIVE : basegfx::ORIENTATION_POSITIVE; } @@ -152,11 +152,11 @@ namespace basegfx void appendPolyRange(const ImplB2DPolyRange& rPolyRange) { - maRanges.insert(maRanges.end(), - rPolyRange.maRanges.begin(), + maRanges.insert(maRanges.end(), + rPolyRange.maRanges.begin(), rPolyRange.maRanges.end()); - maOrient.insert(maOrient.end(), - rPolyRange.maOrient.begin(), + maOrient.insert(maOrient.end(), + rPolyRange.maOrient.begin(), rPolyRange.maOrient.end()); updateBounds(); } @@ -201,7 +201,7 @@ namespace basegfx // cannot use boost::bind here, since isInside is overloaded. // It is currently not possible to resolve the overload // by considering one of the other template arguments. - std::vector<B2DRange>::const_iterator aCurr( maRanges.begin() ); + std::vector<B2DRange>::const_iterator aCurr( maRanges.begin() ); const std::vector<B2DRange>::const_iterator aEnd ( maRanges.end() ); while( aCurr != aEnd ) if( aCurr->isInside( rValue ) ) @@ -216,7 +216,7 @@ namespace basegfx return false; const std::vector<B2DRange>::const_iterator aEnd( maRanges.end() ); - return std::find_if( maRanges.begin(), + return std::find_if( maRanges.begin(), aEnd, boost::bind<bool>( boost::mem_fn( &B2DRange::overlaps ), _1, @@ -261,8 +261,8 @@ namespace basegfx } private: - B2DRange maBounds; - std::vector<B2DRange> maRanges; + B2DRange maBounds; + std::vector<B2DRange> maRanges; std::vector<B2VectorOrientation> maOrient; }; @@ -276,7 +276,7 @@ namespace basegfx B2DPolyRange::B2DPolyRange( const ElementType& rElem ) : mpImpl( ImplB2DPolyRange( rElem ) ) {} - + B2DPolyRange::B2DPolyRange( const B2DRange& rRange, B2VectorOrientation eOrient ) : mpImpl( ImplB2DPolyRange( rRange, eOrient ) ) {} @@ -383,7 +383,7 @@ namespace basegfx { return mpImpl->isInside(rTuple); } - + bool B2DPolyRange::isInside( const B2DRange& rRange ) const { return mpImpl->isInside(rRange); diff --git a/basegfx/source/range/b2drange.cxx b/basegfx/source/range/b2drange.cxx index d79adafaea27..6121fa2f60a5 100644 --- a/basegfx/source/range/b2drange.cxx +++ b/basegfx/source/range/b2drange.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -36,7 +36,7 @@ namespace basegfx { - B2DRange::B2DRange( const B2IRange& rRange ) : + B2DRange::B2DRange( const B2IRange& rRange ) : maRangeX(), maRangeY() { @@ -67,7 +67,7 @@ namespace basegfx { return rRange.isEmpty() ? B2IRange() : - B2IRange(fround(rRange.getMinimum()), + B2IRange(fround(rRange.getMinimum()), fround(rRange.getMaximum())); } } // end of namespace basegfx diff --git a/basegfx/source/range/b2drangeclipper.cxx b/basegfx/source/range/b2drangeclipper.cxx index 6546b6a13c09..235c09f0b129 100644 --- a/basegfx/source/range/b2drangeclipper.cxx +++ b/basegfx/source/range/b2drangeclipper.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -54,8 +54,8 @@ namespace basegfx { namespace { - // Generating a poly-polygon from a bunch of rectangles - // + // Generating a poly-polygon from a bunch of rectangles + // // Helper functionality for sweep-line algorithm // ==================================================== @@ -93,13 +93,13 @@ namespace basegfx PROCEED_RIGHT=1 }; - /** Create active edge + /** Create active edge @param rRect Rectangle this edge is part of @param fInvariantCoord - The invariant ccordinate value of this edge + The invariant ccordinate value of this edge @param eEdgeType Is fInvariantCoord the lower or the higher value, for @@ -117,12 +117,12 @@ namespace basegfx meEdgeDirection( eEdgeDirection ) {} - double getInvariantCoord() const { return mfInvariantCoord; } + double getInvariantCoord() const { return mfInvariantCoord; } const B2DRectangle& getRect() const { return *mpAssociatedRect; } - std::ptrdiff_t getTargetPolygonIndex() const { return mnPolygonIdx; } - void setTargetPolygonIndex( std::ptrdiff_t nIdx ) { mnPolygonIdx = nIdx; } - EdgeType getEdgeType() const { return meEdgeType; } - EdgeDirection getEdgeDirection() const { return meEdgeDirection; } + std::ptrdiff_t getTargetPolygonIndex() const { return mnPolygonIdx; } + void setTargetPolygonIndex( std::ptrdiff_t nIdx ) { mnPolygonIdx = nIdx; } + EdgeType getEdgeType() const { return meEdgeType; } + EdgeDirection getEdgeDirection() const { return meEdgeDirection; } /// For STL sort bool operator<( const ActiveEdge& rRHS ) const { return mfInvariantCoord < rRHS.mfInvariantCoord; } @@ -156,7 +156,7 @@ namespace basegfx std::ptrdiff_t mnPolygonIdx; /// 'upper' or 'lower' edge of original rectangle. - EdgeType meEdgeType; + EdgeType meEdgeType; /// 'left' or 'right' EdgeDirection meEdgeDirection; @@ -167,7 +167,7 @@ namespace basegfx /** Element of the sweep line event list - + As the sweep line traverses across the overall area, rectangle edges parallel to it generate events, and rectangle edges orthogonal to it generate active @@ -210,9 +210,9 @@ namespace basegfx Is fPos the lower or the higher value, for the rectangle this event is generated for? */ - SweepLineEvent( double fPos, + SweepLineEvent( double fPos, const B2DRectangle& rRect, - EdgeType eEdgeType, + EdgeType eEdgeType, EdgeDirection eDirection) : mfPos( fPos ), mpAssociatedRect( &rRect ), @@ -220,17 +220,17 @@ namespace basegfx meEdgeDirection( eDirection ) {} - double getPos() const { return mfPos; } + double getPos() const { return mfPos; } const B2DRectangle& getRect() const { return *mpAssociatedRect; } - EdgeType getEdgeType() const { return meEdgeType; } - EdgeDirection getEdgeDirection() const { return meEdgeDirection; } + EdgeType getEdgeType() const { return meEdgeType; } + EdgeDirection getEdgeDirection() const { return meEdgeDirection; } /// For STL sort bool operator<( const SweepLineEvent& rRHS ) const { return mfPos < rRHS.mfPos; } private: /// position of the event, in the direction of the line sweep - double mfPos; + double mfPos; /** Rectangle this event is generated for @@ -244,7 +244,7 @@ namespace basegfx const B2DRectangle* mpAssociatedRect; /// 'upper' or 'lower' edge of original rectangle. - EdgeType meEdgeType; + EdgeType meEdgeType; /// 'up' or 'down' EdgeDirection meEdgeDirection; @@ -254,7 +254,7 @@ namespace basegfx /** Smart point container for B2DMultiRange::getPolyPolygon() - + This class provides methods needed only here, and is used as a place to store some additional information per polygon. Also, most of the intersection logic is @@ -265,7 +265,7 @@ namespace basegfx public: /** Create polygon */ - ImplPolygon() : + ImplPolygon() : mpLeadingRightEdge(NULL), mnIdx(-1), maPoints(), @@ -279,8 +279,8 @@ namespace basegfx bool isFinished() const { return mbIsFinished; } /// Add point to the end of the existing points - void append( const B2DPoint& rPoint ) - { + void append( const B2DPoint& rPoint ) + { OSL_PRECOND( maPoints.empty() || maPoints.back().getX() == rPoint.getX() || maPoints.back().getY() == rPoint.getY(), @@ -290,7 +290,7 @@ namespace basegfx maPoints.back() != rPoint ) { // avoid duplicate points - maPoints.push_back( rPoint ); + maPoints.push_back( rPoint ); } } @@ -317,25 +317,25 @@ namespace basegfx list of upcoming active edges). */ std::ptrdiff_t intersect( SweepLineEvent& rEvent, - ActiveEdge& rActiveEdge, + ActiveEdge& rActiveEdge, VectorOfPolygons& rPolygonPool, B2DPolyPolygon& rRes, bool isFinishingEdge ) { OSL_PRECOND( !isFinished(), "ImplPolygon::intersect(): called on already finished polygon!" ); - OSL_PRECOND( !isFinishingEdge + OSL_PRECOND( !isFinishingEdge || (isFinishingEdge && &rEvent.getRect() == &rActiveEdge.getRect()), "ImplPolygon::intersect(): inconsistent ending!" ); - const B2DPoint aIntersectionPoint( rEvent.getPos(), + const B2DPoint aIntersectionPoint( rEvent.getPos(), rActiveEdge.getInvariantCoord() ); // intersection point, goes to our polygon // unconditionally append(aIntersectionPoint); - const bool isSweepLineEnteringRect( + const bool isSweepLineEnteringRect( rEvent.getEdgeType() == SweepLineEvent::STARTING_EDGE); if( isFinishingEdge ) { @@ -361,8 +361,8 @@ namespace basegfx { OSL_ENSURE( rActiveEdge.getTargetPolygonIndex() != -1, "ImplPolygon::intersect(): non-trivial intersection hit empty polygon!" ); - - const bool isHittingLeftEdge( + + const bool isHittingLeftEdge( rActiveEdge.getEdgeDirection() == ActiveEdge::PROCEED_LEFT); if( isHittingLeftEdge ) @@ -376,7 +376,7 @@ namespace basegfx rPolygonPool); } } - + private: std::ptrdiff_t getPolygonPoolIndex() const { return mnIdx; } @@ -385,7 +385,7 @@ namespace basegfx { const bool isActiveEdgeProceedLeft( rActiveEdge.getEdgeDirection() == ActiveEdge::PROCEED_LEFT); - const bool isSweepLineEnteringRect( + const bool isSweepLineEnteringRect( rEvent.getEdgeType() == SweepLineEvent::STARTING_EDGE); (void)isActiveEdgeProceedLeft; (void)isSweepLineEnteringRect; @@ -402,7 +402,7 @@ namespace basegfx { OSL_ENSURE( rActiveEdge.getEdgeDirection() == ActiveEdge::PROCEED_RIGHT, "ImplPolygon::handleInitialOwnRightEdge(): start edge wrong polygon order" ); - + rActiveEdge.setTargetPolygonIndex(mnIdx); mpLeadingRightEdge = &rActiveEdge; } @@ -442,7 +442,7 @@ namespace basegfx } } - std::ptrdiff_t handleComplexLeftEdge(ActiveEdge& rActiveEdge, + std::ptrdiff_t handleComplexLeftEdge(ActiveEdge& rActiveEdge, const B2DPoint& rIntersectionPoint, VectorOfPolygons& rPolygonPool, B2DPolyPolygon& rRes) @@ -491,7 +491,7 @@ namespace basegfx } } - std::ptrdiff_t handleComplexRightEdge(ActiveEdge& rActiveEdge, + std::ptrdiff_t handleComplexRightEdge(ActiveEdge& rActiveEdge, const B2DPoint& rIntersectionPoint, VectorOfPolygons& rPolygonPool) { @@ -499,10 +499,10 @@ namespace basegfx ImplPolygon& rTmp=rPolygonPool.get(nTmpIdx); rTmp.append(rIntersectionPoint); - + rActiveEdge.setTargetPolygonIndex(mnIdx); mpLeadingRightEdge = &rActiveEdge; - + rTmp.mpLeadingRightEdge = NULL; return nTmpIdx; @@ -510,7 +510,7 @@ namespace basegfx /// True when sweep line hits our own active edge bool metOwnEdge(const SweepLineEvent& rEvent, - ActiveEdge& rActiveEdge) + ActiveEdge& rActiveEdge) { const bool bHitOwnEdge=&rEvent.getRect() == &rActiveEdge.getRect(); return bHitOwnEdge; @@ -522,7 +522,7 @@ namespace basegfx B2DPolygon aRes; std::for_each( maPoints.begin(), maPoints.end(), - boost::bind( + boost::bind( &B2DPolygon::append, boost::ref(aRes), _1, @@ -533,13 +533,13 @@ namespace basegfx /** Finish this polygon, push to result set. */ - void finish(B2DPolyPolygon& rRes) - { + void finish(B2DPolyPolygon& rRes) + { OSL_PRECOND( maPoints.empty() || maPoints.front().getX() == maPoints.back().getX() || maPoints.front().getY() == maPoints.back().getY(), "ImplPolygon::finish(): first and last point violate 90 degree line angle constraint!" ); - + mbIsFinished = true; mpLeadingRightEdge = NULL; @@ -561,7 +561,7 @@ namespace basegfx std::vector<B2DPoint> maPoints; /// When true, this polygon is 'done', i.e. nothing must be added anymore. - bool mbIsFinished; + bool mbIsFinished; }; /** Init sweep line event list @@ -591,7 +591,7 @@ namespace basegfx { const B2DRectangle& rCurrRect( *aCurrRect++ ); - o_rEventVector.push_back( + o_rEventVector.push_back( SweepLineEvent( rCurrRect.getMinX(), rCurrRect, SweepLineEvent::STARTING_EDGE, @@ -608,7 +608,7 @@ namespace basegfx { const B2DRectangle& rCurrRect( *aCurrRectR++ ); - o_rEventVector.push_back( + o_rEventVector.push_back( SweepLineEvent( rCurrRect.getMaxX(), rCurrRect, SweepLineEvent::FINISHING_EDGE, @@ -657,8 +657,8 @@ namespace basegfx @param rCurrEvent The actual event that caused this call */ - void createActiveEdgesFromStartEvent( ListOfEdges& io_rEdgeList, - VectorOfPolygons& io_rPolygonPool, + void createActiveEdgesFromStartEvent( ListOfEdges& io_rEdgeList, + VectorOfPolygons& io_rPolygonPool, SweepLineEvent& rCurrEvent ) { ListOfEdges aNewEdges; @@ -671,16 +671,16 @@ namespace basegfx io_rPolygonPool.get(nIdxPolygon).setPolygonPoolIndex(nIdxPolygon); // upper edge - aNewEdges.push_back( - ActiveEdge( + aNewEdges.push_back( + ActiveEdge( rRect, rRect.getMinY(), bGoesDown ? nIdxPolygon : -1, ActiveEdge::UPPER, bGoesDown ? ActiveEdge::PROCEED_LEFT : ActiveEdge::PROCEED_RIGHT) ); // lower edge - aNewEdges.push_back( - ActiveEdge( + aNewEdges.push_back( + ActiveEdge( rRect, rRect.getMaxY(), bGoesDown ? -1 : nIdxPolygon, @@ -698,22 +698,22 @@ namespace basegfx // starts and finishes this rect correctly (as only then, // the polygon will have their associated active edges // set). - const double nMinY( rRect.getMinY() ); - const double nMaxY( rRect.getMaxY() ); - ListOfEdges::iterator aCurr( io_rEdgeList.begin() ); + const double nMinY( rRect.getMinY() ); + const double nMaxY( rRect.getMaxY() ); + ListOfEdges::iterator aCurr( io_rEdgeList.begin() ); const ListOfEdges::iterator aEnd ( io_rEdgeList.end() ); while( aCurr != aEnd ) { const double nCurrY( aCurr->getInvariantCoord() ); - if( nCurrY >= nMinY && + if( nCurrY >= nMinY && aNewEdges.size() == 2 ) // only add, if not yet done. { // insert upper edge _before_ aCurr. Thus, it will // be the first entry for a range of equal y // values. Using splice here, since we hold // references to the moved list element! - io_rEdgeList.splice( aCurr, + io_rEdgeList.splice( aCurr, aNewEdges, aNewEdges.begin() ); } @@ -725,7 +725,7 @@ namespace basegfx // (aCurr is the first entry strictly larger than // nMaxY). Using splice here, since we hold // references to the moved list element! - io_rEdgeList.splice( aCurr, + io_rEdgeList.splice( aCurr, aNewEdges, aNewEdges.begin() ); // done with insertion, can early-exit here. @@ -798,13 +798,13 @@ namespace basegfx // second encounter of my rect -> second edge // encountered, done const bool bExit= - nCount && + nCount && isSameRect(*first, rCurrRect); // deal with current active edge - nCurrPolyIdx = - rPolygonPool.get(nCurrPolyIdx).intersect( + nCurrPolyIdx = + rPolygonPool.get(nCurrPolyIdx).intersect( rCurrEvent, *first, rPolygonPool, @@ -825,29 +825,29 @@ namespace basegfx } } - template<int bPerformErase> inline void processActiveEdgesTopDown( + template<int bPerformErase> inline void processActiveEdgesTopDown( SweepLineEvent& rCurrEvent, ListOfEdges& rActiveEdgeList, VectorOfPolygons& rPolygonPool, B2DPolyPolygon& rRes ) { processActiveEdges<bPerformErase>( - rActiveEdgeList. begin(), - rActiveEdgeList. end(), + rActiveEdgeList. begin(), + rActiveEdgeList. end(), rActiveEdgeList, rCurrEvent, rPolygonPool, rRes); } - template<int bPerformErase> inline void processActiveEdgesBottomUp( + template<int bPerformErase> inline void processActiveEdgesBottomUp( SweepLineEvent& rCurrEvent, ListOfEdges& rActiveEdgeList, VectorOfPolygons& rPolygonPool, B2DPolyPolygon& rRes ) { processActiveEdges<bPerformErase>( - rActiveEdgeList. rbegin(), + rActiveEdgeList. rbegin(), rActiveEdgeList. rend(), rActiveEdgeList, rCurrEvent, @@ -866,7 +866,7 @@ namespace basegfx createActiveEdgesFromStartEvent( rActiveEdgeList, rPolygonPool, rCurrEvent ); - + if( SweepLineEvent::PROCEED_DOWN == rCurrEvent.getEdgeDirection() ) processActiveEdgesTopDown<NoErase>( rCurrEvent, rActiveEdgeList, rPolygonPool, rRes); @@ -902,7 +902,7 @@ namespace basegfx namespace tools { - B2DPolyPolygon solveCrossovers(const std::vector<B2DRange>& rRanges, + B2DPolyPolygon solveCrossovers(const std::vector<B2DRange>& rRanges, const std::vector<B2VectorOrientation>& rOrientations) { // sweep-line algorithm to generate a poly-polygon @@ -911,8 +911,8 @@ namespace basegfx // // This algorithm uses the well-known sweep line // concept, explained in every good text book about - // computational geometry. - // + // computational geometry. + // // We start with creating two structures for every // rectangle, one representing the left x coordinate, // one representing the right x coordinate (and both @@ -930,7 +930,7 @@ namespace basegfx B2DPolyPolygon aRes; VectorOfPolygons aPolygonPool; - ListOfEdges aActiveEdgeList; + ListOfEdges aActiveEdgeList; // sometimes not enough, but a usable compromise aPolygonPool.reserve( rRanges.size() ); diff --git a/basegfx/source/range/b2xrange.cxx b/basegfx/source/range/b2xrange.cxx index a2e33b461c92..3dbb5d900541 100644 --- a/basegfx/source/range/b2xrange.cxx +++ b/basegfx/source/range/b2xrange.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -40,14 +40,14 @@ namespace basegfx { /** Generic implementation of the difference set computation - @tpl RangeType + @tpl RangeType Type to operate on. Must provide ValueType and TraitsType nested types. */ - template< class RangeType > void doComputeSetDifference( - ::std::vector< RangeType >& o_rRanges, - const RangeType& a, - const RangeType& b ) + template< class RangeType > void doComputeSetDifference( + ::std::vector< RangeType >& o_rRanges, + const RangeType& a, + const RangeType& b ) { o_rRanges.clear(); @@ -65,45 +65,45 @@ namespace basegfx return; } - const typename RangeType::ValueType ax(a.getMinX()); - const typename RangeType::ValueType ay(a.getMinY()); - const typename RangeType::TraitsType::DifferenceType aw(a.getWidth()); - const typename RangeType::TraitsType::DifferenceType ah(a.getHeight()); - const typename RangeType::ValueType bx(b.getMinX()); - const typename RangeType::ValueType by(b.getMinY()); - const typename RangeType::TraitsType::DifferenceType bw(b.getWidth()); - const typename RangeType::TraitsType::DifferenceType bh(b.getHeight()); - - const typename RangeType::TraitsType::DifferenceType h0( (by > ay) ? by - ay : 0 ); - const typename RangeType::TraitsType::DifferenceType h3( (by + bh < ay + ah) ? ay + ah - by - bh : 0 ); - const typename RangeType::TraitsType::DifferenceType w1( (bx > ax) ? bx - ax : 0 ); - const typename RangeType::TraitsType::DifferenceType w2( (ax + aw > bx + bw) ? ax + aw - bx - bw : 0 ); - const typename RangeType::TraitsType::DifferenceType h12( (h0 + h3 < ah) ? ah - h0 - h3 : 0 ); + const typename RangeType::ValueType ax(a.getMinX()); + const typename RangeType::ValueType ay(a.getMinY()); + const typename RangeType::TraitsType::DifferenceType aw(a.getWidth()); + const typename RangeType::TraitsType::DifferenceType ah(a.getHeight()); + const typename RangeType::ValueType bx(b.getMinX()); + const typename RangeType::ValueType by(b.getMinY()); + const typename RangeType::TraitsType::DifferenceType bw(b.getWidth()); + const typename RangeType::TraitsType::DifferenceType bh(b.getHeight()); + + const typename RangeType::TraitsType::DifferenceType h0( (by > ay) ? by - ay : 0 ); + const typename RangeType::TraitsType::DifferenceType h3( (by + bh < ay + ah) ? ay + ah - by - bh : 0 ); + const typename RangeType::TraitsType::DifferenceType w1( (bx > ax) ? bx - ax : 0 ); + const typename RangeType::TraitsType::DifferenceType w2( (ax + aw > bx + bw) ? ax + aw - bx - bw : 0 ); + const typename RangeType::TraitsType::DifferenceType h12( (h0 + h3 < ah) ? ah - h0 - h3 : 0 ); // TODO(E2): Use numeric_cast instead of static_cast here, // need range checks! if (h0 > 0) - o_rRanges.push_back( + o_rRanges.push_back( RangeType(ax,ay, static_cast<typename RangeType::ValueType>(ax+aw), static_cast<typename RangeType::ValueType>(ay+h0)) ); if (w1 > 0 && h12 > 0) - o_rRanges.push_back( + o_rRanges.push_back( RangeType(ax, static_cast<typename RangeType::ValueType>(ay+h0), static_cast<typename RangeType::ValueType>(ax+w1), static_cast<typename RangeType::ValueType>(ay+h0+h12)) ); if (w2 > 0 && h12 > 0) - o_rRanges.push_back( + o_rRanges.push_back( RangeType(static_cast<typename RangeType::ValueType>(bx+bw), static_cast<typename RangeType::ValueType>(ay+h0), static_cast<typename RangeType::ValueType>(bx+bw+w2), static_cast<typename RangeType::ValueType>(ay+h0+h12)) ); if (h3 > 0) - o_rRanges.push_back( + o_rRanges.push_back( RangeType(ax, static_cast<typename RangeType::ValueType>(ay+h0+h12), static_cast<typename RangeType::ValueType>(ax+aw), @@ -111,27 +111,27 @@ namespace basegfx } } - ::std::vector< B2IRange >& computeSetDifference( ::std::vector< B2IRange >& o_rResult, - const B2IRange& rFirst, - const B2IRange& rSecond ) + ::std::vector< B2IRange >& computeSetDifference( ::std::vector< B2IRange >& o_rResult, + const B2IRange& rFirst, + const B2IRange& rSecond ) { doComputeSetDifference( o_rResult, rFirst, rSecond ); return o_rResult; } - ::std::vector< B2DRange >& computeSetDifference( ::std::vector< B2DRange >& o_rResult, - const B2DRange& rFirst, - const B2DRange& rSecond ) + ::std::vector< B2DRange >& computeSetDifference( ::std::vector< B2DRange >& o_rResult, + const B2DRange& rFirst, + const B2DRange& rSecond ) { doComputeSetDifference( o_rResult, rFirst, rSecond ); return o_rResult; } - ::std::vector< B2IBox >& computeSetDifference( ::std::vector< B2IBox >& o_rResult, - const B2IBox& rFirst, - const B2IBox& rSecond ) + ::std::vector< B2IBox >& computeSetDifference( ::std::vector< B2IBox >& o_rResult, + const B2IBox& rFirst, + const B2IBox& rSecond ) { doComputeSetDifference( o_rResult, rFirst, rSecond ); diff --git a/basegfx/source/range/b3drange.cxx b/basegfx/source/range/b3drange.cxx index 21ba72d9483d..ff6bceedb473 100644 --- a/basegfx/source/range/b3drange.cxx +++ b/basegfx/source/range/b3drange.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -73,11 +73,11 @@ namespace basegfx { return rRange.isEmpty() ? B3IRange() : - B3IRange(fround(rRange.getMinX()), - fround(rRange.getMinY()), - fround(rRange.getMinZ()), - fround(rRange.getMaxX()), - fround(rRange.getMaxY()), + B3IRange(fround(rRange.getMinX()), + fround(rRange.getMinY()), + fround(rRange.getMinZ()), + fround(rRange.getMaxX()), + fround(rRange.getMaxY()), fround(rRange.getMaxZ())); } diff --git a/basegfx/source/raster/bpixelraster.cxx b/basegfx/source/raster/bpixelraster.cxx index 96ad4e991b5a..232438439849 100644 --- a/basegfx/source/raster/bpixelraster.cxx +++ b/basegfx/source/raster/bpixelraster.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/basegfx/source/raster/bzpixelraster.cxx b/basegfx/source/raster/bzpixelraster.cxx index 574d57f17500..e696d5839b9d 100644 --- a/basegfx/source/raster/bzpixelraster.cxx +++ b/basegfx/source/raster/bzpixelraster.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/basegfx/source/raster/rasterconvert3d.cxx b/basegfx/source/raster/rasterconvert3d.cxx index 0d06ca5be086..f19048c3fa05 100644 --- a/basegfx/source/raster/rasterconvert3d.cxx +++ b/basegfx/source/raster/rasterconvert3d.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -60,7 +60,7 @@ namespace basegfx } RasterConverter3D::RasterConverter3D() - : InterpolatorProvider3D(), + : InterpolatorProvider3D(), maLineEntries() {} @@ -107,7 +107,7 @@ namespace basegfx if(!nStep || aCurrentEntry->decrementRasterConversionLineEntry3D(nStep)) { - // add when exactly on current line or when incremet to it did not + // add when exactly on current line or when incremet to it did not // completely consume it if(nStep) { @@ -207,15 +207,15 @@ namespace basegfx const double fEyeB(((*pViewToEye) * aEnd).getZ()); rEntry.setInverseTextureIndex(addInverseTextureInterpolator( - rFill.getTextureCoordinate(a), - rFill.getTextureCoordinate(b), + rFill.getTextureCoordinate(a), + rFill.getTextureCoordinate(b), fEyeA, fEyeB, fInvYDelta)); } else { rEntry.setTextureIndex(addTextureInterpolator( - rFill.getTextureCoordinate(a), - rFill.getTextureCoordinate(b), + rFill.getTextureCoordinate(a), + rFill.getTextureCoordinate(b), fInvYDelta)); } } @@ -237,7 +237,7 @@ namespace basegfx { reset(); maLineEntries.clear(); - + B2DVector aVector(aEnd.getX() - aStart.getX(), aEnd.getY() - aStart.getY()); aVector.normalize(); const B2DVector aPerpend(getPerpendicular(aVector) * ((static_cast<double>(nLineWidth) + 0.5) * 0.5)); @@ -271,7 +271,7 @@ namespace basegfx { reset(); maLineEntries.clear(); - + // horizontal line, create vertical entries. These will be sorted by // X anyways, so no need to distinguish the case here maLineEntries.push_back(RasterConversionLineEntry3D( @@ -307,7 +307,7 @@ namespace basegfx RasterConversionLineEntry3D& rEntry = maLineEntries[maLineEntries.size() - 1]; - // need to choose a X-Distance for the 2nd edge which guarantees all pixels + // need to choose a X-Distance for the 2nd edge which guarantees all pixels // of the line to be set. This is exactly the X-Increment for one Y-Step. // Same is true for Z, so in both cases, add one increment to them. To also // guarantee one pixel per line, add a minimum of one for X. diff --git a/basegfx/source/tools/b2dclipstate.cxx b/basegfx/source/tools/b2dclipstate.cxx index 46cf9bbe724f..4f1d68b0f699 100644 --- a/basegfx/source/tools/b2dclipstate.cxx +++ b/basegfx/source/tools/b2dclipstate.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -83,7 +83,7 @@ namespace tools bool isCleared() const { return !maClipPoly.count() - && !maPendingPolygons.count() + && !maPendingPolygons.count() && !maPendingRanges.count(); } @@ -103,7 +103,7 @@ namespace tools bool isNull() const { - return !maPendingPolygons.count() + return !maPendingPolygons.count() && !maPendingRanges.count() && isNullClipPoly(); } @@ -119,9 +119,9 @@ namespace tools bool operator==(const ImplB2DClipState& rRHS) const { - return maPendingPolygons == rRHS.maPendingPolygons + return maPendingPolygons == rRHS.maPendingPolygons && maPendingRanges == rRHS.maPendingRanges - && maClipPoly == rRHS.maClipPoly + && maClipPoly == rRHS.maClipPoly && mePendingOps == rRHS.mePendingOps; } @@ -208,10 +208,10 @@ namespace tools { if( isCleared() ) return; - + addClipState(rOther, UNION); } - + void intersectRange(const B2DRange& rRange) { if( isNull() ) @@ -240,10 +240,10 @@ namespace tools { if( isNull() ) return; - + addClipState(rOther, INTERSECT); } - + void subtractRange(const B2DRange& rRange ) { if( isNull() ) @@ -267,7 +267,7 @@ namespace tools addPolyPolygon(rPolyPoly,SUBTRACT); } - + void subtractClipState(const ImplB2DClipState& rOther) { if( isNull() ) @@ -275,7 +275,7 @@ namespace tools addClipState(rOther, SUBTRACT); } - + void xorRange(const B2DRange& rRange) { addRange(rRange,XOR); @@ -295,7 +295,7 @@ namespace tools { addClipState(rOther, XOR); } - + B2DPolyPolygon getClipPoly() const { commitPendingRanges(); @@ -369,7 +369,7 @@ namespace tools maPendingPolygons = solveCrossovers(maPendingPolygons); maPendingPolygons = stripNeutralPolygons(maPendingPolygons); maPendingPolygons = stripDispensablePolygons(maPendingPolygons, false); - + if( bIsCleared ) { // not representable, strictly speaking, @@ -403,7 +403,7 @@ namespace tools return; // use the specialized range clipper for the win - B2DPolyPolygon aCollectedRanges; + B2DPolyPolygon aCollectedRanges; const bool bIsEmpty=isNullClipPoly(); const bool bIsCleared=!maClipPoly.count(); switch(mePendingOps) @@ -471,7 +471,7 @@ namespace tools aCollectedRanges = maPendingRanges.solveCrossovers(); aCollectedRanges = stripNeutralPolygons(aCollectedRanges); aCollectedRanges = stripDispensablePolygons(aCollectedRanges, false); - + if( bIsCleared ) { // not representable, strictly speaking, @@ -498,7 +498,7 @@ namespace tools maPendingRanges.clear(); mePendingOps = UNION; } - + mutable B2DPolyPolygon maPendingPolygons; mutable B2DPolyRange maPendingRanges; mutable B2DPolyPolygon maClipPoly; @@ -538,7 +538,7 @@ namespace tools { mpImpl.make_unique(); } - + void B2DClipState::makeNull() { mpImpl->makeNull(); @@ -631,7 +631,7 @@ namespace tools { mpImpl->subtractClipState(*rState.mpImpl); } - + void B2DClipState::xorRange(const B2DRange& rRange) { mpImpl->xorRange(rRange); diff --git a/basegfx/source/tools/canvastools.cxx b/basegfx/source/tools/canvastools.cxx index 907ff2c7a1ed..c82b13d7cbf8 100644 --- a/basegfx/source/tools/canvastools.cxx +++ b/basegfx/source/tools/canvastools.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -97,12 +97,12 @@ namespace basegfx uno::Sequence< geometry::RealPoint2D > outputSequence( nNumPoints ); geometry::RealPoint2D* pOutput = outputSequence.getArray(); - + // fill sequence from polygon sal_uInt32 i; for( i=0; i<nNumPoints; ++i ) { - const ::basegfx::B2DPoint aPoint( rPoly.getB2DPoint(i) ); + const ::basegfx::B2DPoint aPoint( rPoly.getB2DPoint(i) ); pOutput[i] = geometry::RealPoint2D( aPoint.getX(), aPoint.getY() ); @@ -132,7 +132,7 @@ namespace basegfx //--------------------------------------------------------------------------------------- - uno::Sequence< uno::Sequence< geometry::RealPoint2D > > pointSequenceSequenceFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly ) + uno::Sequence< uno::Sequence< geometry::RealPoint2D > > pointSequenceSequenceFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly ) { const sal_uInt32 nNumPolies( rPolyPoly.count() ); sal_uInt32 i; @@ -150,8 +150,8 @@ namespace basegfx //--------------------------------------------------------------------------------------- - uno::Reference< rendering::XPolyPolygon2D > xPolyPolygonFromB2DPolygon( const uno::Reference< rendering::XGraphicDevice >& xGraphicDevice, - const ::basegfx::B2DPolygon& rPoly ) + uno::Reference< rendering::XPolyPolygon2D > xPolyPolygonFromB2DPolygon( const uno::Reference< rendering::XGraphicDevice >& xGraphicDevice, + const ::basegfx::B2DPolygon& rPoly ) { uno::Reference< rendering::XPolyPolygon2D > xRes; @@ -183,8 +183,8 @@ namespace basegfx //--------------------------------------------------------------------------------------- - uno::Reference< rendering::XPolyPolygon2D > xPolyPolygonFromB2DPolyPolygon( const uno::Reference< rendering::XGraphicDevice >& xGraphicDevice, - const ::basegfx::B2DPolyPolygon& rPolyPoly ) + uno::Reference< rendering::XPolyPolygon2D > xPolyPolygonFromB2DPolyPolygon( const uno::Reference< rendering::XGraphicDevice >& xGraphicDevice, + const ::basegfx::B2DPolyPolygon& rPolyPoly ) { uno::Reference< rendering::XPolyPolygon2D > xRes; @@ -196,13 +196,13 @@ namespace basegfx if( rPolyPoly.areControlPointsUsed() ) { - xRes.set( xGraphicDevice->createCompatibleBezierPolyPolygon( + xRes.set( xGraphicDevice->createCompatibleBezierPolyPolygon( bezierSequenceSequenceFromB2DPolyPolygon( rPolyPoly ) ), uno::UNO_QUERY ); } else { - xRes.set( xGraphicDevice->createCompatibleLinePolyPolygon( + xRes.set( xGraphicDevice->createCompatibleLinePolyPolygon( pointSequenceSequenceFromB2DPolyPolygon( rPolyPoly ) ), uno::UNO_QUERY ); } @@ -295,7 +295,7 @@ namespace basegfx ::basegfx::B2DPolyPolygon b2DPolyPolygonFromXPolyPolygon2D( const uno::Reference< rendering::XPolyPolygon2D >& xPoly ) { - ::basegfx::unotools::UnoPolyPolygon* pPolyImpl = + ::basegfx::unotools::UnoPolyPolygon* pPolyImpl = dynamic_cast< ::basegfx::unotools::UnoPolyPolygon* >( xPoly.get() ); if( pPolyImpl ) @@ -333,7 +333,7 @@ namespace basegfx throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(): Invalid input" - "poly-polygon, cannot retrieve vertex data"), + "poly-polygon, cannot retrieve vertex data"), uno::Reference< uno::XInterface >(), 0 ); } @@ -349,8 +349,8 @@ namespace basegfx //--------------------------------------------------------------------------------------- - ::basegfx::B2DHomMatrix& homMatrixFromAffineMatrix( ::basegfx::B2DHomMatrix& output, - const geometry::AffineMatrix2D& input ) + ::basegfx::B2DHomMatrix& homMatrixFromAffineMatrix( ::basegfx::B2DHomMatrix& output, + const geometry::AffineMatrix2D& input ) { // ensure last row is [0,0,1] (and optimized away) output.identity(); @@ -401,8 +401,8 @@ namespace basegfx return output; } - geometry::AffineMatrix2D& affineMatrixFromHomMatrix( geometry::AffineMatrix2D& output, - const ::basegfx::B2DHomMatrix& input) + geometry::AffineMatrix2D& affineMatrixFromHomMatrix( geometry::AffineMatrix2D& output, + const ::basegfx::B2DHomMatrix& input) { output.m00 = input.get(0,0); output.m01 = input.get(0,1); @@ -416,13 +416,13 @@ namespace basegfx geometry::AffineMatrix3D& affineMatrixFromHomMatrix3D( geometry::AffineMatrix3D& output, - const ::basegfx::B3DHomMatrix& input) + const ::basegfx::B3DHomMatrix& input) { output.m00 = input.get(0,0); output.m01 = input.get(0,1); output.m02 = input.get(0,2); output.m03 = input.get(0,3); - + output.m10 = input.get(1,0); output.m11 = input.get(1,1); output.m12 = input.get(1,2); @@ -438,7 +438,7 @@ namespace basegfx //--------------------------------------------------------------------------------------- - ::basegfx::B2DHomMatrix& homMatrixFromMatrix( ::basegfx::B2DHomMatrix& output, + ::basegfx::B2DHomMatrix& homMatrixFromMatrix( ::basegfx::B2DHomMatrix& output, const geometry::Matrix2D& input ) { // ensure last row is [0,0,1] (and optimized away) diff --git a/basegfx/source/tools/debugplotter.cxx b/basegfx/source/tools/debugplotter.cxx index 9eb76e2870d9..1e88e3470a45 100644 --- a/basegfx/source/tools/debugplotter.cxx +++ b/basegfx/source/tools/debugplotter.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -43,7 +43,7 @@ namespace basegfx namespace { void outputHeader( const ::rtl::OString& rTitle, - ::std::ostream* pStm ) + ::std::ostream* pStm ) { // output gnuplot setup if( pStm ) @@ -73,12 +73,12 @@ namespace basegfx "line(p,q,r) = p*(1-t)+q*t" << ::std::endl << // Plot a line's x component of a line in implicit // form ax + by + c = 0 - "implicitLineX(a,b,c,t) = a*-c + t*-b" << ::std::endl << + "implicitLineX(a,b,c,t) = a*-c + t*-b" << ::std::endl << // Plot a line's y component of a line in implicit // form ax + by + c = 0 - "implicitLineY(a,b,c,t) = b*-c + t*a" << ::std::endl << - "pointmarkx(c,t) = c-0.03*t" << ::std::endl << // hack for displaying single points in parametric form - "pointmarky(c,t) = c+0.03*t" << ::std::endl << // hack for displaying single points in parametric form + "implicitLineY(a,b,c,t) = b*-c + t*a" << ::std::endl << + "pointmarkx(c,t) = c-0.03*t" << ::std::endl << // hack for displaying single points in parametric form + "pointmarky(c,t) = c+0.03*t" << ::std::endl << // hack for displaying single points in parametric form "# end of setup" << ::std::endl; } else @@ -106,12 +106,12 @@ namespace basegfx "line(p,q,r) = p*(1-t)+q*t\n", // Plot a line's x component of a line in implicit // form ax + by + c = 0 - "implicitLineX(a,b,c,t) = a*-c + t*-b\n", + "implicitLineX(a,b,c,t) = a*-c + t*-b\n", // Plot a line's y component of a line in implicit // form ax + by + c = 0 - "implicitLineY(a,b,c,t) = b*-c + t*a\n", - "pointmarkx(c,t) = c-0.03*t\n", // hack for displaying single points in parametric form - "pointmarky(c,t) = c+0.03*t\n", // hack for displaying single points in parametric form + "implicitLineY(a,b,c,t) = b*-c + t*a\n", + "pointmarkx(c,t) = c-0.03*t\n", // hack for displaying single points in parametric form + "pointmarky(c,t) = c+0.03*t\n", // hack for displaying single points in parametric form "# end of setup\n", (const sal_Char*)rTitle ); } @@ -124,7 +124,7 @@ namespace basegfx mpStream( pStm ) { } - + void outputPoint( const ::std::pair< B2DPoint, ::rtl::OString >& rElem ) { if( mpStream ) @@ -132,7 +132,7 @@ namespace basegfx else OSL_TRACE( " %f\t%f\n", rElem.first.getX(), rElem.first.getY() ); } - + void outputVector( const ::std::pair< B2DVector, ::rtl::OString >& rElem ) { if( mpStream ) @@ -140,16 +140,16 @@ namespace basegfx else OSL_TRACE( " %f\t%f\n\n", rElem.first.getX(), rElem.first.getY() ); } - + void outputRect( const ::std::pair< B2DRange, ::rtl::OString >& rElem ) { const double nX0( rElem.first.getMinX() ); const double nY0( rElem.first.getMinY() ); const double nX1( rElem.first.getMaxX() ); const double nY1( rElem.first.getMaxY() ); - + if( mpStream ) - *mpStream << " " + *mpStream << " " << nX0 << "\t" << nY0 << "\t" << nX1 << "\t" << nY0 << "\t" << nX1 << "\t" << nY1 << "\t" @@ -157,7 +157,7 @@ namespace basegfx << nX0 << "\t" << nY0 << ::std::endl << ::std::endl; else - OSL_TRACE( " %f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\n\n", + OSL_TRACE( " %f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\n\n", nX0, nY0, nX1, nY0, nX1, nY1, @@ -166,7 +166,7 @@ namespace basegfx } private: - ::std::ostream* mpStream; + ::std::ostream* mpStream; }; } @@ -204,7 +204,7 @@ namespace basegfx bHavePolygons ) { outputHeader( maTitle, mpOutputStream ); - + print( "\n\n# parametric primitive output\n" "plot [t=0:1] \\\n" ); @@ -239,7 +239,7 @@ namespace basegfx if( maPolygons.at(i).first.areControlPointsUsed() ) { const B2DPolygon& rCurrPoly( maPolygons.at(i).first ); - + const sal_uInt32 nCount( rCurrPoly.count() ); for( sal_uInt32 k=0; k<nCount; ++k ) { @@ -252,7 +252,7 @@ namespace basegfx const B2DPoint& rP3( k+1<nCount ? rCurrPoly.getB2DPoint(k+1) : rCurrPoly.getB2DPoint(k) ); if( mpOutputStream ) - *mpOutputStream << " cubicBezier(" + *mpOutputStream << " cubicBezier(" << rP0.getX() << "," << rP1.getX() << "," << rP2.getX() << "," @@ -280,7 +280,7 @@ namespace basegfx { if( bNeedColon ) print( ", \\\n" ); - + if( mpOutputStream ) *mpOutputStream << " '-' using ($1):($2) title \"Polygon " << (const sal_Char*)maPolygons.at(i).second << "\" with lp"; @@ -365,15 +365,15 @@ namespace basegfx ::rtl::OString( pTitle ) ) ); } - void DebugPlotter::plot( const B2DVector& rVec, - const sal_Char* pTitle ) + void DebugPlotter::plot( const B2DVector& rVec, + const sal_Char* pTitle ) { maVectors.push_back( ::std::make_pair( rVec, ::rtl::OString( pTitle ) ) ); } - void DebugPlotter::plot( const B2DCubicBezier& rBezier, - const sal_Char* pTitle ) + void DebugPlotter::plot( const B2DCubicBezier& rBezier, + const sal_Char* pTitle ) { B2DPolygon aPoly; aPoly.append(rBezier.getStartPoint()); @@ -389,15 +389,15 @@ namespace basegfx ::rtl::OString( pTitle ) ) ); } - void DebugPlotter::plot( const B2DPolygon& rPoly, - const sal_Char* pTitle ) + void DebugPlotter::plot( const B2DPolygon& rPoly, + const sal_Char* pTitle ) { maPolygons.push_back( ::std::make_pair( rPoly, ::rtl::OString( pTitle ) ) ); } - void DebugPlotter::plot( const B2DPolyPolygon& rPoly, - const sal_Char* pTitle ) + void DebugPlotter::plot( const B2DPolyPolygon& rPoly, + const sal_Char* pTitle ) { const ::rtl::OString aTitle( pTitle ); const sal_uInt32 nCount( rPoly.count() ); diff --git a/basegfx/source/tools/gradienttools.cxx b/basegfx/source/tools/gradienttools.cxx index 31f9c45efb76..740db5cba1bc 100644 --- a/basegfx/source/tools/gradienttools.cxx +++ b/basegfx/source/tools/gradienttools.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -40,9 +40,9 @@ namespace basegfx for the border treatment. Factored out here. */ static void init1DGradientInfo(ODFGradientInfo& o_rGradientInfo, - const B2DRange& rTargetRange, + const B2DRange& rTargetRange, sal_uInt32 nSteps, - double fBorder, + double fBorder, double fAngle, bool bAxial) { @@ -76,7 +76,7 @@ namespace basegfx o_rGradientInfo.maTextureTransform.scale(1.0, fSizeWithoutBorder * .5); o_rGradientInfo.maTextureTransform.translate(0.0, 0.5); } - else + else { if(!fTools::equal(fSizeWithoutBorder, 1.0)) { @@ -92,7 +92,7 @@ namespace basegfx { const B2DPoint aCenter(0.5*fTargetSizeX, 0.5*fTargetSizeY); - o_rGradientInfo.maTextureTransform *= + o_rGradientInfo.maTextureTransform *= basegfx::tools::createRotateAroundPoint(aCenter, fAngle); } @@ -111,17 +111,17 @@ namespace basegfx except for the border treatment. Factored out here. */ static void initEllipticalGradientInfo(ODFGradientInfo& o_rGradientInfo, - const B2DRange& rTargetRange, + const B2DRange& rTargetRange, const B2DVector& rOffset, sal_uInt32 nSteps, - double fBorder, + double fBorder, double fAngle, bool bCircular) { o_rGradientInfo.maTextureTransform.identity(); o_rGradientInfo.maBackTextureTransform.identity(); o_rGradientInfo.mnSteps = nSteps; - + fAngle = -fAngle; double fTargetSizeX(rTargetRange.getWidth()); @@ -137,7 +137,7 @@ namespace basegfx fTargetOffsetY -= (fOriginalDiag - fTargetSizeY) / 2.0; fTargetSizeX = fOriginalDiag; fTargetSizeY = fOriginalDiag; - } + } else { fTargetOffsetX -= (0.4142 / 2.0 ) * fTargetSizeX; @@ -184,10 +184,10 @@ namespace basegfx here. */ static void initRectGradientInfo(ODFGradientInfo& o_rGradientInfo, - const B2DRange& rTargetRange, + const B2DRange& rTargetRange, const B2DVector& rOffset, sal_uInt32 nSteps, - double fBorder, + double fBorder, double fAngle) { o_rGradientInfo.maTextureTransform.identity(); @@ -223,9 +223,9 @@ namespace basegfx // add texture rotate after scale to keep perpendicular angles if(0.0 != fAngle) { - const B2DPoint aCenter(0.5*fTargetSizeX, + const B2DPoint aCenter(0.5*fTargetSizeX, 0.5*fTargetSizeY); - o_rGradientInfo.maTextureTransform *= + o_rGradientInfo.maTextureTransform *= basegfx::tools::createRotateAroundPoint(aCenter, fAngle); } @@ -251,100 +251,100 @@ namespace basegfx namespace tools { ODFGradientInfo& createLinearODFGradientInfo(ODFGradientInfo& o_rGradientInfo, - const B2DRange& rTargetArea, - sal_uInt32 nSteps, - double fBorder, + const B2DRange& rTargetArea, + sal_uInt32 nSteps, + double fBorder, double fAngle) { init1DGradientInfo(o_rGradientInfo, - rTargetArea, + rTargetArea, nSteps, - fBorder, + fBorder, fAngle, false); return o_rGradientInfo; } ODFGradientInfo& createAxialODFGradientInfo(ODFGradientInfo& o_rGradientInfo, - const B2DRange& rTargetArea, - sal_uInt32 nSteps, - double fBorder, + const B2DRange& rTargetArea, + sal_uInt32 nSteps, + double fBorder, double fAngle) { init1DGradientInfo(o_rGradientInfo, - rTargetArea, + rTargetArea, nSteps, - fBorder, + fBorder, fAngle, true); return o_rGradientInfo; } ODFGradientInfo& createRadialODFGradientInfo(ODFGradientInfo& o_rGradientInfo, - const B2DRange& rTargetArea, + const B2DRange& rTargetArea, const B2DVector& rOffset, - sal_uInt32 nSteps, + sal_uInt32 nSteps, double fBorder) { initEllipticalGradientInfo(o_rGradientInfo, - rTargetArea, + rTargetArea, rOffset, nSteps, - fBorder, + fBorder, 0.0, true); return o_rGradientInfo; } ODFGradientInfo& createEllipticalODFGradientInfo(ODFGradientInfo& o_rGradientInfo, - const B2DRange& rTargetArea, + const B2DRange& rTargetArea, const B2DVector& rOffset, - sal_uInt32 nSteps, - double fBorder, + sal_uInt32 nSteps, + double fBorder, double fAngle) { initEllipticalGradientInfo(o_rGradientInfo, - rTargetArea, + rTargetArea, rOffset, nSteps, - fBorder, + fBorder, fAngle, false); return o_rGradientInfo; } ODFGradientInfo& createSquareODFGradientInfo(ODFGradientInfo& o_rGradientInfo, - const B2DRange& rTargetArea, + const B2DRange& rTargetArea, const B2DVector& rOffset, - sal_uInt32 nSteps, - double fBorder, + sal_uInt32 nSteps, + double fBorder, double fAngle) { initRectGradientInfo(o_rGradientInfo, - rTargetArea, + rTargetArea, rOffset, nSteps, - fBorder, + fBorder, fAngle); return o_rGradientInfo; } ODFGradientInfo& createRectangularODFGradientInfo(ODFGradientInfo& o_rGradientInfo, - const B2DRange& rTargetArea, + const B2DRange& rTargetArea, const B2DVector& rOffset, - sal_uInt32 nSteps, - double fBorder, + sal_uInt32 nSteps, + double fBorder, double fAngle) { initRectGradientInfo(o_rGradientInfo, - rTargetArea, + rTargetArea, rOffset, nSteps, - fBorder, + fBorder, fAngle); return o_rGradientInfo; } - + } // namespace tools } // namespace basegfx diff --git a/basegfx/source/tools/keystoplerp.cxx b/basegfx/source/tools/keystoplerp.cxx index c5af3827ea13..7f8dcd70abc2 100644 --- a/basegfx/source/tools/keystoplerp.cxx +++ b/basegfx/source/tools/keystoplerp.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -41,14 +41,14 @@ static void validateInput(const std::vector<double>& rKeyStops) { (void)rKeyStops; #ifdef DBG_UTIL - OSL_ENSURE( rKeyStops.size() > 1, + OSL_ENSURE( rKeyStops.size() > 1, "KeyStopLerp::KeyStopLerp(): key stop vector must have two entries or more" ); - + // rKeyStops must be sorted in ascending order for( ::std::size_t i=1, len=rKeyStops.size(); i<len; ++i ) { if( rKeyStops[i-1] > rKeyStops[i] ) - OSL_ENSURE( false, + OSL_ENSURE( false, "KeyStopLerp::KeyStopLerp(): time vector is not sorted in ascending order!" ); } #endif @@ -67,10 +67,10 @@ namespace basegfx KeyStopLerp::KeyStopLerp( const ::com::sun::star::uno::Sequence<double>& rKeyStops ) : maKeyStops(rKeyStops.getLength()), - mnLastIndex(0) + mnLastIndex(0) { - std::copy( rKeyStops.getConstArray(), - rKeyStops.getConstArray()+rKeyStops.getLength(), + std::copy( rKeyStops.getConstArray(), + rKeyStops.getConstArray()+rKeyStops.getLength(), maKeyStops.begin() ); validateInput(maKeyStops); } @@ -82,7 +82,7 @@ namespace basegfx maKeyStops.at(mnLastIndex+1) >= fAlpha ) { // nope, find new index - mnLastIndex = std::min<std::ptrdiff_t>( + mnLastIndex = std::min<std::ptrdiff_t>( maKeyStops.size()-2, // range is ensured by max below std::max<std::ptrdiff_t>( @@ -95,7 +95,7 @@ namespace basegfx // lerp between stop and stop+1 const double fRawLerp= - (fAlpha-maKeyStops.at(mnLastIndex)) / + (fAlpha-maKeyStops.at(mnLastIndex)) / (maKeyStops.at(mnLastIndex+1) - maKeyStops.at(mnLastIndex)); // clamp to permissible range (input fAlpha might be diff --git a/basegfx/source/tools/liangbarsky.cxx b/basegfx/source/tools/liangbarsky.cxx index a50dd1ccacdf..5c1d25918ed5 100644 --- a/basegfx/source/tools/liangbarsky.cxx +++ b/basegfx/source/tools/liangbarsky.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,7 +42,7 @@ namespace basegfx { // see Foley/vanDam, pp. 122 for the Liang-Barsky line // clipping algorithm - inline bool liangBarskyClipT( double nDenom, + inline bool liangBarskyClipT( double nDenom, double nNumerator, double& io_rTE, double& io_rTL ) @@ -55,7 +55,7 @@ namespace basegfx return false; else if( t > io_rTE ) io_rTE = t; - } + } else if( nDenom < 0 ) { t = nNumerator / nDenom; @@ -75,9 +75,9 @@ namespace basegfx // see Foley/vanDam, pp. 122 for the Liang-Barsky line // clipping algorithm - bool liangBarskyClip2D( ::basegfx::B2DPoint& io_rStart, - ::basegfx::B2DPoint& io_rEnd, - const ::basegfx::B2DRange& rClipRect ) + bool liangBarskyClip2D( ::basegfx::B2DPoint& io_rStart, + ::basegfx::B2DPoint& io_rEnd, + const ::basegfx::B2DRange& rClipRect ) { const double nDX( io_rEnd.getX() - io_rStart.getX() ); const double nDY( io_rEnd.getY() - io_rStart.getY() ); @@ -92,16 +92,16 @@ namespace basegfx double nTE( 0.0 ); double nTL( 1.0 ); if( liangBarskyClipT(nDX, rClipRect.getMinX() - io_rStart.getX(), - nTE, nTL ) ) // inside wrt. left edge + nTE, nTL ) ) // inside wrt. left edge { if( liangBarskyClipT(-nDX, io_rStart.getX() - rClipRect.getMaxX(), - nTE, nTL ) ) // inside wrt. right edge + nTE, nTL ) ) // inside wrt. right edge { if( liangBarskyClipT(nDY, rClipRect.getMinY() - io_rStart.getY(), - nTE, nTL ) ) // inside wrt. bottom edge + nTE, nTL ) ) // inside wrt. bottom edge { if( liangBarskyClipT(-nDY, io_rStart.getY() - rClipRect.getMaxY(), - nTE, nTL ) ) // inside wrt. top edge + nTE, nTL ) ) // inside wrt. top edge { // compute actual intersection points, // if nTL has changed diff --git a/basegfx/source/tools/tools.cxx b/basegfx/source/tools/tools.cxx index 1ddb9d4d23b5..d7bdbccbe372 100644 --- a/basegfx/source/tools/tools.cxx +++ b/basegfx/source/tools/tools.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -41,18 +41,18 @@ namespace basegfx { namespace { - inline double distance( const double& nX, - const double& nY, - const ::basegfx::B2DVector& rNormal, - const double& nC ) + inline double distance( const double& nX, + const double& nY, + const ::basegfx::B2DVector& rNormal, + const double& nC ) { return nX*rNormal.getX() + nY*rNormal.getY() - nC; } - void moveLineOutsideRect( ::basegfx::B2DPoint& io_rStart, - ::basegfx::B2DPoint& io_rEnd, - const ::basegfx::B2DVector& rMoveDirection, - const ::basegfx::B2DRange& rFitTarget ) + void moveLineOutsideRect( ::basegfx::B2DPoint& io_rStart, + ::basegfx::B2DPoint& io_rEnd, + const ::basegfx::B2DVector& rMoveDirection, + const ::basegfx::B2DRange& rFitTarget ) { // calc c for normal line form equation n x - c = 0 const double nC( rMoveDirection.scalar( io_rStart ) ); @@ -61,17 +61,17 @@ namespace basegfx // rect corners to the line const double nMaxDistance( ::std::max( 0.0, - ::std::max( + ::std::max( distance(rFitTarget.getMinX(), rFitTarget.getMinY(), rMoveDirection, nC), - ::std::max( + ::std::max( distance(rFitTarget.getMinX(), rFitTarget.getMaxY(), rMoveDirection, nC), - ::std::max( + ::std::max( distance(rFitTarget.getMaxX(), rFitTarget.getMinY(), rMoveDirection, @@ -89,11 +89,11 @@ namespace basegfx } } - void infiniteLineFromParallelogram( ::basegfx::B2DPoint& io_rLeftTop, - ::basegfx::B2DPoint& io_rLeftBottom, - ::basegfx::B2DPoint& io_rRightTop, - ::basegfx::B2DPoint& io_rRightBottom, - const ::basegfx::B2DRange& rFitTarget ) + void infiniteLineFromParallelogram( ::basegfx::B2DPoint& io_rLeftTop, + ::basegfx::B2DPoint& io_rLeftBottom, + ::basegfx::B2DPoint& io_rRightTop, + ::basegfx::B2DPoint& io_rRightBottom, + const ::basegfx::B2DRange& rFitTarget ) { // For the top and bottom border line of the // parallelogram, we determine the distance to all four @@ -115,7 +115,7 @@ namespace basegfx const ::basegfx::B2DVector aNormalTop( aDirectionVertical ); const ::basegfx::B2DVector aNormalBottom( -aDirectionVertical ); - + // now extend parallelogram, such that the bound rect // point are included moveLineOutsideRect( io_rLeftTop, io_rRightTop, aNormalTop, rFitTarget ); diff --git a/basegfx/source/tools/unopolypolygon.cxx b/basegfx/source/tools/unopolypolygon.cxx index e20623c14233..e4105925445a 100644 --- a/basegfx/source/tools/unopolypolygon.cxx +++ b/basegfx/source/tools/unopolypolygon.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -62,8 +62,8 @@ namespace unotools } void SAL_CALL UnoPolyPolygon::addPolyPolygon( - const geometry::RealPoint2D& position, - const uno::Reference< rendering::XPolyPolygon2D >& polyPolygon ) throw (lang::IllegalArgumentException,uno::RuntimeException) + const geometry::RealPoint2D& position, + const uno::Reference< rendering::XPolyPolygon2D >& polyPolygon ) throw (lang::IllegalArgumentException,uno::RuntimeException) { osl::MutexGuard const guard( m_aMutex ); modifying(); @@ -116,7 +116,7 @@ namespace unotools // found - contract violation. if( !xLinePoly.is() ) throw lang::IllegalArgumentException( - ::rtl::OUString( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UnoPolyPolygon::addPolyPolygon(): Invalid input " "poly-polygon, cannot retrieve vertex data")), @@ -130,8 +130,8 @@ namespace unotools } } - const B2DRange aBounds( tools::getRange( aSrcPoly ) ); - const B2DVector aOffset( unotools::b2DPointFromRealPoint2D( position ) - + const B2DRange aBounds( tools::getRange( aSrcPoly ) ); + const B2DVector aOffset( unotools::b2DPointFromRealPoint2D( position ) - aBounds.getMinimum() ); if( !aOffset.equalZero() ) @@ -145,14 +145,14 @@ namespace unotools sal_Int32 SAL_CALL UnoPolyPolygon::getNumberOfPolygons() throw (uno::RuntimeException) { - osl::MutexGuard const guard( m_aMutex ); + osl::MutexGuard const guard( m_aMutex ); return maPolyPoly.count(); } - sal_Int32 SAL_CALL UnoPolyPolygon::getNumberOfPolygonPoints( + sal_Int32 SAL_CALL UnoPolyPolygon::getNumberOfPolygonPoints( sal_Int32 polygon ) throw (lang::IndexOutOfBoundsException,uno::RuntimeException) { - osl::MutexGuard const guard( m_aMutex ); + osl::MutexGuard const guard( m_aMutex ); checkIndex( polygon ); return maPolyPoly.getB2DPolygon(polygon).count(); @@ -160,35 +160,35 @@ namespace unotools rendering::FillRule SAL_CALL UnoPolyPolygon::getFillRule() throw (uno::RuntimeException) { - osl::MutexGuard const guard( m_aMutex ); + osl::MutexGuard const guard( m_aMutex ); return meFillRule; } - void SAL_CALL UnoPolyPolygon::setFillRule( + void SAL_CALL UnoPolyPolygon::setFillRule( rendering::FillRule fillRule ) throw (uno::RuntimeException) { - osl::MutexGuard const guard( m_aMutex ); + osl::MutexGuard const guard( m_aMutex ); modifying(); meFillRule = fillRule; } - sal_Bool SAL_CALL UnoPolyPolygon::isClosed( + sal_Bool SAL_CALL UnoPolyPolygon::isClosed( sal_Int32 index ) throw (lang::IndexOutOfBoundsException,uno::RuntimeException) { - osl::MutexGuard const guard( m_aMutex ); + osl::MutexGuard const guard( m_aMutex ); checkIndex( index ); return maPolyPoly.getB2DPolygon(index).isClosed(); } void SAL_CALL UnoPolyPolygon::setClosed( - sal_Int32 index, + sal_Int32 index, sal_Bool closedState ) throw (lang::IndexOutOfBoundsException,uno::RuntimeException) { osl::MutexGuard const guard( m_aMutex ); modifying(); - + if( index == -1L ) { // set all @@ -208,28 +208,28 @@ namespace unotools } uno::Sequence< uno::Sequence< geometry::RealPoint2D > > SAL_CALL UnoPolyPolygon::getPoints( - sal_Int32 nPolygonIndex, - sal_Int32 nNumberOfPolygons, - sal_Int32 nPointIndex, + sal_Int32 nPolygonIndex, + sal_Int32 nNumberOfPolygons, + sal_Int32 nPointIndex, sal_Int32 nNumberOfPoints ) throw (lang::IndexOutOfBoundsException,uno::RuntimeException) { osl::MutexGuard const guard( m_aMutex ); - - return unotools::pointSequenceSequenceFromB2DPolyPolygon( + + return unotools::pointSequenceSequenceFromB2DPolyPolygon( getSubsetPolyPolygon( nPolygonIndex, nNumberOfPolygons, nPointIndex, nNumberOfPoints ) ); } - void SAL_CALL UnoPolyPolygon::setPoints( - const uno::Sequence< uno::Sequence< geometry::RealPoint2D > >& points, + void SAL_CALL UnoPolyPolygon::setPoints( + const uno::Sequence< uno::Sequence< geometry::RealPoint2D > >& points, sal_Int32 nPolygonIndex ) throw (lang::IndexOutOfBoundsException,uno::RuntimeException) { osl::MutexGuard const guard( m_aMutex ); modifying(); - - const B2DPolyPolygon& rNewPolyPoly( + + const B2DPolyPolygon& rNewPolyPoly( unotools::polyPolygonFromPoint2DSequenceSequence( points ) ); if( nPolygonIndex == -1 ) @@ -244,11 +244,11 @@ namespace unotools } } - geometry::RealPoint2D SAL_CALL UnoPolyPolygon::getPoint( - sal_Int32 nPolygonIndex, + geometry::RealPoint2D SAL_CALL UnoPolyPolygon::getPoint( + sal_Int32 nPolygonIndex, sal_Int32 nPointIndex ) throw (lang::IndexOutOfBoundsException,uno::RuntimeException) { - osl::MutexGuard const guard( m_aMutex ); + osl::MutexGuard const guard( m_aMutex ); checkIndex( nPolygonIndex ); const B2DPolygon& rPoly( maPolyPoly.getB2DPolygon( nPolygonIndex ) ); @@ -259,12 +259,12 @@ namespace unotools return unotools::point2DFromB2DPoint( rPoly.getB2DPoint( nPointIndex ) ); } - void SAL_CALL UnoPolyPolygon::setPoint( - const geometry::RealPoint2D& point, - sal_Int32 nPolygonIndex, + void SAL_CALL UnoPolyPolygon::setPoint( + const geometry::RealPoint2D& point, + sal_Int32 nPolygonIndex, sal_Int32 nPointIndex ) throw (lang::IndexOutOfBoundsException,uno::RuntimeException) { - osl::MutexGuard const guard( m_aMutex ); + osl::MutexGuard const guard( m_aMutex ); checkIndex( nPolygonIndex ); modifying(); @@ -278,28 +278,28 @@ namespace unotools maPolyPoly.setB2DPolygon( nPolygonIndex, aPoly ); } - uno::Sequence< uno::Sequence< geometry::RealBezierSegment2D > > SAL_CALL UnoPolyPolygon::getBezierSegments( + uno::Sequence< uno::Sequence< geometry::RealBezierSegment2D > > SAL_CALL UnoPolyPolygon::getBezierSegments( sal_Int32 nPolygonIndex, - sal_Int32 nNumberOfPolygons, - sal_Int32 nPointIndex, + sal_Int32 nNumberOfPolygons, + sal_Int32 nPointIndex, sal_Int32 nNumberOfPoints ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { - osl::MutexGuard const guard( m_aMutex ); - return unotools::bezierSequenceSequenceFromB2DPolyPolygon( + osl::MutexGuard const guard( m_aMutex ); + return unotools::bezierSequenceSequenceFromB2DPolyPolygon( getSubsetPolyPolygon( nPolygonIndex, nNumberOfPolygons, nPointIndex, nNumberOfPoints ) ); } - void SAL_CALL UnoPolyPolygon::setBezierSegments( - const uno::Sequence< uno::Sequence< geometry::RealBezierSegment2D > >& points, - sal_Int32 nPolygonIndex ) throw (lang::IndexOutOfBoundsException, + void SAL_CALL UnoPolyPolygon::setBezierSegments( + const uno::Sequence< uno::Sequence< geometry::RealBezierSegment2D > >& points, + sal_Int32 nPolygonIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { - osl::MutexGuard const guard( m_aMutex ); + osl::MutexGuard const guard( m_aMutex ); modifying(); - const B2DPolyPolygon& rNewPolyPoly( + const B2DPolyPolygon& rNewPolyPoly( unotools::polyPolygonFromBezier2DSequenceSequence( points ) ); if( nPolygonIndex == -1 ) @@ -314,11 +314,11 @@ namespace unotools } } - geometry::RealBezierSegment2D SAL_CALL UnoPolyPolygon::getBezierSegment( sal_Int32 nPolygonIndex, - sal_Int32 nPointIndex ) throw (lang::IndexOutOfBoundsException, + geometry::RealBezierSegment2D SAL_CALL UnoPolyPolygon::getBezierSegment( sal_Int32 nPolygonIndex, + sal_Int32 nPointIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { - osl::MutexGuard const guard( m_aMutex ); + osl::MutexGuard const guard( m_aMutex ); checkIndex( nPolygonIndex ); const B2DPolygon& rPoly( maPolyPoly.getB2DPolygon( nPolygonIndex ) ); @@ -339,12 +339,12 @@ namespace unotools rCtrl1.getY() ); } - void SAL_CALL UnoPolyPolygon::setBezierSegment( const geometry::RealBezierSegment2D& segment, - sal_Int32 nPolygonIndex, - sal_Int32 nPointIndex ) throw (lang::IndexOutOfBoundsException, + void SAL_CALL UnoPolyPolygon::setBezierSegment( const geometry::RealBezierSegment2D& segment, + sal_Int32 nPolygonIndex, + sal_Int32 nPointIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { - osl::MutexGuard const guard( m_aMutex ); + osl::MutexGuard const guard( m_aMutex ); checkIndex( nPolygonIndex ); modifying(); @@ -357,27 +357,27 @@ namespace unotools aPoly.setB2DPoint( nPointIndex, B2DPoint( segment.Px, segment.Py ) ); - aPoly.setNextControlPoint(nPointIndex, + aPoly.setNextControlPoint(nPointIndex, B2DPoint(segment.C1x, segment.C1y)); - aPoly.setPrevControlPoint((nPointIndex + 1) % nPointCount, + aPoly.setPrevControlPoint((nPointIndex + 1) % nPointCount, B2DPoint(segment.C2x, segment.C2y)); maPolyPoly.setB2DPolygon( nPolygonIndex, aPoly ); } B2DPolyPolygon UnoPolyPolygon::getSubsetPolyPolygon( - sal_Int32 nPolygonIndex, - sal_Int32 nNumberOfPolygons, - sal_Int32 nPointIndex, + sal_Int32 nPolygonIndex, + sal_Int32 nNumberOfPolygons, + sal_Int32 nPointIndex, sal_Int32 nNumberOfPoints ) const { - osl::MutexGuard const guard( m_aMutex ); + osl::MutexGuard const guard( m_aMutex ); checkIndex( nPolygonIndex ); const sal_Int32 nPolyCount( maPolyPoly.count() ); // check for "full polygon" case - if( !nPolygonIndex && + if( !nPolygonIndex && !nPointIndex && nNumberOfPolygons == nPolyCount && nNumberOfPoints == -1 ) @@ -410,7 +410,7 @@ namespace unotools nFirstPoint = nPointIndex; } - + if( i==nNumberOfPolygons-1 && nNumberOfPoints != -1 ) { // very last polygon - respect nNumberOfPoints @@ -444,7 +444,7 @@ namespace unotools aSubsetPoly.append( aTmp ); } } - + return aSubsetPoly; } @@ -469,7 +469,7 @@ namespace unotools { uno::Sequence< ::rtl::OUString > aRet(1); aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) ); - + return aRet; } diff --git a/basegfx/source/tuple/b2dtuple.cxx b/basegfx/source/tuple/b2dtuple.cxx index b9ecd40f0eff..1a227fb77833 100644 --- a/basegfx/source/tuple/b2dtuple.cxx +++ b/basegfx/source/tuple/b2dtuple.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,9 +42,9 @@ namespace basegfx return EmptyTuple::get(); } - B2DTuple::B2DTuple(const B2ITuple& rTup) - : mfX( rTup.getX() ), - mfY( rTup.getY() ) + B2DTuple::B2DTuple(const B2ITuple& rTup) + : mfX( rTup.getX() ), + mfY( rTup.getY() ) {} void B2DTuple::correctValues(const double fCompareValue) diff --git a/basegfx/source/tuple/b2i64tuple.cxx b/basegfx/source/tuple/b2i64tuple.cxx index 2caf873aab45..a1dfbcfae408 100644 --- a/basegfx/source/tuple/b2i64tuple.cxx +++ b/basegfx/source/tuple/b2i64tuple.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/basegfx/source/tuple/b2ituple.cxx b/basegfx/source/tuple/b2ituple.cxx index ac780d59eb58..27d5dd0090f3 100644 --- a/basegfx/source/tuple/b2ituple.cxx +++ b/basegfx/source/tuple/b2ituple.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -44,109 +44,109 @@ namespace basegfx // external operators ////////////////////////////////////////////////////////////////////////// - B2ITuple minimum(const B2ITuple& rTupA, const B2ITuple& rTupB) - { + B2ITuple minimum(const B2ITuple& rTupA, const B2ITuple& rTupB) + { B2ITuple aMin( (rTupB.getX() < rTupA.getX()) ? rTupB.getX() : rTupA.getX(), - (rTupB.getY() < rTupA.getY()) ? rTupB.getY() : rTupA.getY()); + (rTupB.getY() < rTupA.getY()) ? rTupB.getY() : rTupA.getY()); return aMin; } - B2ITuple maximum(const B2ITuple& rTupA, const B2ITuple& rTupB) - { + B2ITuple maximum(const B2ITuple& rTupA, const B2ITuple& rTupB) + { B2ITuple aMax( (rTupB.getX() > rTupA.getX()) ? rTupB.getX() : rTupA.getX(), - (rTupB.getY() > rTupA.getY()) ? rTupB.getY() : rTupA.getY()); + (rTupB.getY() > rTupA.getY()) ? rTupB.getY() : rTupA.getY()); return aMax; } - B2ITuple absolute(const B2ITuple& rTup) - { + B2ITuple absolute(const B2ITuple& rTup) + { B2ITuple aAbs( (0 > rTup.getX()) ? -rTup.getX() : rTup.getX(), - (0 > rTup.getY()) ? -rTup.getY() : rTup.getY()); + (0 > rTup.getY()) ? -rTup.getY() : rTup.getY()); return aAbs; } - B2DTuple interpolate(const B2ITuple& rOld1, const B2ITuple& rOld2, double t) - { + B2DTuple interpolate(const B2ITuple& rOld1, const B2ITuple& rOld2, double t) + { B2DTuple aInt( ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(), - ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY()); + ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY()); return aInt; } - B2DTuple average(const B2ITuple& rOld1, const B2ITuple& rOld2) - { + B2DTuple average(const B2ITuple& rOld1, const B2ITuple& rOld2) + { B2DTuple aAvg( (rOld1.getX() + rOld2.getX()) * 0.5, - (rOld1.getY() + rOld2.getY()) * 0.5); + (rOld1.getY() + rOld2.getY()) * 0.5); return aAvg; } - + B2DTuple average(const B2ITuple& rOld1, const B2ITuple& rOld2, const B2ITuple& rOld3) - { + { B2DTuple aAvg( (rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0), - (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0)); + (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0)); return aAvg; } B2ITuple operator+(const B2ITuple& rTupA, const B2ITuple& rTupB) - { - B2ITuple aSum(rTupA); - aSum += rTupB; - return aSum; + { + B2ITuple aSum(rTupA); + aSum += rTupB; + return aSum; } B2ITuple operator-(const B2ITuple& rTupA, const B2ITuple& rTupB) - { - B2ITuple aSub(rTupA); - aSub -= rTupB; - return aSub; + { + B2ITuple aSub(rTupA); + aSub -= rTupB; + return aSub; } B2ITuple operator/(const B2ITuple& rTupA, const B2ITuple& rTupB) - { - B2ITuple aDiv(rTupA); - aDiv /= rTupB; - return aDiv; + { + B2ITuple aDiv(rTupA); + aDiv /= rTupB; + return aDiv; } B2ITuple operator*(const B2ITuple& rTupA, const B2ITuple& rTupB) - { - B2ITuple aMul(rTupA); - aMul *= rTupB; - return aMul; + { + B2ITuple aMul(rTupA); + aMul *= rTupB; + return aMul; } B2ITuple operator*(const B2ITuple& rTup, sal_Int32 t) - { - B2ITuple aNew(rTup); - aNew *= t; - return aNew; + { + B2ITuple aNew(rTup); + aNew *= t; + return aNew; } B2ITuple operator*(sal_Int32 t, const B2ITuple& rTup) - { - B2ITuple aNew(rTup); - aNew *= t; - return aNew; + { + B2ITuple aNew(rTup); + aNew *= t; + return aNew; } B2ITuple operator/(const B2ITuple& rTup, sal_Int32 t) - { - B2ITuple aNew(rTup); - aNew /= t; - return aNew; + { + B2ITuple aNew(rTup); + aNew /= t; + return aNew; } B2ITuple operator/(sal_Int32 t, const B2ITuple& rTup) { - B2ITuple aNew(t, t); - B2ITuple aTmp(rTup); - aNew /= aTmp; - return aNew; + B2ITuple aNew(t, t); + B2ITuple aTmp(rTup); + aNew /= aTmp; + return aNew; } } // end of namespace basegfx diff --git a/basegfx/source/tuple/b3dtuple.cxx b/basegfx/source/tuple/b3dtuple.cxx index c825adb3ac09..fa505b1eede1 100644 --- a/basegfx/source/tuple/b3dtuple.cxx +++ b/basegfx/source/tuple/b3dtuple.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -41,10 +41,10 @@ namespace basegfx return EmptyTuple::get(); } - B3DTuple::B3DTuple(const B3ITuple& rTup) - : mfX( rTup.getX() ), + B3DTuple::B3DTuple(const B3ITuple& rTup) + : mfX( rTup.getX() ), mfY( rTup.getY() ), - mfZ( rTup.getZ() ) + mfZ( rTup.getZ() ) {} B3ITuple fround(const B3DTuple& rTup) diff --git a/basegfx/source/tuple/b3i64tuple.cxx b/basegfx/source/tuple/b3i64tuple.cxx index 7d7ccac28aea..e133a3fc8892 100644 --- a/basegfx/source/tuple/b3i64tuple.cxx +++ b/basegfx/source/tuple/b3i64tuple.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/basegfx/source/tuple/b3ituple.cxx b/basegfx/source/tuple/b3ituple.cxx index b78aa8938e49..ed022a4678fd 100644 --- a/basegfx/source/tuple/b3ituple.cxx +++ b/basegfx/source/tuple/b3ituple.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/basegfx/source/vector/b2dvector.cxx b/basegfx/source/vector/b2dvector.cxx index ad11f717fa2d..df8a1c02fbdb 100644 --- a/basegfx/source/vector/b2dvector.cxx +++ b/basegfx/source/vector/b2dvector.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -62,16 +62,16 @@ namespace basegfx return *this; } - B2DVector& B2DVector::operator=( const B2DTuple& rVec ) - { + B2DVector& B2DVector::operator=( const B2DTuple& rVec ) + { mfX = rVec.getX(); - mfY = rVec.getY(); - return *this; + mfY = rVec.getY(); + return *this; } - double B2DVector::getLength() const - { + double B2DVector::getLength() const + { if(fTools::equalZero(mfX)) { return fabs(mfY); @@ -81,17 +81,17 @@ namespace basegfx return fabs(mfX); } - return hypot( mfX, mfY ); + return hypot( mfX, mfY ); } - double B2DVector::scalar( const B2DVector& rVec ) const - { - return((mfX * rVec.mfX) + (mfY * rVec.mfY)); + double B2DVector::scalar( const B2DVector& rVec ) const + { + return((mfX * rVec.mfX) + (mfY * rVec.mfY)); } - double B2DVector::cross( const B2DVector& rVec ) const - { - return(mfX * rVec.getY() - mfY * rVec.getX()); + double B2DVector::cross( const B2DVector& rVec ) const + { + return(mfX * rVec.getY() - mfY * rVec.getX()); } double B2DVector::angle( const B2DVector& rVec ) const @@ -154,7 +154,7 @@ namespace basegfx } B2VectorOrientation getOrientation( const B2DVector& rVecA, const B2DVector& rVecB ) - { + { double fVal(rVecA.getX() * rVecB.getY() - rVecA.getY() * rVecB.getX()); if(fTools::equalZero(fVal)) diff --git a/basegfx/source/vector/b2ivector.cxx b/basegfx/source/vector/b2ivector.cxx index 744bf8cf2ca0..7b6c0effb6ec 100644 --- a/basegfx/source/vector/b2ivector.cxx +++ b/basegfx/source/vector/b2ivector.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/basegfx/source/vector/b3dvector.cxx b/basegfx/source/vector/b3dvector.cxx index 67a7ef1d2215..4ced9d2ec941 100644 --- a/basegfx/source/vector/b3dvector.cxx +++ b/basegfx/source/vector/b3dvector.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -66,7 +66,7 @@ namespace basegfx aNew.normalize(); return aNew; } - + B3DVector B3DVector::getProjectionOnPlane(const B3DVector& rNormalizedPlane) const { B3DVector aNew(*this); @@ -74,8 +74,8 @@ namespace basegfx aNew = cross(aNew, rNormalizedPlane); aNew.mfX = mfX - aNew.mfX; - aNew.mfY = mfY - aNew.mfY; - aNew.mfZ = mfZ - aNew.mfZ; + aNew.mfY = mfY - aNew.mfY; + aNew.mfZ = mfZ - aNew.mfZ; return aNew; } diff --git a/basegfx/source/vector/b3ivector.cxx b/basegfx/source/vector/b3ivector.cxx index 2966a11c6921..f0dc7a2b64ec 100644 --- a/basegfx/source/vector/b3ivector.cxx +++ b/basegfx/source/vector/b3ivector.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/basegfx/source/workbench/bezierclip.cxx b/basegfx/source/workbench/bezierclip.cxx index 5aaea7c63efa..0d0717668c9d 100644 --- a/basegfx/source/workbench/bezierclip.cxx +++ b/basegfx/source/workbench/bezierclip.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -59,7 +59,7 @@ // ----------------------------------------------------------------------------- -/* Implementation of the so-called 'Fat-Line Bezier Clipping Algorithm' by Sederberg et al. +/* Implementation of the so-called 'Fat-Line Bezier Clipping Algorithm' by Sederberg et al. * * Actual reference is: T. W. Sederberg and T Nishita: Curve * intersection using Bezier clipping. In Computer Aided Design, 22 @@ -143,9 +143,9 @@ void Impl_calcFatLine( FatLine& line, const Bezier& c ) } } -void Impl_calcBounds( Point2D& leftTop, - Point2D& rightBottom, - const Bezier& c1 ) +void Impl_calcBounds( Point2D& leftTop, + Point2D& rightBottom, + const Bezier& c1 ) { leftTop.x = ::std::min( c1.p0.x, ::std::min( c1.p1.x, ::std::min( c1.p2.x, c1.p3.x ) ) ); leftTop.y = ::std::min( c1.p0.y, ::std::min( c1.p1.y, ::std::min( c1.p2.y, c1.p3.y ) ) ); @@ -181,11 +181,11 @@ bool Impl_doBBoxIntersect( const Bezier& c1, * the left, the second is the intersection of the max value line with * the convex hull from the right. */ -bool Impl_calcSafeParams( double& t1, - double& t2, - const Polygon2D& rPoly, - double lowerYBound, - double upperYBound ) +bool Impl_calcSafeParams( double& t1, + double& t2, + const Polygon2D& rPoly, + double lowerYBound, + double upperYBound ) { // need the convex hull of the control polygon, as this is // guaranteed to completely bound the curve @@ -194,7 +194,7 @@ bool Impl_calcSafeParams( double& t1, // init min and max buffers t1 = 0.0 ; double currLowerT( 1.0 ); - + t2 = 1.0; double currHigherT( 0.0 ); @@ -237,7 +237,7 @@ bool Impl_calcSafeParams( double& t1, // one of the horizontal bounds lines const double r_x( p1.x - p0.x ); const double r_y( p1.y - p0.y ); - + if( tolZero(r_y) ) { // r_y is virtually zero, thus we've got a horizontal @@ -258,7 +258,7 @@ bool Impl_calcSafeParams( double& t1, // calc intersection with horizontal dMin line const double currTLow( (lowerYBound - p0.y) * r_x / r_y + p0.x ); - + // calc intersection with horizontal dMax line const double currTHigh( (upperYBound - p0.y) * r_x / r_y + p0.x ); @@ -269,7 +269,7 @@ bool Impl_calcSafeParams( double& t1, // set flag that at least one segment is contained or // intersects given horizontal band. bIntersection = true; - } + } } #ifndef WITH_SAFEPARAMBASE_TEST @@ -290,20 +290,20 @@ bool Impl_calcSafeParams( double& t1, * The polynomial coefficients c0 to c3 given to this method * must correspond to t values of 0, 1/3, 2/3 and 1, respectively. */ -bool Impl_calcSafeParams_clip( double& t1, - double& t2, - const FatLine& bounds, - double c0, - double c1, - double c2, - double c3 ) +bool Impl_calcSafeParams_clip( double& t1, + double& t2, + const FatLine& bounds, + double c0, + double c1, + double c2, + double c3 ) { /* first of all, determine convex hull of c0-c3 */ Polygon2D poly(4); - poly[0] = Point2D(0, c0); - poly[1] = Point2D(1.0/3.0, c1); - poly[2] = Point2D(2.0/3.0, c2); - poly[3] = Point2D(1, c3); + poly[0] = Point2D(0, c0); + poly[1] = Point2D(1.0/3.0, c1); + poly[2] = Point2D(2.0/3.0, c2); + poly[3] = Point2D(1, c3); #ifndef WITH_SAFEPARAM_DETAILED_TEST @@ -314,14 +314,14 @@ bool Impl_calcSafeParams_clip( double& t1, Polygon2D convHull( convexHull( poly ) ); - cout << "# convex hull testing" << endl + cout << "# convex hull testing" << endl << "plot [t=0:1] "; - cout << " bez(" - << poly[0].x << "," + cout << " bez(" + << poly[0].x << "," << poly[1].x << "," << poly[2].x << "," << poly[3].x << ",t),bez(" - << poly[0].y << "," + << poly[0].y << "," << poly[1].y << "," << poly[2].y << "," << poly[3].y << ",t), " @@ -353,10 +353,10 @@ bool Impl_calcSafeParams_clip( double& t1, // ----------------------------------------------------------------------------- -void Impl_deCasteljauAt( Bezier& part1, - Bezier& part2, - const Bezier& input, - double t ) +void Impl_deCasteljauAt( Bezier& part1, + Bezier& part2, + const Bezier& input, + double t ) { // deCasteljau bezier arc, scheme is: // @@ -388,26 +388,26 @@ void Impl_deCasteljauAt( Bezier& part1, } else { - part1.p0.x = input.p0.x; part1.p0.y = input.p0.y; - part1.p1.x = (1.0 - t)*part1.p0.x + t*input.p1.x; part1.p1.y = (1.0 - t)*part1.p0.y + t*input.p1.y; - const double Hx ( (1.0 - t)*input.p1.x + t*input.p2.x ), Hy ( (1.0 - t)*input.p1.y + t*input.p2.y ); - part1.p2.x = (1.0 - t)*part1.p1.x + t*Hx; part1.p2.y = (1.0 - t)*part1.p1.y + t*Hy; - part2.p3.x = input.p3.x; part2.p3.y = input.p3.y; - part2.p2.x = (1.0 - t)*input.p2.x + t*input.p3.x; part2.p2.y = (1.0 - t)*input.p2.y + t*input.p3.y; - part2.p1.x = (1.0 - t)*Hx + t*part2.p2.x; part2.p1.y = (1.0 - t)*Hy + t*part2.p2.y; - part2.p0.x = (1.0 - t)*part1.p2.x + t*part2.p1.x; part2.p0.y = (1.0 - t)*part1.p2.y + t*part2.p1.y; - part1.p3.x = part2.p0.x; part1.p3.y = part2.p0.y; + part1.p0.x = input.p0.x; part1.p0.y = input.p0.y; + part1.p1.x = (1.0 - t)*part1.p0.x + t*input.p1.x; part1.p1.y = (1.0 - t)*part1.p0.y + t*input.p1.y; + const double Hx ( (1.0 - t)*input.p1.x + t*input.p2.x ), Hy ( (1.0 - t)*input.p1.y + t*input.p2.y ); + part1.p2.x = (1.0 - t)*part1.p1.x + t*Hx; part1.p2.y = (1.0 - t)*part1.p1.y + t*Hy; + part2.p3.x = input.p3.x; part2.p3.y = input.p3.y; + part2.p2.x = (1.0 - t)*input.p2.x + t*input.p3.x; part2.p2.y = (1.0 - t)*input.p2.y + t*input.p3.y; + part2.p1.x = (1.0 - t)*Hx + t*part2.p2.x; part2.p1.y = (1.0 - t)*Hy + t*part2.p2.y; + part2.p0.x = (1.0 - t)*part1.p2.x + t*part2.p1.x; part2.p0.y = (1.0 - t)*part1.p2.y + t*part2.p1.y; + part1.p3.x = part2.p0.x; part1.p3.y = part2.p0.y; } } // ----------------------------------------------------------------------------- -void printCurvesWithSafeRange( const Bezier& c1, const Bezier& c2, double t1_c1, double t2_c1, +void printCurvesWithSafeRange( const Bezier& c1, const Bezier& c2, double t1_c1, double t2_c1, const Bezier& c2_part, const FatLine& bounds_c2 ) { static int offset = 0; - cout << "# safe param range testing" << endl + cout << "# safe param range testing" << endl << "plot [t=0.0:1.0] "; // clip safe ranges off c1 @@ -422,41 +422,41 @@ void printCurvesWithSafeRange( const Bezier& c1, const Bezier& c2, double t1_c1, // output remaining segment (c1_part1) - cout << "bez(" - << c1.p0.x+offset << "," + cout << "bez(" + << c1.p0.x+offset << "," << c1.p1.x+offset << "," << c1.p2.x+offset << "," << c1.p3.x+offset << ",t),bez(" - << c1.p0.y << "," + << c1.p0.y << "," << c1.p1.y << "," << c1.p2.y << "," << c1.p3.y << ",t), bez(" - << c2.p0.x+offset << "," + << c2.p0.x+offset << "," << c2.p1.x+offset << "," << c2.p2.x+offset << "," << c2.p3.x+offset << ",t),bez(" - << c2.p0.y << "," + << c2.p0.y << "," << c2.p1.y << "," << c2.p2.y << "," << c2.p3.y << ",t), " #if 1 << "bez(" - << c1_part1.p0.x+offset << "," + << c1_part1.p0.x+offset << "," << c1_part1.p1.x+offset << "," << c1_part1.p2.x+offset << "," << c1_part1.p3.x+offset << ",t),bez(" - << c1_part1.p0.y << "," + << c1_part1.p0.y << "," << c1_part1.p1.y << "," << c1_part1.p2.y << "," << c1_part1.p3.y << ",t), " #endif #if 1 << "bez(" - << c2_part.p0.x+offset << "," + << c2_part.p0.x+offset << "," << c2_part.p1.x+offset << "," << c2_part.p2.x+offset << "," << c2_part.p3.x+offset << ",t),bez(" - << c2_part.p0.y << "," + << c2_part.p0.y << "," << c2_part.p1.y << "," << c2_part.p2.y << "," << c2_part.p3.y << ",t), " @@ -464,9 +464,9 @@ void printCurvesWithSafeRange( const Bezier& c1, const Bezier& c2, double t1_c1, << "linex(" << bounds_c2.a << "," << bounds_c2.b << "," - << bounds_c2.c << ",t)+" << offset << ", liney(" - << bounds_c2.a << "," - << bounds_c2.b << "," + << bounds_c2.c << ",t)+" << offset << ", liney(" + << bounds_c2.a << "," + << bounds_c2.b << "," << bounds_c2.c << ",t) title \"fat line (center)\", linex(" << bounds_c2.a << "," << bounds_c2.b << "," @@ -480,82 +480,82 @@ void printCurvesWithSafeRange( const Bezier& c1, const Bezier& c2, double t1_c1, << bounds_c2.a << "," << bounds_c2.b << "," << bounds_c2.c-bounds_c2.dMax << ",t) title \"fat line (max) \"" << endl; - + offset += 1; } // ----------------------------------------------------------------------------- -void printResultWithFinalCurves( const Bezier& c1, const Bezier& c1_part, - const Bezier& c2, const Bezier& c2_part, +void printResultWithFinalCurves( const Bezier& c1, const Bezier& c1_part, + const Bezier& c2, const Bezier& c2_part, double t1_c1, double t2_c1 ) { static int offset = 0; - cout << "# final result" << endl + cout << "# final result" << endl << "plot [t=0.0:1.0] "; - cout << "bez(" - << c1.p0.x+offset << "," + cout << "bez(" + << c1.p0.x+offset << "," << c1.p1.x+offset << "," << c1.p2.x+offset << "," << c1.p3.x+offset << ",t),bez(" - << c1.p0.y << "," + << c1.p0.y << "," << c1.p1.y << "," << c1.p2.y << "," << c1.p3.y << ",t), bez(" - << c1_part.p0.x+offset << "," + << c1_part.p0.x+offset << "," << c1_part.p1.x+offset << "," << c1_part.p2.x+offset << "," << c1_part.p3.x+offset << ",t),bez(" - << c1_part.p0.y << "," + << c1_part.p0.y << "," << c1_part.p1.y << "," << c1_part.p2.y << "," - << c1_part.p3.y << ",t), " + << c1_part.p3.y << ",t), " << " pointmarkx(bez(" - << c1.p0.x+offset << "," + << c1.p0.x+offset << "," << c1.p1.x+offset << "," << c1.p2.x+offset << "," << c1.p3.x+offset << "," << t1_c1 << "),t), " - << " pointmarky(bez(" - << c1.p0.y << "," + << " pointmarky(bez(" + << c1.p0.y << "," << c1.p1.y << "," << c1.p2.y << "," << c1.p3.y << "," << t1_c1 << "),t), " << " pointmarkx(bez(" - << c1.p0.x+offset << "," + << c1.p0.x+offset << "," << c1.p1.x+offset << "," << c1.p2.x+offset << "," << c1.p3.x+offset << "," << t2_c1 << "),t), " - << " pointmarky(bez(" - << c1.p0.y << "," + << " pointmarky(bez(" + << c1.p0.y << "," << c1.p1.y << "," << c1.p2.y << "," << c1.p3.y << "," << t2_c1 << "),t), " << "bez(" - << c2.p0.x+offset << "," + << c2.p0.x+offset << "," << c2.p1.x+offset << "," << c2.p2.x+offset << "," << c2.p3.x+offset << ",t),bez(" - << c2.p0.y << "," + << c2.p0.y << "," << c2.p1.y << "," << c2.p2.y << "," << c2.p3.y << ",t), " << "bez(" - << c2_part.p0.x+offset << "," + << c2_part.p0.x+offset << "," << c2_part.p1.x+offset << "," << c2_part.p2.x+offset << "," << c2_part.p3.x+offset << ",t),bez(" - << c2_part.p0.y << "," + << c2_part.p0.y << "," << c2_part.p1.y << "," << c2_part.p2.y << "," << c2_part.p3.y << ",t)" << endl; - + offset += 1; } @@ -563,8 +563,8 @@ void printResultWithFinalCurves( const Bezier& c1, const Bezier& c1_part, /** determine parameter ranges [0,t1) and (t2,1] on c1, where c1 is guaranteed to lie outside c2. Returns false, if the two curves don't even intersect. - - @param t1 + + @param t1 Range [0,t1) on c1 is guaranteed to lie outside c2 @param t2 @@ -582,51 +582,51 @@ void printResultWithFinalCurves( const Bezier& c1, const Bezier& c1_part, @param c2_part Subdivided current part of c2 */ -bool Impl_calcClipRange( double& t1, - double& t2, - const Bezier& c1_orig, - const Bezier& c1_part, - const Bezier& c2_orig, - const Bezier& c2_part ) +bool Impl_calcClipRange( double& t1, + double& t2, + const Bezier& c1_orig, + const Bezier& c1_part, + const Bezier& c2_orig, + const Bezier& c2_part ) { - // TODO: Maybe also check fat line orthogonal to P0P3, having P0 + // TODO: Maybe also check fat line orthogonal to P0P3, having P0 // and P3 as the extremal points - + if( Impl_doBBoxIntersect(c1_part, c2_part) ) { // Calculate fat lines around c1 - FatLine bounds_c2; + FatLine bounds_c2; // must use the subdivided version of c2, since the fat line // algorithm works implicitely with the convex hull bounding // box. Impl_calcFatLine(bounds_c2, c2_part); - + // determine clip positions on c2. Can use original c1 (which // is necessary anyway, to get the t's on the original curve), // since the distance calculations work directly in the // Bernstein polynom parameter domain. - if( Impl_calcSafeParams_clip( t1, t2, bounds_c2, + if( Impl_calcSafeParams_clip( t1, t2, bounds_c2, calcLineDistance( bounds_c2.a, bounds_c2.b, bounds_c2.c, c1_orig.p0.x, - c1_orig.p0.y ), + c1_orig.p0.y ), calcLineDistance( bounds_c2.a, bounds_c2.b, bounds_c2.c, c1_orig.p1.x, - c1_orig.p1.y ), + c1_orig.p1.y ), calcLineDistance( bounds_c2.a, bounds_c2.b, bounds_c2.c, c1_orig.p2.x, - c1_orig.p2.y ), + c1_orig.p2.y ), calcLineDistance( bounds_c2.a, bounds_c2.b, bounds_c2.c, c1_orig.p3.x, - c1_orig.p3.y ) ) ) + c1_orig.p3.y ) ) ) { //printCurvesWithSafeRange(c1_orig, c2_orig, t1, t2, c2_part, bounds_c2); @@ -650,14 +650,14 @@ bool Impl_calcClipRange( double& t1, void Impl_calcFocus( Bezier& res, const Bezier& c ) { // arbitrary small value, for now - // TODO: find meaningful value + // TODO: find meaningful value const double minPivotValue( 1.0e-20 ); Point2D::value_type fMatrix[6]; Point2D::value_type fRes[2]; // calc new curve from hodograph, c and linear blend - + // Coefficients for derivative of c are (C_i=n(C_{i+1} - C_i)): // // 3(P1 - P0), 3(P2 - P1), 3(P3 - P2) (bezier curve of degree 2) @@ -665,7 +665,7 @@ void Impl_calcFocus( Bezier& res, const Bezier& c ) // The hodograph is then (bezier curve of 2nd degree is P0(1-t)^2 + 2P1(1-t)t + P2t^2): // // 3(P1 - P0)(1-t)^2 + 6(P2 - P1)(1-t)t + 3(P3 - P2)t^2 - // + // // rotate by 90 degrees: x=-y, y=x and you get the normal vector function N(t): // // x(t) = -(3(P1.y - P0.y)(1-t)^2 + 6(P2.y - P1.y)(1-t)t + 3(P3.y - P2.y)t^2) @@ -676,11 +676,11 @@ void Impl_calcFocus( Bezier& res, const Bezier& c ) // // This results in the following expression for F(t): // - // x(t) = P0.x (1-t)^3 + 3 P1.x (1-t)^2t + 3 P2.x (1.t)t^2 + P3.x t^3 - - // (c0(1-t) + c1 t)(3(P1.y - P0.y)(1-t)^2 + 6(P2.y - P1.y)(1-t)t + 3(P3.y - P2.y)t^2) + // x(t) = P0.x (1-t)^3 + 3 P1.x (1-t)^2t + 3 P2.x (1.t)t^2 + P3.x t^3 - + // (c0(1-t) + c1 t)(3(P1.y - P0.y)(1-t)^2 + 6(P2.y - P1.y)(1-t)t + 3(P3.y - P2.y)t^2) // - // y(t) = P0.y (1-t)^3 + 3 P1.y (1-t)^2t + 3 P2.y (1.t)t^2 + P3.y t^3 + - // (c0(1-t) + c1 t)(3(P1.x - P0.x)(1-t)^2 + 6(P2.x - P1.x)(1-t)t + 3(P3.x - P2.x)t^2) + // y(t) = P0.y (1-t)^3 + 3 P1.y (1-t)^2t + 3 P2.y (1.t)t^2 + P3.y t^3 + + // (c0(1-t) + c1 t)(3(P1.x - P0.x)(1-t)^2 + 6(P2.x - P1.x)(1-t)t + 3(P3.x - P2.x)t^2) // // As a heuristic, we set F(0)=F(1) (thus, the curve is closed and _tends_ to be small): // @@ -713,7 +713,7 @@ void Impl_calcFocus( Bezier& res, const Bezier& c ) fMatrix[4] = c.p3.y - c.p2.y; fMatrix[5] = (c.p3.x - c.p0.x)/3.0; - // TODO: determine meaningful value for + // TODO: determine meaningful value for if( !solve(fMatrix, 2, 3, fRes, minPivotValue) ) { // TODO: generate meaningful values here @@ -728,38 +728,38 @@ void Impl_calcFocus( Bezier& res, const Bezier& c ) // now, the reordered and per-coefficient collected focus curve is // the following third degree bezier curve F(t): // - // x(t) = P0.x (1-t)^3 + 3 P1.x (1-t)^2t + 3 P2.x (1.t)t^2 + P3.x t^3 - - // (c0(1-t) + c1 t)(3(P1.y - P0.y)(1-t)^2 + 6(P2.y - P1.y)(1-t)t + 3(P3.y - P2.y)t^2) - // = P0.x (1-t)^3 + 3 P1.x (1-t)^2t + 3 P2.x (1.t)t^2 + P3.x t^3 - - // (3c0P1.y(1-t)^3 - 3c0P0.y(1-t)^3 + 6c0P2.y(1-t)^2t - 6c0P1.y(1-t)^2t + - // 3c0P3.y(1-t)t^2 - 3c0P2.y(1-t)t^2 + - // 3c1P1.y(1-t)^2t - 3c1P0.y(1-t)^2t + 6c1P2.y(1-t)t^2 - 6c1P1.y(1-t)t^2 + - // 3c1P3.yt^3 - 3c1P2.yt^3) - // = (P0.x - 3 c0 P1.y + 3 c0 P0.y)(1-t)^3 + - // 3(P1.x - c1 P1.y + c1 P0.y - 2 c0 P2.y + 2 c0 P1.y)(1-t)^2t + - // 3(P2.x - 2 c1 P2.y + 2 c1 P1.y - c0 P3.y + c0 P2.y)(1-t)t^2 + - // (P3.x - 3 c1 P3.y + 3 c1 P2.y)t^3 - // = (P0.x - 3 c0(P1.y - P0.y))(1-t)^3 + - // 3(P1.x - c1(P1.y - P0.y) - 2c0(P2.y - P1.y))(1-t)^2t + - // 3(P2.x - 2 c1(P2.y - P1.y) - c0(P3.y - P2.y))(1-t)t^2 + - // (P3.x - 3 c1(P3.y - P2.y))t^3 + // x(t) = P0.x (1-t)^3 + 3 P1.x (1-t)^2t + 3 P2.x (1.t)t^2 + P3.x t^3 - + // (c0(1-t) + c1 t)(3(P1.y - P0.y)(1-t)^2 + 6(P2.y - P1.y)(1-t)t + 3(P3.y - P2.y)t^2) + // = P0.x (1-t)^3 + 3 P1.x (1-t)^2t + 3 P2.x (1.t)t^2 + P3.x t^3 - + // (3c0P1.y(1-t)^3 - 3c0P0.y(1-t)^3 + 6c0P2.y(1-t)^2t - 6c0P1.y(1-t)^2t + + // 3c0P3.y(1-t)t^2 - 3c0P2.y(1-t)t^2 + + // 3c1P1.y(1-t)^2t - 3c1P0.y(1-t)^2t + 6c1P2.y(1-t)t^2 - 6c1P1.y(1-t)t^2 + + // 3c1P3.yt^3 - 3c1P2.yt^3) + // = (P0.x - 3 c0 P1.y + 3 c0 P0.y)(1-t)^3 + + // 3(P1.x - c1 P1.y + c1 P0.y - 2 c0 P2.y + 2 c0 P1.y)(1-t)^2t + + // 3(P2.x - 2 c1 P2.y + 2 c1 P1.y - c0 P3.y + c0 P2.y)(1-t)t^2 + + // (P3.x - 3 c1 P3.y + 3 c1 P2.y)t^3 + // = (P0.x - 3 c0(P1.y - P0.y))(1-t)^3 + + // 3(P1.x - c1(P1.y - P0.y) - 2c0(P2.y - P1.y))(1-t)^2t + + // 3(P2.x - 2 c1(P2.y - P1.y) - c0(P3.y - P2.y))(1-t)t^2 + + // (P3.x - 3 c1(P3.y - P2.y))t^3 // - // y(t) = P0.y (1-t)^3 + 3 P1.y (1-t)^2t + 3 P2.y (1-t)t^2 + P3.y t^3 + - // (c0(1-t) + c1 t)(3(P1.x - P0.x)(1-t)^2 + 6(P2.x - P1.x)(1-t)t + 3(P3.x - P2.x)t^2) - // = P0.y (1-t)^3 + 3 P1.y (1-t)^2t + 3 P2.y (1-t)t^2 + P3.y t^3 + - // 3c0(P1.x - P0.x)(1-t)^3 + 6c0(P2.x - P1.x)(1-t)^2t + 3c0(P3.x - P2.x)(1-t)t^2 + - // 3c1(P1.x - P0.x)(1-t)^2t + 6c1(P2.x - P1.x)(1-t)t^2 + 3c1(P3.x - P2.x)t^3 - // = (P0.y + 3 c0 (P1.x - P0.x))(1-t)^3 + - // 3(P1.y + 2 c0 (P2.x - P1.x) + c1 (P1.x - P0.x))(1-t)^2t + - // 3(P2.y + c0 (P3.x - P2.x) + 2 c1 (P2.x - P1.x))(1-t)t^2 + - // (P3.y + 3 c1 (P3.x - P2.x))t^3 + // y(t) = P0.y (1-t)^3 + 3 P1.y (1-t)^2t + 3 P2.y (1-t)t^2 + P3.y t^3 + + // (c0(1-t) + c1 t)(3(P1.x - P0.x)(1-t)^2 + 6(P2.x - P1.x)(1-t)t + 3(P3.x - P2.x)t^2) + // = P0.y (1-t)^3 + 3 P1.y (1-t)^2t + 3 P2.y (1-t)t^2 + P3.y t^3 + + // 3c0(P1.x - P0.x)(1-t)^3 + 6c0(P2.x - P1.x)(1-t)^2t + 3c0(P3.x - P2.x)(1-t)t^2 + + // 3c1(P1.x - P0.x)(1-t)^2t + 6c1(P2.x - P1.x)(1-t)t^2 + 3c1(P3.x - P2.x)t^3 + // = (P0.y + 3 c0 (P1.x - P0.x))(1-t)^3 + + // 3(P1.y + 2 c0 (P2.x - P1.x) + c1 (P1.x - P0.x))(1-t)^2t + + // 3(P2.y + c0 (P3.x - P2.x) + 2 c1 (P2.x - P1.x))(1-t)t^2 + + // (P3.y + 3 c1 (P3.x - P2.x))t^3 // // Therefore, the coefficients F0 to F3 of the focus curve are: // - // F0.x = (P0.x - 3 c0(P1.y - P0.y)) F0.y = (P0.y + 3 c0 (P1.x - P0.x)) - // F1.x = (P1.x - c1(P1.y - P0.y) - 2c0(P2.y - P1.y)) F1.y = (P1.y + 2 c0 (P2.x - P1.x) + c1 (P1.x - P0.x)) - // F2.x = (P2.x - 2 c1(P2.y - P1.y) - c0(P3.y - P2.y)) F2.y = (P2.y + c0 (P3.x - P2.x) + 2 c1 (P2.x - P1.x)) - // F3.x = (P3.x - 3 c1(P3.y - P2.y)) F3.y = (P3.y + 3 c1 (P3.x - P2.x)) + // F0.x = (P0.x - 3 c0(P1.y - P0.y)) F0.y = (P0.y + 3 c0 (P1.x - P0.x)) + // F1.x = (P1.x - c1(P1.y - P0.y) - 2c0(P2.y - P1.y)) F1.y = (P1.y + 2 c0 (P2.x - P1.x) + c1 (P1.x - P0.x)) + // F2.x = (P2.x - 2 c1(P2.y - P1.y) - c0(P3.y - P2.y)) F2.y = (P2.y + c0 (P3.x - P2.x) + 2 c1 (P2.x - P1.x)) + // F3.x = (P3.x - 3 c1(P3.y - P2.y)) F3.y = (P3.y + 3 c1 (P3.x - P2.x)) // res.p0.x = c.p0.x - 3*fRes[0]*(c.p1.y - c.p0.y); res.p1.x = c.p1.x - fRes[1]*(c.p1.y - c.p0.y) - 2*fRes[0]*(c.p2.y - c.p1.y); @@ -774,15 +774,15 @@ void Impl_calcFocus( Bezier& res, const Bezier& c ) // ----------------------------------------------------------------------------- -bool Impl_calcSafeParams_focus( double& t1, - double& t2, - const Bezier& curve, - const Bezier& focus ) +bool Impl_calcSafeParams_focus( double& t1, + double& t2, + const Bezier& curve, + const Bezier& focus ) { // now, we want to determine which normals of the original curve // P(t) intersect with the focus curve F(t). The condition for // this statement is P'(t)(P(t) - F) = 0, i.e. hodograph P'(t) and - // line through P(t) and F are perpendicular. + // line through P(t) and F are perpendicular. // If you expand this equation, you end up with something like // // (\sum_{i=0}^n (P_i - F)B_i^n(t))^T (\sum_{j=0}^{n-1} n(P_{j+1} - P_j)B_j^{n-1}(t)) @@ -795,7 +795,7 @@ bool Impl_calcSafeParams_focus( double& t1, // If we combine the B_i^n(t)B_j^{n-1}(t) product, we arrive at a // Bernstein polynomial of degree 2n-1, as // - // \binom{n}{i}(1-t)^{n-i}t^i) \binom{n-1}{j}(1-t)^{n-1-j}t^j) = + // \binom{n}{i}(1-t)^{n-i}t^i) \binom{n-1}{j}(1-t)^{n-1-j}t^j) = // \binom{n}{i}\binom{n-1}{j}(1-t)^{2n-1-i-j}t^{i+j} // // Thus, with the defining equation for a 2n-1 degree Bernstein @@ -830,7 +830,7 @@ bool Impl_calcSafeParams_focus( double& t1, // u axis, thus simply throw away u coordinate). // // \fallfac are so-called falling factorials (see Concrete - // Mathematics, p. 47 for a definition). + // Mathematics, p. 47 for a definition). // // now, for tensor product bezier curves, the convex hull property @@ -856,7 +856,7 @@ bool Impl_calcSafeParams_focus( double& t1, { // calc single d_{ij} sum: for( d=0.0, k=::std::max(0,i-n); k<=k_max && k<=i; ++k ) - { + { l = i - k; // invariant: k + l = i assert(k>=0 && k<=n-1); // k \in {0,...,n-1} assert(l>=0 && l<=n); // l \in {0,...,n} @@ -864,9 +864,9 @@ bool Impl_calcSafeParams_focus( double& t1, // TODO: find, document and assert proper limits for n and int's max_val. // This becomes important should anybody wants to use // this code for higher-than-cubic beziers - d += static_cast<double>(fallFac(n,l)*fallFac(n-1,k)*fac(i)) / + d += static_cast<double>(fallFac(n,l)*fallFac(n-1,k)*fac(i)) / static_cast<double>(fac(l)*fac(k) * fallFac(2*n-1,i)) * n * - ( (curve[k+1].x - curve[k].x)*(curve[l].x - focus[j].x) + // dot product here + ( (curve[k+1].x - curve[k].x)*(curve[l].x - focus[j].x) + // dot product here (curve[k+1].y - curve[k].y)*(curve[l].y - focus[j].y) ); } @@ -887,7 +887,7 @@ bool Impl_calcSafeParams_focus( double& t1, Polygon2D convHull( convexHull( controlPolygon ) ); - cout << "# convex hull testing (focus)" << endl + cout << "# convex hull testing (focus)" << endl << "plot [t=0:1] "; cout << "'-' using ($1):($2) title \"control polygon\" with lp, " << "'-' using ($1):($2) title \"convex hull\" with lp" << endl; @@ -921,7 +921,7 @@ bool Impl_calcSafeParams_focus( double& t1, determine safe parameter interval on c1 with regard to c2, then the other way around), we call this method recursively with c1 and c2 swapped. - + @param result Output iterator where the final t values are added to. If curves don't intersect, nothing is added. @@ -929,31 +929,31 @@ bool Impl_calcSafeParams_focus( double& t1, @param delta Maximal allowed distance to true critical point (measured in the original curve's coordinate system) - + @param safeRangeFunctor Functor object, that must provide the following operator(): - bool safeRangeFunctor( double& t1, - double& t2, - const Bezier& c1_orig, - const Bezier& c1_part, - const Bezier& c2_orig, + bool safeRangeFunctor( double& t1, + double& t2, + const Bezier& c1_orig, + const Bezier& c1_part, + const Bezier& c2_orig, const Bezier& c2_part ); This functor must calculate the safe ranges [0,t1] and [t2,1] on c1_orig, where c1_orig is 'safe' from c2_part. If the whole c1_orig is safe, false must be returned, true otherwise. */ -template <class Functor> void Impl_applySafeRanges_rec( ::std::back_insert_iterator< ::std::vector< ::std::pair<double, double> > >& result, - double delta, - const Functor& safeRangeFunctor, - int recursionLevel, - const Bezier& c1_orig, - const Bezier& c1_part, - double last_t1_c1, - double last_t2_c1, - const Bezier& c2_orig, - const Bezier& c2_part, - double last_t1_c2, - double last_t2_c2 ) +template <class Functor> void Impl_applySafeRanges_rec( ::std::back_insert_iterator< ::std::vector< ::std::pair<double, double> > >& result, + double delta, + const Functor& safeRangeFunctor, + int recursionLevel, + const Bezier& c1_orig, + const Bezier& c1_part, + double last_t1_c1, + double last_t2_c1, + const Bezier& c2_orig, + const Bezier& c2_part, + double last_t1_c2, + double last_t2_c2 ) { // check end condition // =================== @@ -972,7 +972,7 @@ template <class Functor> void Impl_applySafeRanges_rec( ::std::back_insert_itera for( int i=0; i<recursionLevel; ++i ) cerr << " "; if( recursionLevel % 2 ) { - cerr << "level: " << recursionLevel + cerr << "level: " << recursionLevel << " t: " << last_t1_c2 + (last_t2_c2 - last_t1_c2)/2.0 << ", c1: " << last_t1_c2 << " " << last_t2_c2 @@ -981,7 +981,7 @@ template <class Functor> void Impl_applySafeRanges_rec( ::std::back_insert_itera } else { - cerr << "level: " << recursionLevel + cerr << "level: " << recursionLevel << " t: " << last_t1_c1 + (last_t2_c1 - last_t1_c1)/2.0 << ", c1: " << last_t1_c1 << " " << last_t2_c1 @@ -1028,10 +1028,10 @@ template <class Functor> void Impl_applySafeRanges_rec( ::std::back_insert_itera #if 1 if( fabs(last_t2_c1 - last_t1_c1) < 0.0001 && - fabs(last_t2_c2 - last_t1_c2) < 0.0001 ) + fabs(last_t2_c2 - last_t1_c2) < 0.0001 ) #else if( fabs(last_t2_c1 - last_t1_c1) < 0.01 && - fabs(last_t2_c2 - last_t1_c2) < 0.01 ) + fabs(last_t2_c2 - last_t1_c2) < 0.01 ) #endif { // done. Add to result @@ -1076,7 +1076,7 @@ template <class Functor> void Impl_applySafeRanges_rec( ::std::back_insert_itera Bezier part2; double intervalMiddle; - + if( last_t2_c1 - last_t1_c1 > last_t2_c2 - last_t1_c2 ) { // subdivide c1 @@ -1111,7 +1111,7 @@ template <class Functor> void Impl_applySafeRanges_rec( ::std::back_insert_itera // curve, this simply amounts to subdivision // at 0.5) Impl_deCasteljauAt( part1, part2, c2_part, 0.5 ); - + // and descend recursively with swapped curves Impl_applySafeRanges_rec( result, delta, safeRangeFunctor, recursionLevel+1, c2_orig, part1, last_t1_c2, intervalMiddle, @@ -1159,14 +1159,14 @@ template <class Functor> void Impl_applySafeRanges_rec( ::std::back_insert_itera struct ClipBezierFunctor { - bool operator()( double& t1_c1, - double& t2_c1, + bool operator()( double& t1_c1, + double& t2_c1, const Bezier& c1_orig, const Bezier& c1_part, const Bezier& c2_orig, const Bezier& c2_part ) const - { - return Impl_calcClipRange( t1_c1, t2_c1, c1_orig, c1_part, c2_orig, c2_part ); + { + return Impl_calcClipRange( t1_c1, t2_c1, c1_orig, c1_part, c2_orig, c2_part ); } }; @@ -1174,13 +1174,13 @@ struct ClipBezierFunctor struct BezierTangencyFunctor { - bool operator()( double& t1_c1, - double& t2_c1, + bool operator()( double& t1_c1, + double& t2_c1, const Bezier& c1_orig, const Bezier& c1_part, const Bezier& c2_orig, const Bezier& c2_part ) const - { + { // calc focus curve of c2 Bezier focus; Impl_calcFocus(focus, c2_part); // need to use subdivided c2 @@ -1201,7 +1201,7 @@ struct BezierTangencyFunctor // ----------------------------------------------------------------------------- /** Perform a bezier clip (curve against curve) - + @param result Output iterator where the final t values are added to. This iterator will remain empty, if there are no intersections. @@ -1210,10 +1210,10 @@ struct BezierTangencyFunctor Maximal allowed distance to true intersection (measured in the original curve's coordinate system) */ -void clipBezier( ::std::back_insert_iterator< ::std::vector< ::std::pair<double, double> > >& result, - double delta, - const Bezier& c1, - const Bezier& c2 ) +void clipBezier( ::std::back_insert_iterator< ::std::vector< ::std::pair<double, double> > >& result, + double delta, + const Bezier& c1, + const Bezier& c2 ) { #if 0 // first of all, determine list of collinear normals. Collinear @@ -1257,7 +1257,7 @@ void clipBezier( ::std::back_insert_iterator< ::std::vector< ::std::pair<double, } c1_segments[i] = c1_remainder; c2_segments[i] = c2_remainder; - + // now, c1/c2_segments contain all segments, then // clip every resulting segment against every other unsigned int c1_curr, c2_curr; @@ -1267,10 +1267,10 @@ void clipBezier( ::std::back_insert_iterator< ::std::vector< ::std::pair<double, { if( c1_curr != c2_curr ) { - Impl_clipBezier_rec(result, delta, 0, - c1_segments[c1_curr], c1_segments[c1_curr], + Impl_clipBezier_rec(result, delta, 0, + c1_segments[c1_curr], c1_segments[c1_curr], 0.0, 1.0, - c2_segments[c2_curr], c2_segments[c2_curr], + c2_segments[c2_curr], c2_segments[c2_curr], 0.0, 1.0); } } @@ -1287,8 +1287,8 @@ int main(int argc, const char *argv[]) double curr_Offset( 0 ); unsigned int i,j,k; - Bezier someCurves[] = - { + Bezier someCurves[] = + { // {Point2D(0.0,0.0),Point2D(0.0,1.0),Point2D(1.0,1.0),Point2D(1.0,0.0)}, // {Point2D(0.0,0.0),Point2D(0.0,1.0),Point2D(1.0,1.0),Point2D(1.0,0.5)}, // {Point2D(1.0,0.0),Point2D(0.0,0.0),Point2D(0.0,1.0),Point2D(1.0,1.0)} @@ -1352,7 +1352,7 @@ int main(int argc, const char *argv[]) }; // output gnuplot setup - cout << "#!/usr/bin/gnuplot -persist" << endl + cout << "#!/usr/bin/gnuplot -persist" << endl << "#" << endl << "# automatically generated by bezierclip, don't change!" << endl << "#" << endl @@ -1363,13 +1363,13 @@ int main(int argc, const char *argv[]) << "pointmarky(c,t) = c+0.03*t" << endl << "linex(a,b,c,t) = a*-c + t*-b" << endl << "liney(a,b,c,t) = b*-c + t*a" << endl << endl - << "# end of setup" << endl << endl; + << "# end of setup" << endl << endl; #ifdef WITH_CONVEXHULL_TEST // test convex hull algorithm const double convHull_xOffset( curr_Offset ); curr_Offset += 20; - cout << "# convex hull testing" << endl + cout << "# convex hull testing" << endl << "plot [t=0:1] "; for( i=0; i<sizeof(someCurves)/sizeof(Bezier); ++i ) { @@ -1378,18 +1378,18 @@ int main(int argc, const char *argv[]) aTestPoly[1] = someCurves[i].p1; aTestPoly[2] = someCurves[i].p2; aTestPoly[3] = someCurves[i].p3; - + aTestPoly[0].x += convHull_xOffset; aTestPoly[1].x += convHull_xOffset; aTestPoly[2].x += convHull_xOffset; aTestPoly[3].x += convHull_xOffset; - cout << " bez(" - << aTestPoly[0].x << "," + cout << " bez(" + << aTestPoly[0].x << "," << aTestPoly[1].x << "," << aTestPoly[2].x << "," << aTestPoly[3].x << ",t),bez(" - << aTestPoly[0].y << "," + << aTestPoly[0].y << "," << aTestPoly[1].y << "," << aTestPoly[2].y << "," << aTestPoly[3].y << ",t), '-' using ($1):($2) title \"convex hull " << i << "\" with lp"; @@ -1406,14 +1406,14 @@ int main(int argc, const char *argv[]) aTestPoly[1] = someCurves[i].p1; aTestPoly[2] = someCurves[i].p2; aTestPoly[3] = someCurves[i].p3; - + aTestPoly[0].x += convHull_xOffset; aTestPoly[1].x += convHull_xOffset; aTestPoly[2].x += convHull_xOffset; aTestPoly[3].x += convHull_xOffset; Polygon2D convHull( convexHull(aTestPoly) ); - + for( k=0; k<convHull.size(); ++k ) { cout << convHull[k].x << " " << convHull[k].y << endl; @@ -1427,7 +1427,7 @@ int main(int argc, const char *argv[]) // test convex hull algorithm const double multiSubdivide_xOffset( curr_Offset ); curr_Offset += 20; - cout << "# multi subdivide testing" << endl + cout << "# multi subdivide testing" << endl << "plot [t=0:1] "; for( i=0; i<sizeof(someCurves)/sizeof(Bezier); ++i ) { @@ -1459,30 +1459,30 @@ int main(int argc, const char *argv[]) // subdivide at t2 Impl_deCasteljauAt( c1_part3, c1_part2, c, t2 ); - cout << " bez(" - << c1_part1.p0.x << "," + cout << " bez(" + << c1_part1.p0.x << "," << c1_part1.p1.x << "," << c1_part1.p2.x << "," << c1_part1.p3.x << ",t), bez(" - << c1_part1.p0.y+0.01 << "," + << c1_part1.p0.y+0.01 << "," << c1_part1.p1.y+0.01 << "," << c1_part1.p2.y+0.01 << "," << c1_part1.p3.y+0.01 << ",t) title \"middle " << i << "\", " - << " bez(" - << c1_part2.p0.x << "," + << " bez(" + << c1_part2.p0.x << "," << c1_part2.p1.x << "," << c1_part2.p2.x << "," << c1_part2.p3.x << ",t), bez(" - << c1_part2.p0.y << "," + << c1_part2.p0.y << "," << c1_part2.p1.y << "," << c1_part2.p2.y << "," << c1_part2.p3.y << ",t) title \"right " << i << "\", " - << " bez(" - << c1_part3.p0.x << "," + << " bez(" + << c1_part3.p0.x << "," << c1_part3.p1.x << "," << c1_part3.p2.x << "," << c1_part3.p3.x << ",t), bez(" - << c1_part3.p0.y << "," + << c1_part3.p0.y << "," << c1_part3.p1.y << "," << c1_part3.p2.y << "," << c1_part3.p3.y << ",t) title \"left " << i << "\""; @@ -1499,12 +1499,12 @@ int main(int argc, const char *argv[]) // test fatline algorithm const double fatLine_xOffset( curr_Offset ); curr_Offset += 20; - cout << "# fat line testing" << endl + cout << "# fat line testing" << endl << "plot [t=0:1] "; for( i=0; i<sizeof(someCurves)/sizeof(Bezier); ++i ) { Bezier c( someCurves[i] ); - + c.p0.x += fatLine_xOffset; c.p1.x += fatLine_xOffset; c.p2.x += fatLine_xOffset; @@ -1514,20 +1514,20 @@ int main(int argc, const char *argv[]) Impl_calcFatLine(line, c); - cout << " bez(" - << c.p0.x << "," + cout << " bez(" + << c.p0.x << "," << c.p1.x << "," << c.p2.x << "," << c.p3.x << ",t), bez(" - << c.p0.y << "," + << c.p0.y << "," << c.p1.y << "," << c.p2.y << "," << c.p3.y << ",t) title \"bezier " << i << "\", linex(" << line.a << "," << line.b << "," - << line.c << ",t), liney(" - << line.a << "," - << line.b << "," + << line.c << ",t), liney(" + << line.a << "," + << line.b << "," << line.c << ",t) title \"fat line (center) on " << i << "\", linex(" << line.a << "," << line.b << "," @@ -1553,12 +1553,12 @@ int main(int argc, const char *argv[]) // test focus curve algorithm const double focus_xOffset( curr_Offset ); curr_Offset += 20; - cout << "# focus line testing" << endl + cout << "# focus line testing" << endl << "plot [t=0:1] "; for( i=0; i<sizeof(someCurves)/sizeof(Bezier); ++i ) { Bezier c( someCurves[i] ); - + c.p0.x += focus_xOffset; c.p1.x += focus_xOffset; c.p2.x += focus_xOffset; @@ -1568,20 +1568,20 @@ int main(int argc, const char *argv[]) Bezier focus; Impl_calcFocus(focus, c); - cout << " bez(" - << c.p0.x << "," + cout << " bez(" + << c.p0.x << "," << c.p1.x << "," << c.p2.x << "," << c.p3.x << ",t), bez(" - << c.p0.y << "," + << c.p0.y << "," << c.p1.y << "," << c.p2.y << "," - << c.p3.y << ",t) title \"bezier " << i << "\", bez(" - << focus.p0.x << "," + << c.p3.y << ",t) title \"bezier " << i << "\", bez(" + << focus.p0.x << "," << focus.p1.x << "," << focus.p2.x << "," << focus.p3.x << ",t), bez(" - << focus.p0.y << "," + << focus.p0.y << "," << focus.p1.y << "," << focus.p2.y << "," << focus.p3.y << ",t) title \"focus " << i << "\""; @@ -1597,12 +1597,12 @@ int main(int argc, const char *argv[]) #ifdef WITH_SAFEPARAMBASE_TEST // test safe params base method double safeParamsBase_xOffset( curr_Offset ); - cout << "# safe param base method testing" << endl + cout << "# safe param base method testing" << endl << "plot [t=0:1] "; for( i=0; i<sizeof(someCurves)/sizeof(Bezier); ++i ) { Bezier c( someCurves[i] ); - + c.p0.x += safeParamsBase_xOffset; c.p1.x += safeParamsBase_xOffset; c.p2.x += safeParamsBase_xOffset; @@ -1619,13 +1619,13 @@ int main(int argc, const char *argv[]) bool bRet( Impl_calcSafeParams( t1, t2, poly, 0, 1 ) ); Polygon2D convHull( convexHull( poly ) ); - - cout << " bez(" - << poly[0].x << "," + + cout << " bez(" + << poly[0].x << "," << poly[1].x << "," << poly[2].x << "," << poly[3].x << ",t),bez(" - << poly[0].y << "," + << poly[0].y << "," << poly[1].y << "," << poly[2].y << "," << poly[3].y << ",t), " @@ -1651,7 +1651,7 @@ int main(int argc, const char *argv[]) for( i=0; i<sizeof(someCurves)/sizeof(Bezier); ++i ) { Bezier c( someCurves[i] ); - + c.p0.x += safeParamsBase_xOffset; c.p1.x += safeParamsBase_xOffset; c.p2.x += safeParamsBase_xOffset; @@ -1668,7 +1668,7 @@ int main(int argc, const char *argv[]) Impl_calcSafeParams( t1, t2, poly, 0, 1 ); Polygon2D convHull( convexHull( poly ) ); - + unsigned int k; for( k=0; k<poly.size(); ++k ) { @@ -1693,7 +1693,7 @@ int main(int argc, const char *argv[]) // test safe parameter range algorithm const double safeParams_xOffset( curr_Offset ); curr_Offset += 20; - cout << "# safe param range testing" << endl + cout << "# safe param range testing" << endl << "plot [t=0.0:1.0] "; for( i=0; i<sizeof(someCurves)/sizeof(Bezier); ++i ) { @@ -1701,7 +1701,7 @@ int main(int argc, const char *argv[]) { Bezier c1( someCurves[i] ); Bezier c2( someCurves[j] ); - + c1.p0.x += safeParams_xOffset; c1.p1.x += safeParams_xOffset; c1.p2.x += safeParams_xOffset; @@ -1727,28 +1727,28 @@ int main(int argc, const char *argv[]) // output remaining segment (c1_part1) - cout << " bez(" - << c1.p0.x << "," + cout << " bez(" + << c1.p0.x << "," << c1.p1.x << "," << c1.p2.x << "," << c1.p3.x << ",t),bez(" - << c1.p0.y << "," + << c1.p0.y << "," << c1.p1.y << "," << c1.p2.y << "," << c1.p3.y << ",t), bez(" - << c2.p0.x << "," + << c2.p0.x << "," << c2.p1.x << "," << c2.p2.x << "," << c2.p3.x << ",t),bez(" - << c2.p0.y << "," + << c2.p0.y << "," << c2.p1.y << "," << c2.p2.y << "," << c2.p3.y << ",t), bez(" - << c1_part1.p0.x << "," + << c1_part1.p0.x << "," << c1_part1.p1.x << "," << c1_part1.p2.x << "," << c1_part1.p3.x << ",t),bez(" - << c1_part1.p0.y << "," + << c1_part1.p0.y << "," << c1_part1.p1.y << "," << c1_part1.p2.y << "," << c1_part1.p3.y << ",t)"; @@ -1770,7 +1770,7 @@ int main(int argc, const char *argv[]) { Bezier c1( someCurves[0] ); Bezier c2( someCurves[1] ); - + c1.p0.x += safeParams2_xOffset; c1.p1.x += safeParams2_xOffset; c1.p2.x += safeParams2_xOffset; @@ -1791,7 +1791,7 @@ int main(int argc, const char *argv[]) // test safe parameter range from focus algorithm const double safeParamsFocus_xOffset( curr_Offset ); curr_Offset += 20; - cout << "# safe param range from focus testing" << endl + cout << "# safe param range from focus testing" << endl << "plot [t=0.0:1.0] "; for( i=0; i<sizeof(someCurves)/sizeof(Bezier); ++i ) { @@ -1799,7 +1799,7 @@ int main(int argc, const char *argv[]) { Bezier c1( someCurves[i] ); Bezier c2( someCurves[j] ); - + c1.p0.x += safeParamsFocus_xOffset; c1.p1.x += safeParamsFocus_xOffset; c1.p2.x += safeParamsFocus_xOffset; @@ -1819,10 +1819,10 @@ int main(int argc, const char *argv[]) Bezier c1_part1; Bezier c1_part2; Bezier c1_part3; - + // subdivide at t1_c1 Impl_deCasteljauAt( c1_part1, c1_part2, c2, 0.30204 ); - + // subdivide at t2_c1. As we're working on // c1_part2 now, we have to adapt t2_c1 since // we're no longer in the original parameter @@ -1831,7 +1831,7 @@ int main(int argc, const char *argv[]) // relates the t2 value into the new parameter // range [0,1] of c1_part2. Impl_deCasteljauAt( c1_part1, c1_part3, c1_part2, (0.57151-0.30204)/(1.0-0.30204) ); - + c2 = c1_part1; Impl_calcFocus( focus, c2 ); } @@ -1851,49 +1851,49 @@ int main(int argc, const char *argv[]) Bezier c1_part1; Bezier c1_part2; Bezier c1_part3; - + // subdivide at t1_c1 Impl_deCasteljauAt( c1_part1, c1_part2, c1, t1 ); // subdivide at t2_c1 Impl_deCasteljauAt( c1_part1, c1_part3, c1_part2, (t2-t1)/(1.0-t1) ); - + // output remaining segment (c1_part1) - - cout << " bez(" - << c1.p0.x << "," + + cout << " bez(" + << c1.p0.x << "," << c1.p1.x << "," << c1.p2.x << "," << c1.p3.x << ",t),bez(" - << c1.p0.y << "," + << c1.p0.y << "," << c1.p1.y << "," << c1.p2.y << "," << c1.p3.y << ",t) title \"c1\", " #ifdef WITH_SAFEFOCUSPARAM_CALCFOCUS << "bez(" - << c2.p0.x << "," + << c2.p0.x << "," << c2.p1.x << "," << c2.p2.x << "," << c2.p3.x << ",t),bez(" - << c2.p0.y << "," + << c2.p0.y << "," << c2.p1.y << "," << c2.p2.y << "," << c2.p3.y << ",t) title \"c2\", " << "bez(" - << focus.p0.x << "," + << focus.p0.x << "," << focus.p1.x << "," << focus.p2.x << "," << focus.p3.x << ",t),bez(" - << focus.p0.y << "," + << focus.p0.y << "," << focus.p1.y << "," << focus.p2.y << "," << focus.p3.y << ",t) title \"focus\""; #else << "bez(" - << c2.p0.x << "," + << c2.p0.x << "," << c2.p1.x << "," << c2.p2.x << "," << c2.p3.x << ",t),bez(" - << c2.p0.y << "," + << c2.p0.y << "," << c2.p1.y << "," << c2.p2.y << "," << c2.p3.y << ",t) title \"focus\""; @@ -1901,11 +1901,11 @@ int main(int argc, const char *argv[]) if( bRet ) { cout << ", bez(" - << c1_part1.p0.x << "," + << c1_part1.p0.x << "," << c1_part1.p1.x << "," << c1_part1.p2.x << "," << c1_part1.p3.x << ",t),bez(" - << c1_part1.p0.y+0.01 << "," + << c1_part1.p0.y+0.01 << "," << c1_part1.p1.y+0.01 << "," << c1_part1.p2.y+0.01 << "," << c1_part1.p3.y+0.01 << ",t) title \"part\""; @@ -1927,7 +1927,7 @@ int main(int argc, const char *argv[]) { Bezier c1( someCurves[0] ); Bezier c2( someCurves[1] ); - + c1.p0.x += safeParams3_xOffset; c1.p1.x += safeParams3_xOffset; c1.p2.x += safeParams3_xOffset; @@ -1938,7 +1938,7 @@ int main(int argc, const char *argv[]) c2.p3.x += safeParams3_xOffset; double t1, t2; - + Bezier focus; #ifdef WITH_SAFEFOCUSPARAM_CALCFOCUS Impl_calcFocus( focus, c2 ); @@ -1953,13 +1953,13 @@ int main(int argc, const char *argv[]) #endif #ifdef WITH_BEZIERCLIP_TEST - ::std::vector< ::std::pair<double, double> > result; + ::std::vector< ::std::pair<double, double> > result; ::std::back_insert_iterator< ::std::vector< ::std::pair<double, double> > > ii(result); // test full bezier clipping const double bezierClip_xOffset( curr_Offset ); curr_Offset += 20; - cout << endl << endl << "# bezier clip testing" << endl + cout << endl << endl << "# bezier clip testing" << endl << "plot [t=0:1] "; for( i=0; i<sizeof(someCurves)/sizeof(Bezier); ++i ) { @@ -1977,39 +1977,39 @@ int main(int argc, const char *argv[]) c2.p2.x += bezierClip_xOffset; c2.p3.x += bezierClip_xOffset; - cout << " bez(" - << c1.p0.x << "," + cout << " bez(" + << c1.p0.x << "," << c1.p1.x << "," << c1.p2.x << "," << c1.p3.x << ",t),bez(" - << c1.p0.y << "," + << c1.p0.y << "," << c1.p1.y << "," << c1.p2.y << "," << c1.p3.y << ",t), bez(" - << c2.p0.x << "," + << c2.p0.x << "," << c2.p1.x << "," << c2.p2.x << "," << c2.p3.x << ",t),bez(" - << c2.p0.y << "," + << c2.p0.y << "," << c2.p1.y << "," << c2.p2.y << "," - << c2.p3.y << ",t), '-' using (bez(" - << c1.p0.x << "," + << c2.p3.y << ",t), '-' using (bez(" + << c1.p0.x << "," << c1.p1.x << "," << c1.p2.x << "," - << c1.p3.x + << c1.p3.x << ",$1)):(bez(" - << c1.p0.y << "," + << c1.p0.y << "," << c1.p1.y << "," << c1.p2.y << "," << c1.p3.y << ",$1)) title \"bezier " << i << " clipped against " << j << " (t on " << i << ")\", " - << " '-' using (bez(" - << c2.p0.x << "," + << " '-' using (bez(" + << c2.p0.x << "," << c2.p1.x << "," << c2.p2.x << "," - << c2.p3.x + << c2.p3.x << ",$1)):(bez(" - << c2.p0.y << "," + << c2.p0.y << "," << c2.p1.y << "," << c2.p2.y << "," << c2.p3.y << ",$1)) title \"bezier " << i << " clipped against " << j << " (t on " << j << ")\""; diff --git a/basegfx/source/workbench/bezierclip.hxx b/basegfx/source/workbench/bezierclip.hxx index 06294d174847..06436a21b817 100644 --- a/basegfx/source/workbench/bezierclip.hxx +++ b/basegfx/source/workbench/bezierclip.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,13 +42,13 @@ struct Point2D struct Bezier { - Point2D p0; - Point2D p1; - Point2D p2; - Point2D p3; + Point2D p0; + Point2D p1; + Point2D p2; + Point2D p3; - Point2D& operator[]( int i ) { return reinterpret_cast<Point2D*>(this)[i]; } - const Point2D& operator[]( int i ) const { return reinterpret_cast<const Point2D*>(this)[i]; } + Point2D& operator[]( int i ) { return reinterpret_cast<Point2D*>(this)[i]; } + const Point2D& operator[]( int i ) const { return reinterpret_cast<const Point2D*>(this)[i]; } }; struct FatLine diff --git a/basegfx/source/workbench/convexhull.cxx b/basegfx/source/workbench/convexhull.cxx index 4e846a863f7f..2d828164cd1b 100644 --- a/basegfx/source/workbench/convexhull.cxx +++ b/basegfx/source/workbench/convexhull.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -37,12 +37,12 @@ // ----------------------------------------------------------------------------- -/* Implements the theta function from Sedgewick: Algorithms in XXX, chapter 24 */ +/* Implements the theta function from Sedgewick: Algorithms in XXX, chapter 24 */ template <class PointType> double theta( const PointType& p1, const PointType& p2 ) { typename PointType::value_type dx, dy, ax, ay; double t; - + dx = p2.x - p1.x; ax = absval( dx ); dy = p2.y - p1.y; ay = absval( dy ); t = (ax+ay == 0) ? 0 : (double) dy/(ax+ay); @@ -50,13 +50,13 @@ template <class PointType> double theta( const PointType& p1, const PointType& p t = 2-t; else if( dy < 0 ) t = 4+t; - + return t*90.0; } /* Model of LessThanComparable for theta sort. - * Uses the theta function from Sedgewick: Algorithms in XXX, chapter 24 - */ + * Uses the theta function from Sedgewick: Algorithms in XXX, chapter 24 + */ template <class PointType> class ThetaCompare : public ::std::binary_function< const PointType&, const PointType&, bool > { public: @@ -84,7 +84,7 @@ template <class PointType, class CmpFunctor> typename PointType::value_type ccw( typename PointType::value_type theta0( thetaCmp(p0) ); typename PointType::value_type theta1( thetaCmp(p1) ); typename PointType::value_type theta2( thetaCmp(p2) ); - + #if 0 if( theta0 == theta1 || theta0 == theta2 || @@ -121,7 +121,7 @@ template <class PointType, class CmpFunctor> typename PointType::value_type ccw( Sometimes, the resulting polygon is not the convex hull (see below for an edge configuration to reproduce that problem) - Problem analysis: + Problem analysis: ================= The root cause of this bug is the fact that the second part of @@ -158,7 +158,7 @@ template <class PointType, class CmpFunctor> typename PointType::value_type ccw( also classify them as 'equal'. Thus, the second stage of the convex hull algorithm sorts the first one out, effectively reducing a cluster of theta-equal points to only one. This - single point can then be treated correctly. + single point can then be treated correctly. */ @@ -173,7 +173,7 @@ Polygon2D convexHull( const Polygon2D& rPoly ) // determine safe point on hull (smallest y value) for( min=1, i=2; i<=N; ++i ) { - if( result[i].y < result[min].y ) + if( result[i].y < result[min].y ) min = i; } @@ -197,7 +197,7 @@ Polygon2D convexHull( const Polygon2D& rPoly ) // setup sentinel result[0] = result[N]; - + // generate convex hull Polygon2D::size_type M; for( M=3, i=4; i<=N; ++i ) diff --git a/basegfx/source/workbench/gauss.hxx b/basegfx/source/workbench/gauss.hxx index a6d8da3f604d..d8196f156ef5 100644 --- a/basegfx/source/workbench/gauss.hxx +++ b/basegfx/source/workbench/gauss.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -27,7 +27,7 @@ ************************************************************************/ /** This method eliminates elements below main diagonal in the given - matrix by gaussian elimination. + matrix by gaussian elimination. @param matrix The matrix to operate on. Last column is the result vector (right @@ -47,14 +47,14 @@ @return true, if elimination succeeded. */ -template <class Matrix, typename BaseType> -bool eliminate( Matrix& matrix, - int rows, - int cols, - const BaseType& minPivot ) +template <class Matrix, typename BaseType> +bool eliminate( Matrix& matrix, + int rows, + int cols, + const BaseType& minPivot ) { - BaseType temp; - int max, i, j, k; /* *must* be signed, when looping like: j>=0 ! */ + BaseType temp; + int max, i, j, k; /* *must* be signed, when looping like: j>=0 ! */ /* eliminate below main diagonal */ for(i=0; i<cols-1; ++i) @@ -62,12 +62,12 @@ bool eliminate( Matrix& matrix, /* find best pivot */ max = i; for(j=i+1; j<rows; ++j) - if( fabs(matrix[ j*cols + i ]) > fabs(matrix[ max*cols + i ]) ) + if( fabs(matrix[ j*cols + i ]) > fabs(matrix[ max*cols + i ]) ) max = j; /* check pivot value */ if( fabs(matrix[ max*cols + i ]) < minPivot ) - return false; /* pivot too small! */ + return false; /* pivot too small! */ /* interchange rows 'max' and 'i' */ for(k=0; k<cols; ++k) @@ -76,11 +76,11 @@ bool eliminate( Matrix& matrix, matrix[ i*cols + k ] = matrix[ max*cols + k ]; matrix[ max*cols + k ] = temp; } - + /* eliminate column */ for(j=i+1; j<rows; ++j) for(k=cols-1; k>=i; --k) - matrix[ j*cols + k ] -= matrix[ i*cols + k ] * + matrix[ j*cols + k ] -= matrix[ i*cols + k ] * matrix[ j*cols + i ] / matrix[ i*cols + i ]; } @@ -109,14 +109,14 @@ bool eliminate( Matrix& matrix, @return true, if back substitution was possible (i.e. no division by zero occured). */ -template <class Matrix, class Vector, typename BaseType> -bool substitute( const Matrix& matrix, - int rows, - int cols, - Vector& result ) +template <class Matrix, class Vector, typename BaseType> +bool substitute( const Matrix& matrix, + int rows, + int cols, + Vector& result ) { - BaseType temp; - int j,k; /* *must* be signed, when looping like: j>=0 ! */ + BaseType temp; + int j,k; /* *must* be signed, when looping like: j>=0 ! */ /* substitute backwards */ for(j=rows-1; j>=0; --j) @@ -126,7 +126,7 @@ bool substitute( const Matrix& matrix, temp += matrix[ j*cols + k ] * result[k]; if( matrix[ j*cols + j ] == 0.0 ) - return false; /* imminent division by zero! */ + return false; /* imminent division by zero! */ result[j] = (matrix[ j*cols + cols-1 ] - temp) / matrix[ j*cols + j ]; } @@ -159,12 +159,12 @@ bool substitute( const Matrix& matrix, @return true, if elimination succeeded. */ -template <class Matrix, class Vector, typename BaseType> -bool solve( Matrix& matrix, - int rows, - int cols, - Vector& result, - BaseType minPivot ) +template <class Matrix, class Vector, typename BaseType> +bool solve( Matrix& matrix, + int rows, + int cols, + Vector& result, + BaseType minPivot ) { if( eliminate<Matrix,BaseType>(matrix, rows, cols, minPivot) ) return substitute<Matrix,Vector,BaseType>(matrix, rows, cols, result); |