diff options
Diffstat (limited to 'basegfx')
161 files changed, 3979 insertions, 3979 deletions
diff --git a/basegfx/inc/basegfx/color/bcolor.hxx b/basegfx/inc/basegfx/color/bcolor.hxx index ba39c1dd4ab4..2d1edd112ae7 100644 --- a/basegfx/inc/basegfx/color/bcolor.hxx +++ b/basegfx/inc/basegfx/color/bcolor.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 @@ -55,52 +55,52 @@ namespace basegfx */ class BColor : public B3DTuple { - public: - /** Create a Color with red, green and blue components from [0.0 to 1.0] + public: + /** Create a Color with red, green and blue components from [0.0 to 1.0] The color is initialized to (0.0, 0.0, 0.0) */ - BColor() - : B3DTuple() + BColor() + : B3DTuple() {} - /** Create a 3D Color + /** Create a 3D Color @param fRed @param fGreen @param fBlue These parameters are used to initialize the red, green and blue intensities of the color */ - BColor(double fRed, double fGreen, double fBlue) - : B3DTuple(fRed, fGreen, fBlue) + BColor(double fRed, double fGreen, double fBlue) + : B3DTuple(fRed, fGreen, fBlue) {} - /** Create a 3D Color + /** Create a 3D Color @param fLuminosity The parameter is used to initialize the red, green and blue intensities of the color */ - BColor(double fLuminosity) - : B3DTuple(fLuminosity, fLuminosity, fLuminosity) + BColor(double fLuminosity) + : B3DTuple(fLuminosity, fLuminosity, fLuminosity) {} - /** Create a copy of a Color + /** Create a copy of a Color @param rVec The Color which will be copied. */ - BColor(const BColor& rVec) - : B3DTuple(rVec) + BColor(const BColor& rVec) + : B3DTuple(rVec) {} /** constructor with tuple to allow copy-constructing from B3DTuple-based classes */ - BColor(const ::basegfx::B3DTuple& rTuple) - : B3DTuple(rTuple) + BColor(const ::basegfx::B3DTuple& rTuple) + : B3DTuple(rTuple) {} - ~BColor() + ~BColor() {} // data access read @@ -115,33 +115,33 @@ namespace basegfx /** *=operator to allow usage from BColor, too */ - BColor& operator*=( const BColor& rPnt ) - { + BColor& operator*=( const BColor& rPnt ) + { mfX *= rPnt.mfX; - mfY *= rPnt.mfY; - mfZ *= rPnt.mfZ; - return *this; + mfY *= rPnt.mfY; + mfZ *= rPnt.mfZ; + return *this; } /** *=operator to allow usage from BColor, too */ - BColor& operator*=(double t) - { - mfX *= t; - mfY *= t; - mfZ *= t; - return *this; + BColor& operator*=(double t) + { + mfX *= t; + mfY *= t; + mfZ *= t; + return *this; } /** assignment operator to allow assigning the results of B3DTuple calculations */ - BColor& operator=( const ::basegfx::B3DTuple& rVec ) - { + BColor& operator=( const ::basegfx::B3DTuple& rVec ) + { mfX = rVec.getX(); - mfY = rVec.getY(); - mfZ = rVec.getZ(); - return *this; + mfY = rVec.getY(); + mfZ = rVec.getZ(); + return *this; } // blend to another color using luminance diff --git a/basegfx/inc/basegfx/color/bcolormodifier.hxx b/basegfx/inc/basegfx/color/bcolormodifier.hxx index b109f05c7e11..cc4a181ccc05 100644 --- a/basegfx/inc/basegfx/color/bcolormodifier.hxx +++ b/basegfx/inc/basegfx/color/bcolormodifier.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 @@ -36,32 +36,32 @@ namespace basegfx { - /** Descriptor for type of color modification + /** Descriptor for type of color modification */ enum BColorModifyMode { - BCOLORMODIFYMODE_REPLACE, // replace all color with local color - BCOLORMODIFYMODE_INTERPOLATE, // interpolate color between given and local with local value - BCOLORMODIFYMODE_GRAY, // convert color to gray - BCOLORMODIFYMODE_BLACKANDWHITE // convert color to B&W, local value is treshhold + BCOLORMODIFYMODE_REPLACE, // replace all color with local color + BCOLORMODIFYMODE_INTERPOLATE, // interpolate color between given and local with local value + BCOLORMODIFYMODE_GRAY, // convert color to gray + BCOLORMODIFYMODE_BLACKANDWHITE // convert color to B&W, local value is treshhold }; - /** Class to hold a color, value and mode for a color modification. Color modification is + /** Class to hold a color, value and mode for a color modification. Color modification is done calling the getModifiedColor() method */ class BColorModifier { protected: - ::basegfx::BColor maBColor; - double mfValue; - BColorModifyMode meMode; + ::basegfx::BColor maBColor; + double mfValue; + BColorModifyMode meMode; public: BColorModifier( - const ::basegfx::BColor& rBColor, - double fValue = 0.5, + const ::basegfx::BColor& rBColor, + double fValue = 0.5, BColorModifyMode eMode = BCOLORMODIFYMODE_REPLACE) - : maBColor(rBColor), + : maBColor(rBColor), mfValue(fValue), meMode(eMode) {} @@ -72,9 +72,9 @@ namespace basegfx return (maBColor == rCompare.maBColor && mfValue == rCompare.mfValue && meMode == rCompare.meMode); } - bool operator!=(const BColorModifier& rCompare) const - { - return !(operator==(rCompare)); + bool operator!=(const BColorModifier& rCompare) const + { + return !(operator==(rCompare)); } // data access @@ -86,13 +86,13 @@ namespace basegfx ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const; }; - /** Class to hold a stack of BColorModifiers and to get the modified color with + /** Class to hold a stack of BColorModifiers and to get the modified color with applying all existing entry changes */ class BColorModifierStack { protected: - ::std::vector< BColorModifier > maBColorModifiers; + ::std::vector< BColorModifier > maBColorModifiers; public: sal_uInt32 count() const @@ -126,14 +126,14 @@ namespace basegfx } } - void push(const BColorModifier& rNew) - { - maBColorModifiers.push_back(rNew); + void push(const BColorModifier& rNew) + { + maBColorModifiers.push_back(rNew); } - void pop() - { - maBColorModifiers.pop_back(); + void pop() + { + maBColorModifiers.pop_back(); } }; } // end of namespace basegfx diff --git a/basegfx/inc/basegfx/color/bcolortools.hxx b/basegfx/inc/basegfx/color/bcolortools.hxx index 0502c77f3236..6814c31a30cd 100644 --- a/basegfx/inc/basegfx/color/bcolortools.hxx +++ b/basegfx/inc/basegfx/color/bcolortools.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 diff --git a/basegfx/inc/basegfx/curve/b2dbeziertools.hxx b/basegfx/inc/basegfx/curve/b2dbeziertools.hxx index 875ab5a1acec..4546244c2510 100644 --- a/basegfx/inc/basegfx/curve/b2dbeziertools.hxx +++ b/basegfx/inc/basegfx/curve/b2dbeziertools.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 @@ -47,8 +47,8 @@ namespace basegfx class B2DCubicBezierHelper { private: - ::std::vector< double > maLengthArray; - sal_uInt32 mnEdgeCount; + ::std::vector< double > maLengthArray; + sal_uInt32 mnEdgeCount; public: B2DCubicBezierHelper(const B2DCubicBezier& rBase, sal_uInt32 nDivisions = 9); diff --git a/basegfx/inc/basegfx/curve/b2dcubicbezier.hxx b/basegfx/inc/basegfx/curve/b2dcubicbezier.hxx index bcc657110521..2fc9f20fe701 100644 --- a/basegfx/inc/basegfx/curve/b2dcubicbezier.hxx +++ b/basegfx/inc/basegfx/curve/b2dcubicbezier.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 @@ -46,12 +46,12 @@ namespace basegfx { class B2DCubicBezier { - B2DPoint maStartPoint; - B2DPoint maEndPoint; - B2DPoint maControlPointA; - B2DPoint maControlPointB; + B2DPoint maStartPoint; + B2DPoint maEndPoint; + B2DPoint maControlPointA; + B2DPoint maControlPointB; - public: + public: B2DCubicBezier(); B2DCubicBezier(const B2DCubicBezier& rBezier); B2DCubicBezier(const B2DPoint& rStart, const B2DPoint& rEnd); @@ -72,7 +72,7 @@ namespace basegfx // test if contained bezier is trivial and reset vectors accordingly void testAndSolveTrivialBezier(); - /** get length of edge + /** get length of edge This method handles beziers and simple edges. For beziers, the deviation describes the maximum allowed @@ -101,10 +101,10 @@ namespace basegfx // data interface B2DPoint getStartPoint() const { return maStartPoint; } void setStartPoint(const B2DPoint& rValue) { maStartPoint = rValue; } - + B2DPoint getEndPoint() const { return maEndPoint; } void setEndPoint(const B2DPoint& rValue) { maEndPoint = rValue; } - + B2DPoint getControlPointA() const { return maControlPointA; } void setControlPointA(const B2DPoint& rValue) { maControlPointA = rValue; } @@ -147,14 +147,14 @@ namespace basegfx value. No start point is added, but all necessary created edges and the end point - + @param rPoly Output polygon. The subdivided bezier segment is added to this polygon via B2DPolygon::append(). - + @param rCurve The cubic bezier curve to subdivide - + @param fDistanceBound Bound on the maximal distance of the approximation to the true curve. diff --git a/basegfx/inc/basegfx/curve/b2dquadraticbezier.hxx b/basegfx/inc/basegfx/curve/b2dquadraticbezier.hxx index 6680acdc45ca..0da07c1ec554 100644 --- a/basegfx/inc/basegfx/curve/b2dquadraticbezier.hxx +++ b/basegfx/inc/basegfx/curve/b2dquadraticbezier.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 @@ -37,15 +37,15 @@ namespace basegfx { class B2DQuadraticBezier { - ::basegfx::B2DPoint maStartPoint; - ::basegfx::B2DPoint maEndPoint; - ::basegfx::B2DPoint maControlPoint; + ::basegfx::B2DPoint maStartPoint; + ::basegfx::B2DPoint maEndPoint; + ::basegfx::B2DPoint maControlPoint; - public: + public: B2DQuadraticBezier(); B2DQuadraticBezier(const B2DQuadraticBezier& rBezier); B2DQuadraticBezier(const ::basegfx::B2DPoint& rStart, const ::basegfx::B2DPoint& rEnd); - B2DQuadraticBezier(const ::basegfx::B2DPoint& rStart, + B2DQuadraticBezier(const ::basegfx::B2DPoint& rStart, const ::basegfx::B2DPoint& rControlPoint, const ::basegfx::B2DPoint& rEnd); ~B2DQuadraticBezier(); @@ -62,10 +62,10 @@ namespace basegfx // data interface ::basegfx::B2DPoint getStartPoint() const { return maStartPoint; } void setStartPoint(const ::basegfx::B2DPoint& rValue) { maStartPoint = rValue; } - + ::basegfx::B2DPoint getEndPoint() const { return maEndPoint; } void setEndPoint(const ::basegfx::B2DPoint& rValue) { maEndPoint = rValue; } - + ::basegfx::B2DPoint getControlPoint() const { return maControlPoint; } void setControlPoint(const ::basegfx::B2DPoint& rValue) { maControlPoint = rValue; } }; diff --git a/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx b/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx index 04d9a2aaf734..e64d1dbb9101 100644 --- a/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx +++ b/basegfx/inc/basegfx/matrix/b2dhommatrix.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 @@ -129,14 +129,14 @@ namespace basegfx }; // Addition, Subtraktion - inline B2DHomMatrix operator+(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB) + inline B2DHomMatrix operator+(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB) { B2DHomMatrix aSum(rMatA); aSum += rMatB; return aSum; } - inline B2DHomMatrix operator-(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB) + inline B2DHomMatrix operator-(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB) { B2DHomMatrix aDiv(rMatA); aDiv -= rMatB; @@ -144,21 +144,21 @@ namespace basegfx } // Multiplikation, Division mit Konstante - inline B2DHomMatrix operator*(const B2DHomMatrix& rMat, double fValue) + inline B2DHomMatrix operator*(const B2DHomMatrix& rMat, double fValue) { - B2DHomMatrix aNew(rMat); - aNew *= fValue; - return aNew; + B2DHomMatrix aNew(rMat); + aNew *= fValue; + return aNew; } - inline B2DHomMatrix operator/(const B2DHomMatrix& rMat, double fValue) + inline B2DHomMatrix operator/(const B2DHomMatrix& rMat, double fValue) { - B2DHomMatrix aNew(rMat); + B2DHomMatrix aNew(rMat); aNew *= 1.0 / fValue; - return aNew; + return aNew; } - inline B2DHomMatrix operator*(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB) + inline B2DHomMatrix operator*(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB) { B2DHomMatrix aMul(rMatB); aMul *= rMatA; diff --git a/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx b/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx index a737719e4a30..1b310d5a14d2 100644 --- a/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx +++ b/basegfx/inc/basegfx/matrix/b2dhommatrixtools.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,11 +42,11 @@ namespace basegfx namespace tools { /** If the rotation angle is an approximate multiple of pi/2, - force fSin/fCos to -1/0/1, to maintain orthogonality (which - might also be advantageous for the other cases, but: for - multiples of pi/2, the exact values _can_ be attained. It - would be largely unintuitive, if a 180 degrees rotation - would introduce slight roundoff errors, instead of exactly + force fSin/fCos to -1/0/1, to maintain orthogonality (which + might also be advantageous for the other cases, but: for + multiples of pi/2, the exact values _can_ be attained. It + would be largely unintuitive, if a 180 degrees rotation + would introduce slight roundoff errors, instead of exactly mirroring the coordinate system) */ void createSinCosOrthogonal(double& o_rSin, double& rCos, double fRadiant); @@ -164,12 +164,12 @@ namespace basegfx } // data access - B2DHomMatrix getB2DHomMatrix() const + B2DHomMatrix getB2DHomMatrix() const { return createScaleShearXRotateTranslateB2DHomMatrix( maScale, mfShearX, mfRotate, maTranslate); } - + const B2DVector& getScale() const { return maScale; } const B2DVector& getTranslate() const { return maTranslate; } double getRotate() const { return mfRotate; } diff --git a/basegfx/inc/basegfx/matrix/b3dhommatrix.hxx b/basegfx/inc/basegfx/matrix/b3dhommatrix.hxx index f3face91ee21..1aee20844adb 100644 --- a/basegfx/inc/basegfx/matrix/b3dhommatrix.hxx +++ b/basegfx/inc/basegfx/matrix/b3dhommatrix.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 @@ -102,7 +102,7 @@ namespace basegfx void frustum(double fLeft = -1.0, double fRight = 1.0, double fBottom = -1.0, double fTop = 1.0, double fNear = 0.001, double fFar = 1.0); - + void ortho(double fLeft = -1.0, double fRight = 1.0, double fBottom = -1.0, double fTop = 1.0, double fNear = 0.0, double fFar = 1.0); @@ -136,14 +136,14 @@ namespace basegfx }; // addition, subtraction - inline B3DHomMatrix operator+(const B3DHomMatrix& rMatA, const B3DHomMatrix& rMatB) + inline B3DHomMatrix operator+(const B3DHomMatrix& rMatA, const B3DHomMatrix& rMatB) { B3DHomMatrix aSum(rMatA); aSum += rMatB; return aSum; } - inline B3DHomMatrix operator-(const B3DHomMatrix& rMatA, const B3DHomMatrix& rMatB) + inline B3DHomMatrix operator-(const B3DHomMatrix& rMatA, const B3DHomMatrix& rMatB) { B3DHomMatrix aDiv(rMatA); aDiv -= rMatB; @@ -151,21 +151,21 @@ namespace basegfx } // multiplication, division by constant value - inline B3DHomMatrix operator*(const B3DHomMatrix& rMat, double fValue) + inline B3DHomMatrix operator*(const B3DHomMatrix& rMat, double fValue) { - B3DHomMatrix aNew(rMat); - aNew *= fValue; - return aNew; + B3DHomMatrix aNew(rMat); + aNew *= fValue; + return aNew; } - inline B3DHomMatrix operator/(const B3DHomMatrix& rMat, double fValue) + inline B3DHomMatrix operator/(const B3DHomMatrix& rMat, double fValue) { - B3DHomMatrix aNew(rMat); + B3DHomMatrix aNew(rMat); aNew *= 1.0 / fValue; - return aNew; + return aNew; } - inline B3DHomMatrix operator*(const B3DHomMatrix& rMatA, const B3DHomMatrix& rMatB) + inline B3DHomMatrix operator*(const B3DHomMatrix& rMatA, const B3DHomMatrix& rMatB) { B3DHomMatrix aMul(rMatB); aMul *= rMatA; diff --git a/basegfx/inc/basegfx/numeric/ftools.hxx b/basegfx/inc/basegfx/numeric/ftools.hxx index bc9a1c554187..a235f0a969b9 100644 --- a/basegfx/inc/basegfx/numeric/ftools.hxx +++ b/basegfx/inc/basegfx/numeric/ftools.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,25 +35,25 @@ // standard PI defines from solar.h, but we do not want to link against tools #ifndef F_PI -#define F_PI M_PI +#define F_PI M_PI #endif #ifndef F_PI2 -#define F_PI2 M_PI_2 +#define F_PI2 M_PI_2 #endif #ifndef F_PI4 -#define F_PI4 M_PI_4 +#define F_PI4 M_PI_4 #endif #ifndef F_PI180 -#define F_PI180 (M_PI/180.0) +#define F_PI180 (M_PI/180.0) #endif #ifndef F_PI1800 -#define F_PI1800 (M_PI/1800.0) +#define F_PI1800 (M_PI/1800.0) #endif #ifndef F_PI18000 -#define F_PI18000 (M_PI/18000.0) +#define F_PI18000 (M_PI/18000.0) #endif #ifndef F_2PI -#define F_2PI (2.0*M_PI) +#define F_2PI (2.0*M_PI) #endif ////////////////////////////////////////////////////////////////////////////// @@ -68,16 +68,16 @@ namespace basegfx inline sal_Int32 fround( double fVal ) { return fVal > 0.0 ? static_cast<sal_Int32>( fVal + .5 ) : -static_cast<sal_Int32>( -fVal + .5 ); - } + } /** Round double to nearest integer - - @return the nearest 64 bit integer + + @return the nearest 64 bit integer */ inline sal_Int64 fround64( double fVal ) { return fVal > 0.0 ? static_cast<sal_Int64>( fVal + .5 ) : -static_cast<sal_Int64>( -fVal + .5 ); - } + } /** Prune a small epsilon range around zero. @@ -98,9 +98,9 @@ namespace basegfx // just use the full comparison. I keep the original here, maybe there will be a better // solution some day. // - //return fVal < 0.0 ? + //return fVal < 0.0 ? // (::std::min(fVal,-0.00001)) : - // (::std::max(fVal,0.00001)); + // (::std::max(fVal,0.00001)); if(fVal < 0.0) return (fVal < -0.00001 ? fVal : -0.00001); @@ -128,17 +128,17 @@ namespace basegfx /** Convert value from degrees to radians */ - inline double deg2rad( double v ) - { + inline double deg2rad( double v ) + { // divide first, to get exact values for v being a multiple of // 90 degrees - return v / 90.0 * M_PI_2; + return v / 90.0 * M_PI_2; } /** Convert value radians to degrees */ - inline double rad2deg( double v ) - { + inline double rad2deg( double v ) + { // divide first, to get exact values for v being a multiple of // pi/2 return v / M_PI_2 * 90.0; @@ -148,7 +148,7 @@ namespace basegfx class fTools { /// Threshold value for equalZero() - static double mfSmallValue; + static double mfSmallValue; public: /// Get threshold value for equalZero and friends @@ -157,46 +157,46 @@ namespace basegfx static void setSmallValue(const double& rfNew) { mfSmallValue = rfNew; } /// Compare against small value - static bool equalZero(const double& rfVal) - { - return (fabs(rfVal) <= getSmallValue()); + static bool equalZero(const double& rfVal) + { + return (fabs(rfVal) <= getSmallValue()); } /// Compare against given small value - static bool equalZero(const double& rfVal, const double& rfSmallValue) - { - return (fabs(rfVal) <= rfSmallValue); + static bool equalZero(const double& rfVal, const double& rfSmallValue) + { + return (fabs(rfVal) <= rfSmallValue); } - static bool equal(const double& rfValA, const double& rfValB) - { + static bool equal(const double& rfValA, const double& rfValB) + { // changed to approxEqual usage for better numerical correctness return rtl::math::approxEqual(rfValA, rfValB); } - static bool equal(const double& rfValA, const double& rfValB, const double& rfSmallValue) - { - return (fabs(rfValA - rfValB) <= rfSmallValue); + static bool equal(const double& rfValA, const double& rfValB, const double& rfSmallValue) + { + return (fabs(rfValA - rfValB) <= rfSmallValue); } - static bool less(const double& rfValA, const double& rfValB) - { - return (rfValA < rfValB && !equal(rfValA, rfValB)); + static bool less(const double& rfValA, const double& rfValB) + { + return (rfValA < rfValB && !equal(rfValA, rfValB)); } - static bool lessOrEqual(const double& rfValA, const double& rfValB) - { - return (rfValA < rfValB || equal(rfValA, rfValB)); + static bool lessOrEqual(const double& rfValA, const double& rfValB) + { + return (rfValA < rfValB || equal(rfValA, rfValB)); } - static bool more(const double& rfValA, const double& rfValB) - { - return (rfValA > rfValB && !equal(rfValA, rfValB)); + static bool more(const double& rfValA, const double& rfValB) + { + return (rfValA > rfValB && !equal(rfValA, rfValB)); } - static bool moreOrEqual(const double& rfValA, const double& rfValB) - { - return (rfValA > rfValB || equal(rfValA, rfValB)); + static bool moreOrEqual(const double& rfValA, const double& rfValB) + { + return (rfValA > rfValB || equal(rfValA, rfValB)); } }; } // end of namespace basegfx diff --git a/basegfx/inc/basegfx/pixel/bpixel.hxx b/basegfx/inc/basegfx/pixel/bpixel.hxx index fcc2fdfba2a4..7890ef4199a1 100644 --- a/basegfx/inc/basegfx/pixel/bpixel.hxx +++ b/basegfx/inc/basegfx/pixel/bpixel.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 @@ -48,16 +48,16 @@ namespace basegfx struct { // bitfield - unsigned mnR : 8; // red intensity - unsigned mnG : 8; // green intensity - unsigned mnB : 8; // blue intensity - unsigned mnO : 8; // opacity, 0 == full transparence + unsigned mnR : 8; // red intensity + unsigned mnG : 8; // green intensity + unsigned mnB : 8; // blue intensity + unsigned mnO : 8; // opacity, 0 == full transparence } maRGBO; - + struct { // bitfield - unsigned mnValue : 32; // all values + unsigned mnValue : 32; // all values } maCombinedRGBO; } maPixelUnion; @@ -97,10 +97,10 @@ namespace basegfx {} // assignment operator - BPixel& operator=( const BPixel& rPixel ) - { + BPixel& operator=( const BPixel& rPixel ) + { maPixelUnion.maCombinedRGBO.mnValue = rPixel.maPixelUnion.maCombinedRGBO.mnValue; - return *this; + return *this; } // data access read @@ -124,13 +124,13 @@ namespace basegfx bool isEmpty() const { return isInvisible(); } bool isUsed() const { return isVisible(); } - bool operator==( const BPixel& rPixel ) const - { + bool operator==( const BPixel& rPixel ) const + { return (rPixel.maPixelUnion.maCombinedRGBO.mnValue == maPixelUnion.maCombinedRGBO.mnValue); } - bool operator!=( const BPixel& rPixel ) const - { + bool operator!=( const BPixel& rPixel ) const + { return (rPixel.maPixelUnion.maCombinedRGBO.mnValue != maPixelUnion.maCombinedRGBO.mnValue); } @@ -141,28 +141,28 @@ namespace basegfx ////////////////////////////////////////////////////////////////////////// // external operators - inline BPixel minimum(const BPixel& rTupA, const BPixel& rTupB) - { + inline BPixel minimum(const BPixel& rTupA, const BPixel& rTupB) + { BPixel aMin( (rTupB.getRed() < rTupA.getRed()) ? rTupB.getRed() : rTupA.getRed(), (rTupB.getGreen() < rTupA.getGreen()) ? rTupB.getGreen() : rTupA.getGreen(), (rTupB.getBlue() < rTupA.getBlue()) ? rTupB.getBlue() : rTupA.getBlue(), - (rTupB.getOpacity() < rTupA.getOpacity()) ? rTupB.getOpacity() : rTupA.getOpacity()); + (rTupB.getOpacity() < rTupA.getOpacity()) ? rTupB.getOpacity() : rTupA.getOpacity()); return aMin; } - inline BPixel maximum(const BPixel& rTupA, const BPixel& rTupB) - { + inline BPixel maximum(const BPixel& rTupA, const BPixel& rTupB) + { BPixel aMax( (rTupB.getRed() > rTupA.getRed()) ? rTupB.getRed() : rTupA.getRed(), (rTupB.getGreen() > rTupA.getGreen()) ? rTupB.getGreen() : rTupA.getGreen(), (rTupB.getBlue() > rTupA.getBlue()) ? rTupB.getBlue() : rTupA.getBlue(), - (rTupB.getOpacity() > rTupA.getOpacity()) ? rTupB.getOpacity() : rTupA.getOpacity()); + (rTupB.getOpacity() > rTupA.getOpacity()) ? rTupB.getOpacity() : rTupA.getOpacity()); return aMax; } - inline BPixel interpolate(const BPixel& rOld1, const BPixel& rOld2, double t) - { + inline BPixel interpolate(const BPixel& rOld1, const BPixel& rOld2, double t) + { if(rOld1 == rOld2) { return rOld1; @@ -187,8 +187,8 @@ namespace basegfx } } - inline BPixel average(const BPixel& rOld1, const BPixel& rOld2) - { + inline BPixel average(const BPixel& rOld1, const BPixel& rOld2) + { if(rOld1 == rOld2) { return rOld1; @@ -202,9 +202,9 @@ namespace basegfx (sal_uInt8)(((sal_uInt32)rOld1.getOpacity() + (sal_uInt32)rOld2.getOpacity()) >> 1L)); } } - + inline BPixel average(const BPixel& rOld1, const BPixel& rOld2, const BPixel& rOld3) - { + { if(rOld1 == rOld2 && rOld2 == rOld3) { return rOld1; diff --git a/basegfx/inc/basegfx/point/b2dhompoint.hxx b/basegfx/inc/basegfx/point/b2dhompoint.hxx index 2736edaedde8..bccea8d783e7 100644 --- a/basegfx/inc/basegfx/point/b2dhompoint.hxx +++ b/basegfx/inc/basegfx/point/b2dhompoint.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,18 +50,18 @@ namespace basegfx { protected: /// This member contains the coordinate part of the point - ::basegfx::B2DTuple maTuple; + ::basegfx::B2DTuple maTuple; /// This Member holds the homogenous part of the point - double mfW; + double mfW; - /** Test if this homogen point does have a homogenous part + /** Test if this homogen point does have a homogenous part @return Returns true if this point has no homogenous part */ bool implIsHomogenized() const; - - /** Remove homogenous part of this Point + + /** Remove homogenous part of this Point This method does necessary calculations to remove the evtl. homogenous part of this Point. This may @@ -69,7 +69,7 @@ namespace basegfx */ void implHomogenize(); - /** Test and on demand remove homogenous part + /** Test and on demand remove homogenous part This method tests if this Point does have a homogenous part and then evtl. takes actions to remove that part. @@ -81,87 +81,87 @@ namespace basegfx */ void implTestAndHomogenize() const; - public: - /** Create a homogen point + public: + /** Create a homogen point The point is initialized to (0.0, 0.0) */ - B2DHomPoint() - : maTuple(), + B2DHomPoint() + : maTuple(), mfW(1.0) {} - /** Create a homogen point + /** Create a homogen point @param fX This parameter is used to initialize the X-coordinate of the Point. The homogenous part is initialized to 1.0. - + @param fY This parameter is used to initialize the Y-coordinate of the Point. The homogenous part is initialized to 1.0. */ - B2DHomPoint(double fX, double fY) - : maTuple(fX, fY), + B2DHomPoint(double fX, double fY) + : maTuple(fX, fY), mfW(1.0) {} - /** Create a copy of a 2D Point + /** Create a copy of a 2D Point @param rVec - The 2D point which will be copied. The homogenous part + The 2D point which will be copied. The homogenous part is initialized to 1.0. */ - B2DHomPoint(const B2DPoint& rVec) - : maTuple(rVec), + B2DHomPoint(const B2DPoint& rVec) + : maTuple(rVec), mfW(1.0) {} - /** Create a copy of a homogen point + /** Create a copy of a homogen point @param rVec - The homogen point which will be copied. The homogenous part + The homogen point which will be copied. The homogenous part is copied, too. */ - B2DHomPoint(const B2DHomPoint& rVec) - : maTuple(rVec.maTuple.getX(), rVec.maTuple.getY()), + B2DHomPoint(const B2DHomPoint& rVec) + : maTuple(rVec.maTuple.getX(), rVec.maTuple.getY()), mfW(rVec.mfW) {} - ~B2DHomPoint() + ~B2DHomPoint() {} - /** Get a 2D point from this homogenous point + /** Get a 2D point from this homogenous point This method normalizes this homogen point if necessary and returns the corresponding 2D point for this homogen point. - + @attention Even when this method is const it may change all members of this instance. */ B2DPoint getB2DPoint() const; - /** Get X-coordinate + /** Get X-coordinate This method normalizes this homogen point if necessary and returns the corresponding X-coordinate for this homogen point. - + @attention Even when this method is const it may change all members of this instance. */ double getX() const; - /** Get Y-coordinate + /** Get Y-coordinate This method normalizes this homogen point if necessary and returns the corresponding Y-coordinate for this homogen point. - + @attention Even when this method is const it may change all members of this instance. */ double getY() const; - /** Set X-coordinate of the homogen point. + /** Set X-coordinate of the homogen point. This method sets the X-coordinate of the homogen point. If the point does have a homogenous part this is taken into account. @@ -171,7 +171,7 @@ namespace basegfx */ void setX(double fX); - /** Set Y-coordinate of the homogen point. + /** Set Y-coordinate of the homogen point. This method sets the Y-coordinate of the homogen point. If the point does have a homogenous part this is taken into account. @@ -187,7 +187,7 @@ namespace basegfx B2DHomPoint& operator+=( const B2DHomPoint& rPnt ); B2DHomPoint& operator-=( const B2DHomPoint& rPnt ); - + B2DHomPoint& operator*=(double t); B2DHomPoint& operator*=( const B2DHomMatrix& rMat ); @@ -195,11 +195,11 @@ namespace basegfx B2DHomPoint& operator/=(double t); B2DHomPoint& operator-(void); - + bool operator==( const B2DHomPoint& rPnt ) const; bool operator!=( const B2DHomPoint& rPnt ) const; - + B2DHomPoint& operator=( const B2DHomPoint& rPnt ); }; @@ -215,7 +215,7 @@ namespace basegfx B2DHomPoint interpolate(B2DHomPoint& rOld1, B2DHomPoint& rOld2, double t); B2DHomPoint average(B2DHomPoint& rOld1, B2DHomPoint& rOld2); - + B2DHomPoint average(B2DHomPoint& rOld1, B2DHomPoint& rOld2, B2DHomPoint& rOld3); B2DHomPoint operator+(const B2DHomPoint& rVecA, const B2DHomPoint& rVecB); diff --git a/basegfx/inc/basegfx/point/b2dpoint.hxx b/basegfx/inc/basegfx/point/b2dpoint.hxx index 2b652d64afb8..19ca6e3a70ca 100644 --- a/basegfx/inc/basegfx/point/b2dpoint.hxx +++ b/basegfx/inc/basegfx/point/b2dpoint.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 @@ -49,73 +49,73 @@ namespace basegfx */ class B2DPoint : public ::basegfx::B2DTuple { - public: - /** Create a 2D Point + public: + /** Create a 2D Point The point is initialized to (0.0, 0.0) */ - B2DPoint() - : B2DTuple() + B2DPoint() + : B2DTuple() {} - /** Create a 2D Point + /** Create a 2D Point @param fX This parameter is used to initialize the X-coordinate of the 2D Point. - + @param fY This parameter is used to initialize the Y-coordinate of the 2D Point. */ - B2DPoint(double fX, double fY) - : B2DTuple(fX, fY) + B2DPoint(double fX, double fY) + : B2DTuple(fX, fY) {} - /** Create a copy of a 2D Point + /** Create a copy of a 2D Point @param rPoint The 2D Point which will be copied. */ - B2DPoint(const B2DPoint& rPoint) - : B2DTuple(rPoint) + B2DPoint(const B2DPoint& rPoint) + : B2DTuple(rPoint) {} - /** Create a copy of a 2D Point + /** Create a copy of a 2D Point @param rPoint The 2D Point which will be copied. */ - B2DPoint(const ::basegfx::B2IPoint& rPoint) - : B2DTuple(rPoint) + B2DPoint(const ::basegfx::B2IPoint& rPoint) + : B2DTuple(rPoint) {} /** constructor with tuple to allow copy-constructing from B2DTuple-based classes */ - B2DPoint(const ::basegfx::B2DTuple& rTuple) - : B2DTuple(rTuple) + B2DPoint(const ::basegfx::B2DTuple& rTuple) + : B2DTuple(rTuple) {} - ~B2DPoint() + ~B2DPoint() {} /** *=operator to allow usage from B2DPoint, too */ - B2DPoint& operator*=( const B2DPoint& rPnt ) - { + B2DPoint& operator*=( const B2DPoint& rPnt ) + { mfX *= rPnt.mfX; - mfY *= rPnt.mfY; - return *this; + mfY *= rPnt.mfY; + return *this; } /** *=operator to allow usage from B2DPoint, too */ - B2DPoint& operator*=(double t) - { - mfX *= t; - mfY *= t; - return *this; + B2DPoint& operator*=(double t) + { + mfX *= t; + mfY *= t; + return *this; } /** assignment operator to allow assigning the results @@ -140,7 +140,7 @@ namespace basegfx ////////////////////////////////////////////////////////////////////////// /** Transform B2DPoint by given transformation matrix. - + Since this is a Point, translational components of the matrix are used. */ diff --git a/basegfx/inc/basegfx/point/b2ipoint.hxx b/basegfx/inc/basegfx/point/b2ipoint.hxx index c9ec03108b22..2c4cff939c7a 100644 --- a/basegfx/inc/basegfx/point/b2ipoint.hxx +++ b/basegfx/inc/basegfx/point/b2ipoint.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 @@ -46,64 +46,64 @@ namespace basegfx */ class B2IPoint : public ::basegfx::B2ITuple { - public: - /** Create a 2D Point + public: + /** Create a 2D Point The point is initialized to (0, 0) */ - B2IPoint() - : B2ITuple() + B2IPoint() + : B2ITuple() {} - /** Create a 2D Point + /** Create a 2D Point @param nX This parameter is used to initialize the X-coordinate of the 2D Point. - + @param nY This parameter is used to initialize the Y-coordinate of the 2D Point. */ - B2IPoint(sal_Int32 nX, sal_Int32 nY) - : B2ITuple(nX, nY) + B2IPoint(sal_Int32 nX, sal_Int32 nY) + : B2ITuple(nX, nY) {} - /** Create a copy of a 2D Point + /** Create a copy of a 2D Point @param rPoint The 2D Point which will be copied. */ - B2IPoint(const B2IPoint& rPoint) - : B2ITuple(rPoint) + B2IPoint(const B2IPoint& rPoint) + : B2ITuple(rPoint) {} /** constructor with tuple to allow copy-constructing from B2ITuple-based classes */ - B2IPoint(const ::basegfx::B2ITuple& rTuple) - : B2ITuple(rTuple) + B2IPoint(const ::basegfx::B2ITuple& rTuple) + : B2ITuple(rTuple) {} - ~B2IPoint() + ~B2IPoint() {} /** *=operator to allow usage from B2IPoint, too */ - B2IPoint& operator*=( const B2IPoint& rPnt ) - { + B2IPoint& operator*=( const B2IPoint& rPnt ) + { mnX *= rPnt.mnX; - mnY *= rPnt.mnY; - return *this; + mnY *= rPnt.mnY; + return *this; } /** *=operator to allow usage from B2IPoint, too */ - B2IPoint& operator*=(sal_Int32 t) - { - mnX *= t; - mnY *= t; - return *this; + B2IPoint& operator*=(sal_Int32 t) + { + mnX *= t; + mnY *= t; + return *this; } /** assignment operator to allow assigning the results diff --git a/basegfx/inc/basegfx/point/b3dhompoint.hxx b/basegfx/inc/basegfx/point/b3dhompoint.hxx index 763997620bd0..3bea4d66f2ac 100644 --- a/basegfx/inc/basegfx/point/b3dhompoint.hxx +++ b/basegfx/inc/basegfx/point/b3dhompoint.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,22 +50,22 @@ namespace basegfx { protected: /// This member contains the coordinate part of the point - ::basegfx::B3DTuple maTuple; - + ::basegfx::B3DTuple maTuple; + /// This Member holds the homogenous part of the point - double mfW; + double mfW; - /** Test if this homogen point does have a homogenous part + /** Test if this homogen point does have a homogenous part @return Returns true if this point has no homogenous part */ - bool implIsHomogenized() const - { + bool implIsHomogenized() const + { const double fOne(1.0); - return ::basegfx::fTools::equal(mfW, fOne); + return ::basegfx::fTools::equal(mfW, fOne); } - - /** Remove homogenous part of this Point + + /** Remove homogenous part of this Point This method does necessary calculations to remove the evtl. homogenous part of this Point. This may @@ -73,7 +73,7 @@ namespace basegfx */ void implHomogenize(); - /** Test and on demand remove homogenous part + /** Test and on demand remove homogenous part This method tests if this Point does have a homogenous part and then evtl. takes actions to remove that part. @@ -89,65 +89,65 @@ namespace basegfx ((B3DHomPoint*)this)->implHomogenize(); } - public: - /** Create a homogen point + public: + /** Create a homogen point The point is initialized to (0.0, 0.0, 0.0) */ - B3DHomPoint() - : maTuple(), + B3DHomPoint() + : maTuple(), mfW(1.0) {} - /** Create a homogen point + /** Create a homogen point @param fX This parameter is used to initialize the X-coordinate of the Point. The homogenous part is initialized to 1.0. - + @param fY This parameter is used to initialize the Y-coordinate of the Point. The homogenous part is initialized to 1.0. - + @param fZ This parameter is used to initialize the Z-coordinate of the Point. The homogenous part is initialized to 1.0. */ - B3DHomPoint(double fX, double fY, double fZ) - : maTuple(fX, fY, fZ), + B3DHomPoint(double fX, double fY, double fZ) + : maTuple(fX, fY, fZ), mfW(1.0) {} - /** Create a copy of a 3D Point + /** Create a copy of a 3D Point @param rVec - The 3D point which will be copied. The homogenous part + The 3D point which will be copied. The homogenous part is initialized to 1.0. */ - B3DHomPoint(const B3DPoint& rVec) - : maTuple(rVec), + B3DHomPoint(const B3DPoint& rVec) + : maTuple(rVec), mfW(1.0) {} - /** Create a copy of a homogen point + /** Create a copy of a homogen point @param rVec - The homogen point which will be copied. The homogenous part + The homogen point which will be copied. The homogenous part is copied, too. */ - B3DHomPoint(const B3DHomPoint& rVec) - : maTuple(rVec.maTuple.getX(), rVec.maTuple.getY(), rVec.maTuple.getZ()), + B3DHomPoint(const B3DHomPoint& rVec) + : maTuple(rVec.maTuple.getX(), rVec.maTuple.getY(), rVec.maTuple.getZ()), mfW(rVec.mfW) {} - ~B3DHomPoint() + ~B3DHomPoint() {} - /** get a 3D point from this homogenous point + /** get a 3D point from this homogenous point This method normalizes this homogen point if necessary and returns the corresponding 3D point for this homogen point. - + @attention Even when this method is const it may change all members of this instance. */ @@ -157,49 +157,49 @@ namespace basegfx return B3DPoint(maTuple.getX(), maTuple.getY(), maTuple.getZ()); } - /** get X-coordinate + /** get X-coordinate This method normalizes this homogen point if necessary and returns the corresponding X-coordinate for this homogen point. - + @attention Even when this method is const it may change all members of this instance. */ double getX() const - { + { implTestAndHomogenize(); - return maTuple.getX(); + return maTuple.getX(); } - /** get Y-coordinate + /** get Y-coordinate This method normalizes this homogen point if necessary and returns the corresponding Y-coordinate for this homogen point. - + @attention Even when this method is const it may change all members of this instance. */ double getY() const - { + { implTestAndHomogenize(); - return maTuple.getY(); + return maTuple.getY(); } - /** get Z-coordinate + /** get Z-coordinate This method normalizes this homogen point if necessary and returns the corresponding Z-coordinate for this homogen point. - + @attention Even when this method is const it may change all members of this instance. */ double getZ() const - { + { implTestAndHomogenize(); - return maTuple.getY(); + return maTuple.getY(); } - /** Set X-coordinate of the homogen point. + /** Set X-coordinate of the homogen point. This method sets the X-coordinate of the homogen point. If the point does have a homogenous part this is taken into account. @@ -212,7 +212,7 @@ namespace basegfx maTuple.setX(implIsHomogenized() ? fX : fX * mfW ); } - /** Set Y-coordinate of the homogen point. + /** Set Y-coordinate of the homogen point. This method sets the Y-coordinate of the homogen point. If the point does have a homogenous part this is taken into account. @@ -225,7 +225,7 @@ namespace basegfx maTuple.setY(implIsHomogenized() ? fY : fY * mfW ); } - /** Set Z-coordinate of the homogen point. + /** Set Z-coordinate of the homogen point. This method sets the Z-coordinate of the homogen point. If the point does have a homogenous part this is taken into account. @@ -241,8 +241,8 @@ namespace basegfx // operators ////////////////////////////////////////////////////////////////////// - B3DHomPoint& operator+=( const B3DHomPoint& rPnt ) - { + B3DHomPoint& operator+=( const B3DHomPoint& rPnt ) + { maTuple.setX(getX() * rPnt.mfW + rPnt.getX() * mfW); maTuple.setY(getY() * rPnt.mfW + rPnt.getY() * mfW); maTuple.setZ(getZ() * rPnt.mfW + rPnt.getZ() * mfW); @@ -251,8 +251,8 @@ namespace basegfx return *this; } - B3DHomPoint& operator-=( const B3DHomPoint& rPnt ) - { + B3DHomPoint& operator-=( const B3DHomPoint& rPnt ) + { maTuple.setX(getX() * rPnt.mfW - rPnt.getX() * mfW); maTuple.setY(getY() * rPnt.mfW - rPnt.getY() * mfW); maTuple.setZ(getZ() * rPnt.mfW - rPnt.getZ() * mfW); @@ -260,146 +260,146 @@ namespace basegfx return *this; } - - B3DHomPoint& operator*=(double t) - { + + B3DHomPoint& operator*=(double t) + { if(!::basegfx::fTools::equalZero(t)) { mfW /= t; } - return *this; + return *this; } - B3DHomPoint& operator/=(double t) - { + B3DHomPoint& operator/=(double t) + { mfW *= t; - return *this; + return *this; } B3DHomPoint& operator-(void) - { + { mfW = -mfW; return *this; } - - bool operator==( const B3DHomPoint& rPnt ) const - { + + bool operator==( const B3DHomPoint& rPnt ) const + { implTestAndHomogenize(); return (maTuple == rPnt.maTuple); } - bool operator!=( const B3DHomPoint& rPnt ) const - { + bool operator!=( const B3DHomPoint& rPnt ) const + { implTestAndHomogenize(); return (maTuple != rPnt.maTuple); } - - B3DHomPoint& operator=( const B3DHomPoint& rPnt ) - { + + B3DHomPoint& operator=( const B3DHomPoint& rPnt ) + { maTuple = rPnt.maTuple; mfW = rPnt.mfW; - return *this; + return *this; } }; // external operators ////////////////////////////////////////////////////////////////////////// - inline B3DHomPoint minimum(const B3DHomPoint& rVecA, const B3DHomPoint& rVecB) - { + inline B3DHomPoint minimum(const B3DHomPoint& rVecA, const B3DHomPoint& rVecB) + { B3DHomPoint aMin( (rVecB.getX() < rVecA.getX()) ? rVecB.getX() : rVecA.getX(), (rVecB.getY() < rVecA.getY()) ? rVecB.getY() : rVecA.getY(), - (rVecB.getZ() < rVecA.getZ()) ? rVecB.getZ() : rVecA.getZ()); + (rVecB.getZ() < rVecA.getZ()) ? rVecB.getZ() : rVecA.getZ()); return aMin; } - inline B3DHomPoint maximum(const B3DHomPoint& rVecA, const B3DHomPoint& rVecB) - { + inline B3DHomPoint maximum(const B3DHomPoint& rVecA, const B3DHomPoint& rVecB) + { B3DHomPoint aMax( (rVecB.getX() > rVecA.getX()) ? rVecB.getX() : rVecA.getX(), (rVecB.getY() > rVecA.getY()) ? rVecB.getY() : rVecA.getY(), - (rVecB.getZ() > rVecA.getZ()) ? rVecB.getZ() : rVecA.getZ()); + (rVecB.getZ() > rVecA.getZ()) ? rVecB.getZ() : rVecA.getZ()); return aMax; } - inline B3DHomPoint absolute(const B3DHomPoint& rVec) - { + inline B3DHomPoint absolute(const B3DHomPoint& rVec) + { B3DHomPoint aAbs( (0.0 > rVec.getX()) ? -rVec.getX() : rVec.getX(), (0.0 > rVec.getY()) ? -rVec.getY() : rVec.getY(), - (0.0 > rVec.getZ()) ? -rVec.getZ() : rVec.getZ()); + (0.0 > rVec.getZ()) ? -rVec.getZ() : rVec.getZ()); return aAbs; } - inline B3DHomPoint interpolate(B3DHomPoint& rOld1, B3DHomPoint& rOld2, double t) - { + inline B3DHomPoint interpolate(B3DHomPoint& rOld1, B3DHomPoint& rOld2, double t) + { B3DHomPoint aInt( ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(), ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY(), - ((rOld2.getZ() - rOld1.getZ()) * t) + rOld1.getZ()); + ((rOld2.getZ() - rOld1.getZ()) * t) + rOld1.getZ()); return aInt; } - inline B3DHomPoint average(B3DHomPoint& rOld1, B3DHomPoint& rOld2) - { + inline B3DHomPoint average(B3DHomPoint& rOld1, B3DHomPoint& rOld2) + { B3DHomPoint aAvg( (rOld1.getX() + rOld2.getX()) * 0.5, (rOld1.getY() + rOld2.getY()) * 0.5, - (rOld1.getZ() + rOld2.getZ()) * 0.5); + (rOld1.getZ() + rOld2.getZ()) * 0.5); return aAvg; } - + inline B3DHomPoint average(B3DHomPoint& rOld1, B3DHomPoint& rOld2, B3DHomPoint& rOld3) - { + { B3DHomPoint aAvg( (rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0), (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0), - (rOld1.getZ() + rOld2.getZ() + rOld3.getZ()) * (1.0 / 3.0)); + (rOld1.getZ() + rOld2.getZ() + rOld3.getZ()) * (1.0 / 3.0)); return aAvg; } inline B3DHomPoint operator+(const B3DHomPoint& rVecA, const B3DHomPoint& rVecB) - { - B3DHomPoint aSum(rVecA); - aSum += rVecB; - return aSum; + { + B3DHomPoint aSum(rVecA); + aSum += rVecB; + return aSum; } inline B3DHomPoint operator-(const B3DHomPoint& rVecA, const B3DHomPoint& rVecB) - { - B3DHomPoint aSub(rVecA); - aSub -= rVecB; - return aSub; + { + B3DHomPoint aSub(rVecA); + aSub -= rVecB; + return aSub; } inline B3DHomPoint operator*(const B3DHomPoint& rVec, double t) - { - B3DHomPoint aNew(rVec); - aNew *= t; - return aNew; + { + B3DHomPoint aNew(rVec); + aNew *= t; + return aNew; } inline B3DHomPoint operator*(double t, const B3DHomPoint& rVec) - { - B3DHomPoint aNew(rVec); - aNew *= t; - return aNew; + { + B3DHomPoint aNew(rVec); + aNew *= t; + return aNew; } inline B3DHomPoint operator/(const B3DHomPoint& rVec, double t) - { - B3DHomPoint aNew(rVec); - aNew /= t; - return aNew; + { + B3DHomPoint aNew(rVec); + aNew /= t; + return aNew; } inline B3DHomPoint operator/(double t, const B3DHomPoint& rVec) { - B3DHomPoint aNew(rVec); - aNew /= t; - return aNew; + B3DHomPoint aNew(rVec); + aNew /= t; + return aNew; } } // end of namespace basegfx diff --git a/basegfx/inc/basegfx/point/b3dpoint.hxx b/basegfx/inc/basegfx/point/b3dpoint.hxx index 96686efaf450..e2120a16bd94 100644 --- a/basegfx/inc/basegfx/point/b3dpoint.hxx +++ b/basegfx/inc/basegfx/point/b3dpoint.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 @@ -46,81 +46,81 @@ namespace basegfx */ class B3DPoint : public ::basegfx::B3DTuple { - public: - /** Create a 3D Point + public: + /** Create a 3D Point The point is initialized to (0.0, 0.0, 0.0) */ - B3DPoint() - : B3DTuple() + B3DPoint() + : B3DTuple() {} - /** Create a 3D Point + /** Create a 3D Point @param fX This parameter is used to initialize the X-coordinate of the 3D Point. - + @param fY This parameter is used to initialize the Y-coordinate of the 3D Point. - + @param fZ This parameter is used to initialize the Z-coordinate of the 3D Point. */ - B3DPoint(double fX, double fY, double fZ) - : B3DTuple(fX, fY, fZ) + B3DPoint(double fX, double fY, double fZ) + : B3DTuple(fX, fY, fZ) {} - /** Create a copy of a 3D Point + /** Create a copy of a 3D Point @param rVec The 3D Point which will be copied. */ - B3DPoint(const B3DPoint& rVec) - : B3DTuple(rVec) + B3DPoint(const B3DPoint& rVec) + : B3DTuple(rVec) {} /** constructor with tuple to allow copy-constructing from B3DTuple-based classes */ - B3DPoint(const ::basegfx::B3DTuple& rTuple) - : B3DTuple(rTuple) + B3DPoint(const ::basegfx::B3DTuple& rTuple) + : B3DTuple(rTuple) {} - ~B3DPoint() + ~B3DPoint() {} /** *=operator to allow usage from B3DPoint, too */ - B3DPoint& operator*=( const B3DPoint& rPnt ) - { + B3DPoint& operator*=( const B3DPoint& rPnt ) + { mfX *= rPnt.mfX; - mfY *= rPnt.mfY; - mfZ *= rPnt.mfZ; - return *this; + mfY *= rPnt.mfY; + mfZ *= rPnt.mfZ; + return *this; } /** *=operator to allow usage from B3DPoint, too */ - B3DPoint& operator*=(double t) - { - mfX *= t; - mfY *= t; - mfZ *= t; - return *this; + B3DPoint& operator*=(double t) + { + mfX *= t; + mfY *= t; + mfZ *= t; + return *this; } /** assignment operator to allow assigning the results of B3DTuple calculations */ - B3DPoint& operator=( const ::basegfx::B3DTuple& rVec ) - { + B3DPoint& operator=( const ::basegfx::B3DTuple& rVec ) + { mfX = rVec.getX(); - mfY = rVec.getY(); - mfZ = rVec.getZ(); - return *this; + mfY = rVec.getY(); + mfZ = rVec.getZ(); + return *this; } /** Transform point by given transformation matrix. @@ -140,7 +140,7 @@ namespace basegfx ////////////////////////////////////////////////////////////////////////// /** Transform B3DPoint by given transformation matrix. - + Since this is a Point, translational components of the matrix are used. */ diff --git a/basegfx/inc/basegfx/point/b3ipoint.hxx b/basegfx/inc/basegfx/point/b3ipoint.hxx index 17e63a00040c..ed84ed8c4bb9 100644 --- a/basegfx/inc/basegfx/point/b3ipoint.hxx +++ b/basegfx/inc/basegfx/point/b3ipoint.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 @@ -46,81 +46,81 @@ namespace basegfx */ class B3IPoint : public ::basegfx::B3ITuple { - public: - /** Create a 3D Point + public: + /** Create a 3D Point The point is initialized to (0, 0, 0) */ - B3IPoint() - : B3ITuple() + B3IPoint() + : B3ITuple() {} - /** Create a 3D Point + /** Create a 3D Point @param nX This parameter is used to initialize the X-coordinate of the 3D Point. - + @param nY This parameter is used to initialize the Y-coordinate of the 3D Point. - + @param nZ This parameter is used to initialize the Z-coordinate of the 3D Point. */ - B3IPoint(sal_Int32 nX, sal_Int32 nY, sal_Int32 nZ) - : B3ITuple(nX, nY, nZ) + B3IPoint(sal_Int32 nX, sal_Int32 nY, sal_Int32 nZ) + : B3ITuple(nX, nY, nZ) {} - /** Create a copy of a 3D Point + /** Create a copy of a 3D Point @param rVec The 3D Point which will be copied. */ - B3IPoint(const B3IPoint& rVec) - : B3ITuple(rVec) + B3IPoint(const B3IPoint& rVec) + : B3ITuple(rVec) {} /** constructor with tuple to allow copy-constructing from B3ITuple-based classes */ - B3IPoint(const ::basegfx::B3ITuple& rTuple) - : B3ITuple(rTuple) + B3IPoint(const ::basegfx::B3ITuple& rTuple) + : B3ITuple(rTuple) {} - ~B3IPoint() + ~B3IPoint() {} /** *=operator to allow usage from B3IPoint, too */ - B3IPoint& operator*=( const B3IPoint& rPnt ) - { + B3IPoint& operator*=( const B3IPoint& rPnt ) + { mnX *= rPnt.mnX; - mnY *= rPnt.mnY; - mnZ *= rPnt.mnZ; - return *this; + mnY *= rPnt.mnY; + mnZ *= rPnt.mnZ; + return *this; } /** *=operator to allow usage from B3IPoint, too */ - B3IPoint& operator*=(sal_Int32 t) - { - mnX *= t; - mnY *= t; - mnZ *= t; - return *this; + B3IPoint& operator*=(sal_Int32 t) + { + mnX *= t; + mnY *= t; + mnZ *= t; + return *this; } /** assignment operator to allow assigning the results of B3ITuple calculations */ - B3IPoint& operator=( const ::basegfx::B3ITuple& rVec ) - { + B3IPoint& operator=( const ::basegfx::B3ITuple& rVec ) + { mnX = rVec.getX(); - mnY = rVec.getY(); - mnZ = rVec.getZ(); - return *this; + mnY = rVec.getY(); + mnZ = rVec.getZ(); + return *this; } /** Transform point by given transformation matrix. diff --git a/basegfx/inc/basegfx/polygon/b2dlinegeometry.hxx b/basegfx/inc/basegfx/polygon/b2dlinegeometry.hxx index 87e44787c5b6..86fa47201c10 100644 --- a/basegfx/inc/basegfx/polygon/b2dlinegeometry.hxx +++ b/basegfx/inc/basegfx/polygon/b2dlinegeometry.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 @@ -43,7 +43,7 @@ namespace basegfx /** Create line start/end geometry element, mostly arrows and things like that. @param rCandidate - The polygon which needs to get that line ends and needs to have two points + The polygon which needs to get that line ends and needs to have two points at least. @param rArrow @@ -57,8 +57,8 @@ namespace basegfx defines the size of the element, it's describing the target width in X of the arrow. - @param fDockingPosition needs to be in [0.0 ..1.0] range, where 0.0 means - that the tip of the arrow will be aligned with the polygon start, 1.0 means + @param fDockingPosition needs to be in [0.0 ..1.0] range, where 0.0 means + that the tip of the arrow will be aligned with the polygon start, 1.0 means the bottom. The default of 0.5 describes a centered arrow. @param pConsumedLength @@ -74,8 +74,8 @@ namespace basegfx The Line start and end polygon, correctly rotated and scaled */ B2DPolyPolygon createAreaGeometryForLineStartEnd( - const B2DPolygon& rCandidate, - const B2DPolyPolygon& rArrow, + const B2DPolygon& rCandidate, + const B2DPolyPolygon& rArrow, bool bStart, double fWidth, double fCandidateLength = 0.0, // 0.0 -> calculate self @@ -85,9 +85,9 @@ namespace basegfx /** create filled polygon geometry for lines with a line width This method will create bezier based, fillable polygons which - will resample the curve if it was extended for the given half - line width. It will remove extrema positions from contained - bezier segments and get as close as possible and defined by + will resample the curve if it was extended for the given half + line width. It will remove extrema positions from contained + bezier segments and get as close as possible and defined by the given parameters to the ideal result. It will check edges for trivial bezier to avoid unnecessary @@ -114,7 +114,7 @@ namespace basegfx @param fMaxPartOfEdge Allows to influence from with relative length of a control vector - compared to it's edge a split is forced. The smaller, the more + compared to it's edge a split is forced. The smaller, the more subdivisions will be needed to create the filled geometry. Allowed range is cropped to [1.0 .. 0.01] @@ -130,10 +130,10 @@ namespace basegfx needed and defined. */ B2DPolyPolygon createAreaGeometry( - const B2DPolygon& rCandidate, - double fHalfLineWidth, - B2DLineJoin eJoin = B2DLINEJOIN_ROUND, - double fMaxAllowedAngle = (12.5 * F_PI180), + const B2DPolygon& rCandidate, + double fHalfLineWidth, + B2DLineJoin eJoin = B2DLINEJOIN_ROUND, + double fMaxAllowedAngle = (12.5 * F_PI180), double fMaxPartOfEdge = 0.4, double fMiterMinimumAngle = (15.0 * F_PI180)); } // end of namespace tools diff --git a/basegfx/inc/basegfx/polygon/b2dpolygon.hxx b/basegfx/inc/basegfx/polygon/b2dpolygon.hxx index 60d6c7a18d70..65b56ad6c4ae 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolygon.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolygon.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 @@ -113,11 +113,11 @@ namespace basegfx B2VectorContinuity getContinuityInPoint(sal_uInt32 nIndex) const; /** check edge for being a bezier segment - - This test the existance of control vectors, but do not apply - testAndSolveTrivialBezier() to the bezier segment, so it is still useful + + This test the existance of control vectors, but do not apply + testAndSolveTrivialBezier() to the bezier segment, so it is still useful to do so. - Since it can use internal data representations, it is faster + Since it can use internal data representations, it is faster than using getBezierSegment() and applying isBezier() on it. @param nIndex @@ -127,14 +127,14 @@ namespace basegfx true if edge exists and at least one control vector is used */ bool isBezierSegment(sal_uInt32 nIndex) const; - + /** bezier segment access - + This method also works when it is no bezier segment at all and will fill the given B2DCubicBezier as needed. In any case, the given B2DCubicBezier will be filled, if necessary with the single start point (if no valid edge exists). - + @param nIndex Index of the addressed edge's start point @@ -181,18 +181,18 @@ namespace basegfx (a) the range of the polygon points (b) the range of the polygon points and control points (c) the outer range of the subdivided bezier curve - - Ranges (a) and (c) are produced by tools::getRange(); resp. this + + Ranges (a) and (c) are produced by tools::getRange(); resp. this getB2DRange(). tools::getRangeWithControlPoints handles case (b). - - To get range (c) a simple solution would be to subdivide the polygon - and use getRange() on it. Since subdivision is expensive and decreases + + To get range (c) a simple solution would be to subdivide the polygon + and use getRange() on it. Since subdivision is expensive and decreases the polygon quality, i added this new method. It will use a methodology suggested by HDU. First, it gets the range (a). Then it iterates over the bezier segments and for each it first tests if the outer range of the bezier segment is already contained in the result range. - + The subdivision itself uses getAllExtremumPositions() to only calculate extremum points and to expand the result accordingly. Thus it calculates maximal four extremum points on the bezier diff --git a/basegfx/inc/basegfx/polygon/b2dpolygonclipper.hxx b/basegfx/inc/basegfx/polygon/b2dpolygonclipper.hxx index 9915ddf4be87..0e26017489cd 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolygonclipper.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolygonclipper.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 diff --git a/basegfx/inc/basegfx/polygon/b2dpolygoncutandtouch.hxx b/basegfx/inc/basegfx/polygon/b2dpolygoncutandtouch.hxx index 6a6a8ba650e3..7d88ca8f8c78 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolygoncutandtouch.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolygoncutandtouch.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 @@ -66,7 +66,7 @@ namespace basegfx B2DPolygon addPointsAtCuts(const B2DPolygon& rCandidate, const B2DPolyPolygon& rMask); B2DPolyPolygon addPointsAtCuts(const B2DPolyPolygon& rCandidate, const B2DPolyPolygon& rMask); - // look for self-intersections in given polygon and add extra points there. Result will have no + // look for self-intersections in given polygon and add extra points there. Result will have no // intersections on an edge B2DPolygon addPointsAtCuts(const B2DPolygon& rCandidate); diff --git a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx index 1ac4fd9d2af5..51157cdde5a1 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolygontools.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 @@ -52,7 +52,7 @@ namespace basegfx void openWithGeometryChange(B2DPolygon& rCandidate); void closeWithGeometryChange(B2DPolygon& rCandidate); - /** Check if given polygon is closed. + /** Check if given polygon is closed. This is kind of a 'classic' method to support old polygon definitions. Those old polygon definitions define the @@ -89,7 +89,7 @@ namespace basegfx B2DRange getRangeWithControlPoints(const B2DPolygon& rCandidate); /** Get the range of a polygon - + This method creates the outer range of the subdivided bezier curve. For detailed discussion see B2DPolygon::getB2DRange() @@ -125,13 +125,13 @@ namespace basegfx // get a snippet from given polygon for absolute distances. The polygon is assumed // to be opened (not closed). fFrom and fTo need to be in range [0.0 .. fLength], where - // fTo >= fFrom. If length is given, it is assumed the correct polygon length, + // fTo >= fFrom. If length is given, it is assumed the correct polygon length, // if 0.0 it is calculated using getLength(...) B2DPolygon getSnippetAbsolute(const B2DPolygon& rCandidate, double fFrom, double fTo, double fLength = 0.0); // get a snippet from given polygon for relative distances. The polygon is assumed // to be opened (not closed). fFrom and fTo need to be in range [0.0 .. 1.0], where - // fTo >= fFrom. If length is given, it is assumed the correct polygon length, + // fTo >= fFrom. If length is given, it is assumed the correct polygon length, // if 0.0 it is calculated using getLength(...) B2DPolygon getSnippetRelative(const B2DPolygon& rCandidate, double fFrom = 0.0, double fTo = 1.0, double fLength = 0.0); @@ -150,22 +150,22 @@ namespace basegfx // Definitions for the cut flags used from the findCut methods typedef sal_uInt16 CutFlagValue; - #define CUTFLAG_NONE (0x0000) - #define CUTFLAG_LINE (0x0001) - #define CUTFLAG_START1 (0x0002) - #define CUTFLAG_START2 (0x0004) - #define CUTFLAG_END1 (0x0008) - #define CUTFLAG_END2 (0x0010) - #define CUTFLAG_ALL (CUTFLAG_LINE|CUTFLAG_START1|CUTFLAG_START2|CUTFLAG_END1|CUTFLAG_END2) - #define CUTFLAG_DEFAULT (CUTFLAG_LINE|CUTFLAG_START2|CUTFLAG_END2) + #define CUTFLAG_NONE (0x0000) + #define CUTFLAG_LINE (0x0001) + #define CUTFLAG_START1 (0x0002) + #define CUTFLAG_START2 (0x0004) + #define CUTFLAG_END1 (0x0008) + #define CUTFLAG_END2 (0x0010) + #define CUTFLAG_ALL (CUTFLAG_LINE|CUTFLAG_START1|CUTFLAG_START2|CUTFLAG_END1|CUTFLAG_END2) + #define CUTFLAG_DEFAULT (CUTFLAG_LINE|CUTFLAG_START2|CUTFLAG_END2) // Calculate cut between the points given by the two indices. pCut1 // and pCut2 will contain the cut coordinate on each edge in ]0.0, 1.0] // (if given) and the return value will contain a cut description. CutFlagValue findCut( const B2DPolygon& rCandidate, - sal_uInt32 nIndex1, sal_uInt32 nIndex2, - CutFlagValue aCutFlags = CUTFLAG_DEFAULT, + sal_uInt32 nIndex1, sal_uInt32 nIndex2, + CutFlagValue aCutFlags = CUTFLAG_DEFAULT, double* pCut1 = 0L, double* pCut2 = 0L); // This version is working with two indexed edges from different @@ -173,7 +173,7 @@ namespace basegfx CutFlagValue findCut( const B2DPolygon& rCandidate1, sal_uInt32 nIndex1, const B2DPolygon& rCandidate2, sal_uInt32 nIndex2, - CutFlagValue aCutFlags = CUTFLAG_DEFAULT, + CutFlagValue aCutFlags = CUTFLAG_DEFAULT, double* pCut1 = 0L, double* pCut2 = 0L); // This version works with two points and vectors to define the @@ -189,8 +189,8 @@ namespace basegfx // value in pCut (if provided) bool isPointOnEdge( const B2DPoint& rPoint, - const B2DPoint& rEdgeStart, - const B2DVector& rEdgeDelta, + const B2DPoint& rEdgeStart, + const B2DVector& rEdgeDelta, double* pCut = 0L); /** Apply given LineDashing to given polygon @@ -198,8 +198,8 @@ namespace basegfx This method is used to cut down line polygons to the needed pieces when a dashing needs to be applied. It is now capable of keeping contained bezier segments. - It is also capable of delivering line and non-line portions - depending on what target polygons You provide. This is useful + It is also capable of delivering line and non-line portions + depending on what target polygons You provide. This is useful e.g. for dashed lines with two colors. If the last and the first snippet in one of the results have a common start/end ppoint, they will be merged to achieve as @@ -227,8 +227,8 @@ namespace basegfx be calculated internally. */ void applyLineDashing( - const B2DPolygon& rCandidate, - const ::std::vector<double>& rDotDashArray, + const B2DPolygon& rCandidate, + const ::std::vector<double>& rDotDashArray, B2DPolyPolygon* pLineTarget, B2DPolyPolygon* pGapTarget = 0, double fFullDashDotLen = 0.0); @@ -239,9 +239,9 @@ namespace basegfx // 2 x fDistance, and the circle around both points with radius fDistance. bool isInEpsilonRange(const B2DPoint& rEdgeStart, const B2DPoint& rEdgeEnd, const B2DPoint& rTestPosition, double fDistance); - // test if point is inside epsilon-range around the given Polygon. Can be used - // for HitTesting. The epsilon-range is defined to be the rectangle centered - // to the given edge, using height 2 x fDistance, and the circle around both points + // test if point is inside epsilon-range around the given Polygon. Can be used + // for HitTesting. The epsilon-range is defined to be the rectangle centered + // to the given edge, using height 2 x fDistance, and the circle around both points // with radius fDistance. bool isInEpsilonRange(const B2DPolygon& rCandidate, const B2DPoint& rTestPosition, double fDistance); @@ -321,7 +321,7 @@ namespace basegfx /** Create an unit ellipse polygon with the given angles, from start to end */ - B2DPolygon createPolygonFromEllipseSegment( const B2DPoint& rCenter, double fRadiusX, double fRadiusY, double fStart, double fEnd ); + B2DPolygon createPolygonFromEllipseSegment( const B2DPoint& rCenter, double fRadiusX, double fRadiusY, double fStart, double fEnd ); B2DPolygon createPolygonFromUnitEllipseSegment( double fStart, double fEnd ); @@ -405,7 +405,7 @@ namespace basegfx // calculates if given point is on given line, taking care of the numerical epsilon bool isPointOnLine(const B2DPoint& rStart, const B2DPoint& rEnd, const B2DPoint& rCandidate, bool bWithPoints = false); - // calculates if given point is on given polygon, taking care of the numerical epsilon. Uses + // calculates if given point is on given polygon, taking care of the numerical epsilon. Uses // isPointOnLine internally bool isPointOnPolygon(const B2DPolygon& rCandidate, const B2DPoint& rPoint, bool bWithPoints = true); @@ -449,7 +449,7 @@ namespace basegfx preserved. The polygon is subdivided if curve segments are included. That subdivision is the base for the newly created points. - If the source is closed, the indirectly existing last edge may NOT have the + If the source is closed, the indirectly existing last edge may NOT have the given length. If the source is open, all edges will have the given length. You may use the last point of the original when You want to add the last edge Yourself. @@ -462,7 +462,7 @@ namespace basegfx original start point. Negative values are truncated to 0.0. @param fEnd - The maximum distance for the last point. No more points behind this distance will be created. + The maximum distance for the last point. No more points behind this distance will be created. Use 0.0 to proccess the whole polygon. Negative values are truncated to 0.0. It also needs to be more or equal to fStart, else it is truncated to fStart. @@ -471,12 +471,12 @@ namespace basegfx */ B2DPolygon createEdgesOfGivenLength(const B2DPolygon& rCandidate, double fLength, double fStart = 0.0, double fEnd = 0.0); - /** Create Waveline along given polygon + /** Create Waveline along given polygon The implementation is based on createEdgesOfGivenLength and creates a curve segment with the given dimensions for each created line segment. The polygon is treated as if opened (closed state will be ignored) and only for whole edges a curve segment will be created (no rest handling) - + @param rCandidate The polygon along which the waveline will be created @@ -489,7 +489,7 @@ namespace basegfx B2DPolygon createWaveline(const B2DPolygon& rCandidate, double fWaveWidth, double fWaveHeight); /** split each edge of a polygon in exactly nSubEdges equidistant edges - + @param rCandidate The source polygon. If too small (no edges), nSubEdges too small (<2) or neither bHandleCurvedEdgesnor bHandleStraightEdges it will just be returned. @@ -497,12 +497,12 @@ namespace basegfx @param nSubEdges How many edges shall be created as replacement for each single edge - + @param bHandleCurvedEdges Process curved edges or not. If to handle the curved edges will be splitted into nSubEdges part curved edges of equidistant bezier distances. If not, curved edges will just be copied. - + @param bHandleStraightEdges Process straight edges or not. If to handle the straight edges will be splitted into nSubEdges part curved edges of equidistant length. If not, @@ -518,7 +518,7 @@ namespace basegfx /** snap some polygon coordinates to discrete coordinates This method allows to snap some polygon points to discrete (integer) values - which equals e.g. a snap to discrete coordinates. It will snap points of + which equals e.g. a snap to discrete coordinates. It will snap points of horizontal and vertical edges @param rCandidate diff --git a/basegfx/inc/basegfx/polygon/b2dpolygontriangulator.hxx b/basegfx/inc/basegfx/polygon/b2dpolygontriangulator.hxx index 05bd230031a0..f05e2eadcc3a 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolygontriangulator.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolygontriangulator.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 diff --git a/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx b/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx index 80664d065dc6..7fe739a4f7fc 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolypolygon.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 @@ -37,8 +37,8 @@ class ImplB2DPolyPolygon; namespace basegfx -{ - class B2DPolygon; +{ + class B2DPolygon; class B2DHomMatrix; } // end of namespace basegfx @@ -54,7 +54,7 @@ namespace basegfx private: ImplType mpPolyPolygon; - public: + public: B2DPolyPolygon(); B2DPolyPolygon(const B2DPolyPolygon& rPolyPolygon); explicit B2DPolyPolygon(const B2DPolygon& rPolygon); diff --git a/basegfx/inc/basegfx/polygon/b2dpolypolygoncutter.hxx b/basegfx/inc/basegfx/polygon/b2dpolypolygoncutter.hxx index 3f00b3093f06..09519396846c 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolypolygoncutter.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolypolygoncutter.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 @@ -63,7 +63,7 @@ namespace basegfx // it's depth is increased when inside a polygon, decreased when inside a hole. The result is a depth // which e.g. is -1 for holes outside everything, 1 for a polygon covered by another polygon and zero // for e.g. holes in a polygon or polygons outside everythig else. - // In the 2nd step, all polygons with depth other than zero are removed. If bKeepAboveZero is used, + // In the 2nd step, all polygons with depth other than zero are removed. If bKeepAboveZero is used, // all polygons < 1 are removed. The bKeepAboveZero mode is useful for clipping, e.g. just append // one polygon to another and use this mode -> only parts where two polygons overlapped will be kept. // In combination with correct orientation of the input orientations and the SolveCrossover calls this diff --git a/basegfx/inc/basegfx/polygon/b2dpolypolygonfillrule.hxx b/basegfx/inc/basegfx/polygon/b2dpolypolygonfillrule.hxx index 2517a9c423e9..01b4af602756 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolypolygonfillrule.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolypolygonfillrule.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 diff --git a/basegfx/inc/basegfx/polygon/b2dpolypolygonrasterconverter.hxx b/basegfx/inc/basegfx/polygon/b2dpolypolygonrasterconverter.hxx index 1f56a14c1842..e43a9a57c5bb 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolypolygonrasterconverter.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolypolygonrasterconverter.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 @@ -46,7 +46,7 @@ namespace basegfx derive from this, and override the span() method, which will get called for every scanline span of the poly-polygon. - @derive + @derive Overwrite span() with the render output method of your choice. */ class B2DPolyPolygonRasterConverter @@ -74,7 +74,7 @@ namespace basegfx area might also be larger. */ B2DPolyPolygonRasterConverter(const B2DPolyPolygon& rPolyPolyRaster, - const B2DRectangle& rRasterArea ); + const B2DRectangle& rRasterArea ); virtual ~B2DPolyPolygonRasterConverter(); @@ -90,7 +90,7 @@ namespace basegfx @param rfXLeft The left end of the current horizontal span - + @param rfXRight The right end of the current horizontal span @@ -103,8 +103,8 @@ namespace basegfx */ virtual void span(const double& rfXLeft, const double& rfXRight, - sal_Int32 nY, - bool bOn ) = 0; + sal_Int32 nY, + bool bOn ) = 0; /// @internal struct Vertex @@ -112,9 +112,9 @@ namespace basegfx inline Vertex(); inline Vertex( const B2DPoint&, const B2DPoint&, bool ); - B2DPoint aP1; - B2DPoint aP2; - bool bDownwards; + B2DPoint aP1; + B2DPoint aP2; + bool bDownwards; }; private: @@ -124,18 +124,18 @@ namespace basegfx void init(); - typedef ::std::vector<Vertex> VectorOfVertices; - typedef ::std::vector<VectorOfVertices> VectorOfVertexVectors; + typedef ::std::vector<Vertex> VectorOfVertices; + typedef ::std::vector<VectorOfVertices> VectorOfVertexVectors; /// The poly-polygon to raster-convert - B2DPolyPolygon maPolyPolygon; + B2DPolyPolygon maPolyPolygon; /// Total bound rect of the poly-polygon - const B2DRectangle maPolyPolyRectangle; + const B2DRectangle maPolyPolyRectangle; /** Vector containing for each scanline a vector which in turn contains all vertices that start on the specific scanline */ - VectorOfVertexVectors maScanlines; + VectorOfVertexVectors maScanlines; }; } diff --git a/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx b/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx index 8b025bcff99e..f8ccf09a5745 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolypolygontools.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 @@ -73,7 +73,7 @@ namespace basegfx // is created. B2DPolyPolygon adaptiveSubdivideByCount(const B2DPolyPolygon& rCandidate, sal_uInt32 nCount = 0L); - // isInside test for B2dPoint. On border is not inside as long as not true is given + // isInside test for B2dPoint. On border is not inside as long as not true is given // in bWithBorder flag. It is assumed that the orientations of the given polygon are correct. bool isInside(const B2DPolyPolygon& rCandidate, const B2DPoint& rPoint, bool bWithBorder = false); @@ -102,19 +102,19 @@ namespace basegfx The outer range of the polygon */ B2DRange getRange(const B2DPolyPolygon& rCandidate); - + /** Apply given LineDashing to given polyPolygon For a description see applyLineDashing in b2dpolygontoos.hxx */ void applyLineDashing( - const B2DPolyPolygon& rCandidate, - const ::std::vector<double>& rDotDashArray, + const B2DPolyPolygon& rCandidate, + const ::std::vector<double>& rDotDashArray, B2DPolyPolygon* pLineTarget, B2DPolyPolygon* pGapTarget = 0, double fFullDashDotLen = 0.0); - // test if point is inside epsilon-range around the given PolyPolygon. Can be used + // test if point is inside epsilon-range around the given PolyPolygon. Can be used // for HitTesting. The epsilon-range is defined to be the tube around the PolyPolygon // with distance fDistance and rounded edges (start and end point). bool isInEpsilonRange(const B2DPolyPolygon& rCandidate, const B2DPoint& rTestPosition, double fDistance); @@ -180,7 +180,7 @@ namespace basegfx B2DPolyPolygon createB2DPolyPolygonFromB3DPolyPolygon(const B3DPolyPolygon& rCandidate, const B3DHomMatrix& rMat); // for each contained edge in each contained polygon calculate the smallest distance. Return the index to the smallest - // edge in rEdgeIndex and the index to the polygon in rPolygonIndex. The relative position on the edge is returned in rCut. + // edge in rEdgeIndex and the index to the polygon in rPolygonIndex. The relative position on the edge is returned in rCut. // If nothing was found (e.g. empty input plygon), DBL_MAX is returned. double getSmallestDistancePointToPolyPolygon(const B2DPolyPolygon& rCandidate, const B2DPoint& rTestPoint, sal_uInt32& rPolygonIndex, sal_uInt32& rEdgeIndex, double& rCut); @@ -219,7 +219,7 @@ namespace basegfx @param rPolyPoly The poly-polygon to export - + @param bUseRelativeCoordinates When true, all coordinate values are exported as relative to the current position. This tends to save some space, @@ -235,14 +235,14 @@ namespace basegfx value alone, without any "<path ...>" or "d="...") */ ::rtl::OUString exportToSvgD( const B2DPolyPolygon& rPolyPoly, - bool bUseRelativeCoordinates=true, - bool bDetectQuadraticBeziers=true ); + bool bUseRelativeCoordinates=true, + bool bDetectQuadraticBeziers=true ); // #i76891# Try to remove existing curve segments if they are simply edges B2DPolyPolygon simplifyCurveSegments(const B2DPolyPolygon& rCandidate); /** split each edge of a polyPolygon in exactly nSubEdges equidistant edges - + @param rCandidate The source polyPolygon. If too small (no edges), nSubEdges too small (<2) or neither bHandleCurvedEdgesnor bHandleStraightEdges it will just be returned. @@ -263,7 +263,7 @@ namespace basegfx /** snap some polygon coordinates to discrete coordinates This method allows to snap some polygon points to discrete (integer) values - which equals e.g. a snap to discrete coordinates. It will snap points of + which equals e.g. a snap to discrete coordinates. It will snap points of horizontal and vertical edges @param rCandidate diff --git a/basegfx/inc/basegfx/polygon/b2dtrapezoid.hxx b/basegfx/inc/basegfx/polygon/b2dtrapezoid.hxx index 77c6e40c4742..cd0f8fbf6a87 100644 --- a/basegfx/inc/basegfx/polygon/b2dtrapezoid.hxx +++ b/basegfx/inc/basegfx/polygon/b2dtrapezoid.hxx @@ -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 @@ -51,12 +51,12 @@ namespace basegfx // - mfBottomY >= mfTopY // - mfTopXRight >= mfTopXLeft // - mfBottomXRight >= mfBottomXLeft - double mfTopXLeft; - double mfTopXRight; - double mfTopY; - double mfBottomXLeft; - double mfBottomXRight; - double mfBottomY; + double mfTopXLeft; + double mfTopXRight; + double mfTopY; + double mfBottomXLeft; + double mfBottomXRight; + double mfBottomY; public: // constructor @@ -98,22 +98,22 @@ namespace basegfx // for primitive decompositions. To use it, the shear and rotate parts of the // involved transformations HAVE to be taken into account. void trapezoidSubdivide( - B2DTrapezoidVector& ro_Result, + B2DTrapezoidVector& ro_Result, const B2DPolyPolygon& rSourcePolyPolygon); // directly create trapezoids from given edge. Depending on the given geometry, // none up to three trapezoids will be created void createLineTrapezoidFromEdge( - B2DTrapezoidVector& ro_Result, - const B2DPoint& rPointA, - const B2DPoint& rPointB, + B2DTrapezoidVector& ro_Result, + const B2DPoint& rPointA, + const B2DPoint& rPointB, double fLineWidth = 1.0); // create trapezoids for all edges of the given polygon. The closed state of // the polygon is taken into account. If curves are contaned, the default // AdaptiveSubdivision will be used. void createLineTrapezoidFromB2DPolygon( - B2DTrapezoidVector& ro_Result, + B2DTrapezoidVector& ro_Result, const B2DPolygon& rPolygon, double fLineWidth = 1.0); @@ -121,7 +121,7 @@ namespace basegfx // the PolyPolygon is taken into account. If curves are contaned, the default // AdaptiveSubdivision will be used. void createLineTrapezoidFromB2DPolyPolygon( - B2DTrapezoidVector& ro_Result, + B2DTrapezoidVector& ro_Result, const B2DPolyPolygon& rPolyPolygon, double fLineWidth = 1.0); diff --git a/basegfx/inc/basegfx/polygon/b3dpolygon.hxx b/basegfx/inc/basegfx/polygon/b3dpolygon.hxx index 5f1613845915..d6fc01f959a2 100644 --- a/basegfx/inc/basegfx/polygon/b3dpolygon.hxx +++ b/basegfx/inc/basegfx/polygon/b3dpolygon.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 diff --git a/basegfx/inc/basegfx/polygon/b3dpolygonclipper.hxx b/basegfx/inc/basegfx/polygon/b3dpolygonclipper.hxx index 3166c39012c1..3b6934da1a92 100644 --- a/basegfx/inc/basegfx/polygon/b3dpolygonclipper.hxx +++ b/basegfx/inc/basegfx/polygon/b3dpolygonclipper.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 @@ namespace basegfx namespace tools { - /** define for deciding one of X,Y,Z directions + /** define for deciding one of X,Y,Z directions */ enum B3DOrientation { - B3DORIENTATION_X, // X-Axis - B3DORIENTATION_Y, // Y-Axis - B3DORIENTATION_Z // Z-Axis + B3DORIENTATION_X, // X-Axis + B3DORIENTATION_Y, // Y-Axis + B3DORIENTATION_Z // Z-Axis }; // Clip given 3D polygon against a plane orthogonal to X,Y or Z axis. The plane is defined using the diff --git a/basegfx/inc/basegfx/polygon/b3dpolygontools.hxx b/basegfx/inc/basegfx/polygon/b3dpolygontools.hxx index 00caf76823e1..89982d777f90 100644 --- a/basegfx/inc/basegfx/polygon/b3dpolygontools.hxx +++ b/basegfx/inc/basegfx/polygon/b3dpolygontools.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 @@ -47,7 +47,7 @@ namespace basegfx { // B3DPolygon tools - /** Check if given polygon is closed. This is kind of a + /** Check if given polygon is closed. This is kind of a 'classic' method to support old polygon definitions. Those old polygon definitions define the closed state of the polygon using identical start and endpoints. This @@ -106,15 +106,15 @@ namespace basegfx For a description see applyLineDashing in b2dpolygontoos.hxx */ void applyLineDashing( - const B3DPolygon& rCandidate, - const ::std::vector<double>& rDotDashArray, + const B3DPolygon& rCandidate, + const ::std::vector<double>& rDotDashArray, B3DPolyPolygon* pLineTarget, B3DPolyPolygon* pGapTarget = 0, double fFullDashDotLen = 0.0); /** Create/replace normals for given 3d geometry with default normals from given center to outside. - rCandidate: the 3d geometry to change - rCenter: the center of the 3d geometry + rCandidate: the 3d geometry to change + rCenter: the center of the 3d geometry */ B3DPolygon applyDefaultNormalsSphere( const B3DPolygon& rCandidate, const B3DPoint& rCenter); @@ -142,8 +142,8 @@ namespace basegfx // fDistance, and the sphere around both points with radius fDistance. bool isInEpsilonRange(const B3DPoint& rEdgeStart, const B3DPoint& rEdgeEnd, const B3DPoint& rTestPosition, double fDistance); - // test if point is inside epsilon-range around the given Polygon. Can be used - // for HitTesting. The epsilon-range is defined to be the cylinder centered to + // test if point is inside epsilon-range around the given Polygon. Can be used + // for HitTesting. The epsilon-range is defined to be the cylinder centered to // the given edge, using radius fDistance, and the sphere around both points with radius fDistance. bool isInEpsilonRange(const B3DPolygon& rCandidate, const B3DPoint& rTestPosition, double fDistance); @@ -155,7 +155,7 @@ namespace basegfx // calculates if given point is on given line, taking care of the numerical epsilon bool isPointOnLine(const B3DPoint& rStart, const B3DPoint& rEnd, const B3DPoint& rCandidate, bool bWithPoints = false); - // calculates if given point is on given polygon, taking care of the numerical epsilon. Uses + // calculates if given point is on given polygon, taking care of the numerical epsilon. Uses // isPointOnLine internally bool isPointOnPolygon(const B3DPolygon& rCandidate, const B3DPoint& rPoint, bool bWithPoints = true); @@ -175,7 +175,7 @@ namespace basegfx /** snap some polygon coordinates to discrete coordinates This method allows to snap some polygon points to discrete (integer) values - which equals e.g. a snap to discrete coordinates. It will snap points of + which equals e.g. a snap to discrete coordinates. It will snap points of horizontal and vertical edges @param rCandidate diff --git a/basegfx/inc/basegfx/polygon/b3dpolypolygon.hxx b/basegfx/inc/basegfx/polygon/b3dpolypolygon.hxx index 472b39bab267..697edfe93084 100644 --- a/basegfx/inc/basegfx/polygon/b3dpolypolygon.hxx +++ b/basegfx/inc/basegfx/polygon/b3dpolypolygon.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 @@ -36,8 +36,8 @@ class ImplB3DPolyPolygon; namespace basegfx -{ - class B3DPolygon; +{ + class B3DPolygon; class B3DHomMatrix; class B2DHomMatrix; } // end of namespace basegfx @@ -54,7 +54,7 @@ namespace basegfx private: ImplType mpPolyPolygon; - public: + public: B3DPolyPolygon(); B3DPolyPolygon(const B3DPolyPolygon& rPolyPolygon); explicit B3DPolyPolygon(const B3DPolygon& rPolygon); diff --git a/basegfx/inc/basegfx/polygon/b3dpolypolygontools.hxx b/basegfx/inc/basegfx/polygon/b3dpolypolygontools.hxx index 10083f57dd60..1be2e31f38fc 100644 --- a/basegfx/inc/basegfx/polygon/b3dpolypolygontools.hxx +++ b/basegfx/inc/basegfx/polygon/b3dpolypolygontools.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 @@ -55,8 +55,8 @@ namespace basegfx For a description see applyLineDashing in b2dpolygontoos.hxx */ void applyLineDashing( - const B3DPolyPolygon& rCandidate, - const ::std::vector<double>& rDotDashArray, + const B3DPolyPolygon& rCandidate, + const ::std::vector<double>& rDotDashArray, B3DPolyPolygon* pLineTarget, B3DPolyPolygon* pGapTarget = 0, double fFullDashDotLen = 0.0); @@ -91,8 +91,8 @@ namespace basegfx If nHorSeg == 0 and/or nVerSeg == 0, a default will be calculated to have a step at least each 15 degrees. With VerStart, VerStop and hor range in cartesian may be specified to create a partial sphere only. */ - B3DPolyPolygon createSpherePolyPolygonFromB3DRange( - const B3DRange& rRange, + B3DPolyPolygon createSpherePolyPolygonFromB3DRange( + const B3DRange& rRange, sal_uInt32 nHorSeg = 0L, sal_uInt32 nVerSeg = 0L, double fVerStart = F_PI2, double fVerStop = -F_PI2, double fHorStart = 0.0, double fHorStop = F_2PI); @@ -109,16 +109,16 @@ namespace basegfx /** same as createSpherePolyPolygonFromB3DRange, but creates filled polygons (closed and oriented) There is one extra, the bool bNormals defines if normals will be set, default is false */ - B3DPolyPolygon createSphereFillPolyPolygonFromB3DRange( - const B3DRange& rRange, + B3DPolyPolygon createSphereFillPolyPolygonFromB3DRange( + const B3DRange& rRange, sal_uInt32 nHorSeg = 0L, sal_uInt32 nVerSeg = 0L, bool bNormals = false, double fVerStart = F_PI2, double fVerStop = -F_PI2, double fHorStart = 0.0, double fHorStop = F_2PI); /** Create/replace normals for given 3d geometry with default normals from given center to outside. - rCandidate: the 3d geometry to change - rCenter: the center of the 3d geometry + rCandidate: the 3d geometry to change + rCenter: the center of the 3d geometry */ B3DPolyPolygon applyDefaultNormalsSphere( const B3DPolyPolygon& rCandidate, const B3DPoint& rCenter); @@ -140,7 +140,7 @@ namespace basegfx */ B3DPolyPolygon applyDefaultTextureCoordinatesSphere( const B3DPolyPolygon& rCandidate, const B3DPoint& rCenter, bool bChangeX = true, bool bChangeY = true); - // isInside test for B3DPoint. On border is not inside as long as not true is given + // isInside test for B3DPoint. On border is not inside as long as not true is given // in bWithBorder flag. It is assumed that the orientations of the given polygon are correct. bool isInside(const B3DPolyPolygon& rCandidate, const B3DPoint& rPoint, bool bWithBorder = false); diff --git a/basegfx/inc/basegfx/range/b1drange.hxx b/basegfx/inc/basegfx/range/b1drange.hxx index feb48d336e9a..a6cacec6d718 100644 --- a/basegfx/inc/basegfx/range/b1drange.hxx +++ b/basegfx/inc/basegfx/range/b1drange.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 @@ -38,55 +38,55 @@ namespace basegfx class B1DRange { - ::basegfx::BasicRange< double, DoubleTraits > maRange; + ::basegfx::BasicRange< double, DoubleTraits > maRange; - public: - B1DRange() + public: + B1DRange() { } - - explicit B1DRange(double fStartValue) - : maRange(fStartValue) + + explicit B1DRange(double fStartValue) + : maRange(fStartValue) { } - - B1DRange(double fStartValue1, double fStartValue2) - : maRange(fStartValue1) + + B1DRange(double fStartValue1, double fStartValue2) + : maRange(fStartValue1) { expand(fStartValue2); } - + B1DRange(const B1DRange& rRange) - : maRange(rRange.maRange) + : maRange(rRange.maRange) { } explicit B1DRange( const B1IRange& rRange ); - bool isEmpty() const + bool isEmpty() const { return maRange.isEmpty(); } - void reset() - { - maRange.reset(); + void reset() + { + maRange.reset(); } - - bool operator==( const B1DRange& rRange ) const - { - return (maRange == rRange.maRange); + + bool operator==( const B1DRange& rRange ) const + { + return (maRange == rRange.maRange); } - bool operator!=( const B1DRange& rRange ) const - { - return (maRange != rRange.maRange); + bool operator!=( const B1DRange& rRange ) const + { + return (maRange != rRange.maRange); } - B1DRange& operator=(const B1DRange& rRange) - { - maRange = rRange.maRange; - return *this; + B1DRange& operator=(const B1DRange& rRange) + { + maRange = rRange.maRange; + return *this; } bool equal(const B1DRange& rRange) const @@ -94,64 +94,64 @@ namespace basegfx return (maRange.equal(rRange.maRange)); } - double getMinimum() const - { - return maRange.getMinimum(); + double getMinimum() const + { + return maRange.getMinimum(); } - double getMaximum() const - { - return maRange.getMaximum(); + double getMaximum() const + { + return maRange.getMaximum(); } - double getRange() const - { - return maRange.getRange(); + double getRange() const + { + return maRange.getRange(); } - + double getCenter() const { - return maRange.getCenter(); + return maRange.getCenter(); } - bool isInside(double fValue) const - { - return maRange.isInside(fValue); + bool isInside(double fValue) const + { + return maRange.isInside(fValue); } - - bool isInside(const B1DRange& rRange) const - { - return maRange.isInside(rRange.maRange); + + bool isInside(const B1DRange& rRange) const + { + return maRange.isInside(rRange.maRange); } - bool overlaps(const B1DRange& rRange) const - { - return maRange.overlaps(rRange.maRange); + bool overlaps(const B1DRange& rRange) const + { + return maRange.overlaps(rRange.maRange); } - bool overlapsMore(const B1DRange& rRange) const - { - return maRange.overlapsMore(rRange.maRange); + bool overlapsMore(const B1DRange& rRange) const + { + return maRange.overlapsMore(rRange.maRange); } - void expand(double fValue) - { - maRange.expand(fValue); + void expand(double fValue) + { + maRange.expand(fValue); } - void expand(const B1DRange& rRange) - { - maRange.expand(rRange.maRange); + void expand(const B1DRange& rRange) + { + maRange.expand(rRange.maRange); } - void intersect(const B1DRange& rRange) - { - maRange.intersect(rRange.maRange); + void intersect(const B1DRange& rRange) + { + maRange.intersect(rRange.maRange); } void grow(double fValue) { - maRange.grow(fValue); + maRange.grow(fValue); } }; diff --git a/basegfx/inc/basegfx/range/b1ibox.hxx b/basegfx/inc/basegfx/range/b1ibox.hxx index d2ef68b86e7a..2001ec964a32 100644 --- a/basegfx/inc/basegfx/range/b1ibox.hxx +++ b/basegfx/inc/basegfx/range/b1ibox.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 @@ -36,107 +36,107 @@ namespace basegfx { class B1IBox { - ::basegfx::BasicBox maRange; + ::basegfx::BasicBox maRange; - public: - B1IBox() + public: + B1IBox() { } - - explicit B1IBox(sal_Int32 nStartValue) - : maRange(nStartValue) + + explicit B1IBox(sal_Int32 nStartValue) + : maRange(nStartValue) { } - - B1IBox(sal_Int32 nStartValue1, sal_Int32 nStartValue2) - : maRange(nStartValue1) + + B1IBox(sal_Int32 nStartValue1, sal_Int32 nStartValue2) + : maRange(nStartValue1) { expand(nStartValue2); } B1IBox(const B1IBox& rBox) - : maRange(rBox.maRange) + : maRange(rBox.maRange) { } - bool isEmpty() const + bool isEmpty() const { return maRange.isEmpty(); } - void reset() - { - maRange.reset(); + void reset() + { + maRange.reset(); } - - bool operator==( const B1IBox& rBox ) const - { - return (maRange == rBox.maRange); + + bool operator==( const B1IBox& rBox ) const + { + return (maRange == rBox.maRange); } - bool operator!=( const B1IBox& rBox ) const - { - return (maRange != rBox.maRange); + bool operator!=( const B1IBox& rBox ) const + { + return (maRange != rBox.maRange); } - void operator=(const B1IBox& rBox) - { - maRange = rBox.maRange; + void operator=(const B1IBox& rBox) + { + maRange = rBox.maRange; } - sal_Int32 getMinimum() const - { - return maRange.getMinimum(); + sal_Int32 getMinimum() const + { + return maRange.getMinimum(); } - sal_Int32 getMaximum() const - { - return maRange.getMaximum(); + sal_Int32 getMaximum() const + { + return maRange.getMaximum(); } - Int32Traits::DifferenceType getRange() const - { - return maRange.getRange(); + Int32Traits::DifferenceType getRange() const + { + return maRange.getRange(); } - + double getCenter() const { - return maRange.getCenter(); + return maRange.getCenter(); } - bool isInside(sal_Int32 nValue) const - { - return maRange.isInside(nValue); + bool isInside(sal_Int32 nValue) const + { + return maRange.isInside(nValue); } - - bool isInside(const B1IBox& rBox) const - { - return maRange.isInside(rBox.maRange); + + bool isInside(const B1IBox& rBox) const + { + return maRange.isInside(rBox.maRange); } - bool overlaps(const B1IBox& rBox) const - { - return maRange.overlaps(rBox.maRange); + bool overlaps(const B1IBox& rBox) const + { + return maRange.overlaps(rBox.maRange); } - void expand(sal_Int32 nValue) - { - maRange.expand(nValue); + void expand(sal_Int32 nValue) + { + maRange.expand(nValue); } - void expand(const B1IBox& rBox) - { - maRange.expand(rBox.maRange); + void expand(const B1IBox& rBox) + { + maRange.expand(rBox.maRange); } - void intersect(const B1IBox& rBox) - { - maRange.intersect(rBox.maRange); + void intersect(const B1IBox& rBox) + { + maRange.intersect(rBox.maRange); } void grow(sal_Int32 nValue) { - maRange.grow(nValue); + maRange.grow(nValue); } }; } // end of namespace basegfx diff --git a/basegfx/inc/basegfx/range/b1irange.hxx b/basegfx/inc/basegfx/range/b1irange.hxx index a503133f4b0f..9c77d23b8204 100644 --- a/basegfx/inc/basegfx/range/b1irange.hxx +++ b/basegfx/inc/basegfx/range/b1irange.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 @@ -36,108 +36,108 @@ namespace basegfx { class B1IRange { - ::basegfx::BasicRange< sal_Int32, Int32Traits > maRange; + ::basegfx::BasicRange< sal_Int32, Int32Traits > maRange; - public: - B1IRange() + public: + B1IRange() { } - - explicit B1IRange(sal_Int32 nStartValue) - : maRange(nStartValue) + + explicit B1IRange(sal_Int32 nStartValue) + : maRange(nStartValue) { } - - B1IRange(sal_Int32 nStartValue1, sal_Int32 nStartValue2) - : maRange(nStartValue1) + + B1IRange(sal_Int32 nStartValue1, sal_Int32 nStartValue2) + : maRange(nStartValue1) { expand(nStartValue2); } B1IRange(const B1IRange& rRange) - : maRange(rRange.maRange) + : maRange(rRange.maRange) { } - bool isEmpty() const + bool isEmpty() const { return maRange.isEmpty(); } - void reset() - { - maRange.reset(); + void reset() + { + maRange.reset(); } - - bool operator==( const B1IRange& rRange ) const - { - return (maRange == rRange.maRange); + + bool operator==( const B1IRange& rRange ) const + { + return (maRange == rRange.maRange); } - bool operator!=( const B1IRange& rRange ) const - { - return (maRange != rRange.maRange); + bool operator!=( const B1IRange& rRange ) const + { + return (maRange != rRange.maRange); } - B1IRange& operator=(const B1IRange& rRange) - { - maRange = rRange.maRange; - return *this; + B1IRange& operator=(const B1IRange& rRange) + { + maRange = rRange.maRange; + return *this; } - sal_Int32 getMinimum() const - { - return maRange.getMinimum(); + sal_Int32 getMinimum() const + { + return maRange.getMinimum(); } - sal_Int32 getMaximum() const - { - return maRange.getMaximum(); + sal_Int32 getMaximum() const + { + return maRange.getMaximum(); } - Int32Traits::DifferenceType getRange() const - { - return maRange.getRange(); + Int32Traits::DifferenceType getRange() const + { + return maRange.getRange(); } - + double getCenter() const { - return maRange.getCenter(); + return maRange.getCenter(); } - bool isInside(sal_Int32 nValue) const - { - return maRange.isInside(nValue); + bool isInside(sal_Int32 nValue) const + { + return maRange.isInside(nValue); } - - bool isInside(const B1IRange& rRange) const - { - return maRange.isInside(rRange.maRange); + + bool isInside(const B1IRange& rRange) const + { + return maRange.isInside(rRange.maRange); } - bool overlaps(const B1IRange& rRange) const - { - return maRange.overlaps(rRange.maRange); + bool overlaps(const B1IRange& rRange) const + { + return maRange.overlaps(rRange.maRange); } - void expand(sal_Int32 nValue) - { - maRange.expand(nValue); + void expand(sal_Int32 nValue) + { + maRange.expand(nValue); } - void expand(const B1IRange& rRange) - { - maRange.expand(rRange.maRange); + void expand(const B1IRange& rRange) + { + maRange.expand(rRange.maRange); } - void intersect(const B1IRange& rRange) - { - maRange.intersect(rRange.maRange); + void intersect(const B1IRange& rRange) + { + maRange.intersect(rRange.maRange); } void grow(sal_Int32 nValue) { - maRange.grow(nValue); + maRange.grow(nValue); } }; } // end of namespace basegfx diff --git a/basegfx/inc/basegfx/range/b2dconnectedranges.hxx b/basegfx/inc/basegfx/range/b2dconnectedranges.hxx index 6949918fa2ef..27fbcb06b527 100644 --- a/basegfx/inc/basegfx/range/b2dconnectedranges.hxx +++ b/basegfx/inc/basegfx/range/b2dconnectedranges.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 @@ -73,16 +73,16 @@ namespace basegfx public: /// Type of the basic entity (rect + user data) typedef ::std::pair< B2DRange, UserData > ComponentType; - typedef ::std::list< ComponentType > ComponentListType; + typedef ::std::list< ComponentType > ComponentListType; /// List of (intersecting) components, plus overall bounds struct ConnectedComponents { - ComponentListType maComponentList; - B2DRange maTotalBounds; + ComponentListType maComponentList; + B2DRange maTotalBounds; }; - typedef ::std::list< ConnectedComponents > ConnectedComponentsType; + typedef ::std::list< ConnectedComponents > ConnectedComponentsType; /// Create the range calculator @@ -109,15 +109,15 @@ namespace basegfx ranges (typically, for well-behaved input, it is O(n) though). */ - void addRange( const B2DRange& rRange, - const UserData& rUserData ) + void addRange( const B2DRange& rRange, + const UserData& rUserData ) { // check whether fast path is possible: if new range is // outside accumulated total range, can add it as a // separate component right away. - const bool bNotOutsideEverything( + const bool bNotOutsideEverything( maTotalBounds.overlaps( rRange ) ); - + // update own global bounds range maTotalBounds.expand( rRange ); @@ -172,7 +172,7 @@ namespace basegfx // no position and size. if( !aCurrAggregate->maTotalBounds.isEmpty() && - aCurrAggregate->maTotalBounds.overlaps( + aCurrAggregate->maTotalBounds.overlaps( aNewConnectedComponent.maTotalBounds ) ) { // union the intersecting @@ -181,13 +181,13 @@ namespace basegfx // calc union bounding box aNewConnectedComponent.maTotalBounds.expand( aCurrAggregate->maTotalBounds ); - + // extract all aCurrAggregate components // to aNewConnectedComponent - aNewConnectedComponent.maComponentList.splice( - aNewConnectedComponent.maComponentList.end(), + aNewConnectedComponent.maComponentList.splice( + aNewConnectedComponent.maComponentList.end(), aCurrAggregate->maComponentList ); - + // remove and delete aCurrAggregate entry // from list (we've gutted it's content // above). list::erase() will update our @@ -212,17 +212,17 @@ namespace basegfx // // add new component to the end of the component list - aNewConnectedComponent.maComponentList.push_back( + aNewConnectedComponent.maComponentList.push_back( ComponentType( rRange, rUserData ) ); - + // do some consistency checks (aka post conditions) OSL_ENSURE( !aNewConnectedComponent.maComponentList.empty(), "B2DConnectedRanges::addRange(): empty aggregate list" ); - OSL_ENSURE( !aNewConnectedComponent.maTotalBounds.isEmpty() || - (aNewConnectedComponent.maTotalBounds.isEmpty() && + OSL_ENSURE( !aNewConnectedComponent.maTotalBounds.isEmpty() || + (aNewConnectedComponent.maTotalBounds.isEmpty() && aNewConnectedComponent.maComponentList.size() == 1), "B2DConnectedRanges::addRange(): empty ranges must be solitary"); - + // add aNewConnectedComponent as a new entry to // maDisjunctAggregatesList maDisjunctAggregatesList.push_back( aNewConnectedComponent ); @@ -242,7 +242,7 @@ namespace basegfx maDisjunctAggregatesList.end(), aFunctor ); } - + private: // default: disabled copy/assignment B2DConnectedRanges(const B2DConnectedRanges&); @@ -253,11 +253,11 @@ namespace basegfx Each entry corresponds to one of the top-level rectangles in the drawing above. */ - ConnectedComponentsType maDisjunctAggregatesList; - + ConnectedComponentsType maDisjunctAggregatesList; + /** Global bound rect over all added ranges. */ - B2DRange maTotalBounds; + B2DRange maTotalBounds; }; } diff --git a/basegfx/inc/basegfx/range/b2dpolyrange.hxx b/basegfx/inc/basegfx/range/b2dpolyrange.hxx index 5ce105da980b..1abdbda7cad5 100644 --- a/basegfx/inc/basegfx/range/b2dpolyrange.hxx +++ b/basegfx/inc/basegfx/range/b2dpolyrange.hxx @@ -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 diff --git a/basegfx/inc/basegfx/range/b2drange.hxx b/basegfx/inc/basegfx/range/b2drange.hxx index 8d78f1141298..f1271fe4ae0c 100644 --- a/basegfx/inc/basegfx/range/b2drange.hxx +++ b/basegfx/inc/basegfx/range/b2drange.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 @@ -44,25 +44,25 @@ namespace basegfx class B2DRange { - public: - typedef double ValueType; - typedef DoubleTraits TraitsType; + public: + typedef double ValueType; + typedef DoubleTraits TraitsType; - B2DRange() + B2DRange() { } - + explicit B2DRange(const B2DTuple& rTuple) - : maRangeX(rTuple.getX()), + : maRangeX(rTuple.getX()), maRangeY(rTuple.getY()) { } - + B2DRange(double x1, double y1, double x2, double y2) - : maRangeX(x1), + : maRangeX(x1), maRangeY(y1) { maRangeX.expand(x2); @@ -71,57 +71,57 @@ namespace basegfx B2DRange(const B2DTuple& rTuple1, const B2DTuple& rTuple2) - : maRangeX(rTuple1.getX()), + : maRangeX(rTuple1.getX()), maRangeY(rTuple1.getY()) { expand( rTuple2 ); } - + B2DRange(const B2DRange& rRange) - : maRangeX(rRange.maRangeX), + : maRangeX(rRange.maRangeX), maRangeY(rRange.maRangeY) { } explicit B2DRange(const B2IRange& rRange); - bool isEmpty() const + bool isEmpty() const { return ( - maRangeX.isEmpty() + maRangeX.isEmpty() || maRangeY.isEmpty() ); } - void reset() - { - maRangeX.reset(); - maRangeY.reset(); + void reset() + { + maRangeX.reset(); + maRangeY.reset(); } - bool operator==( const B2DRange& rRange ) const - { - return (maRangeX == rRange.maRangeX - && maRangeY == rRange.maRangeY); + bool operator==( const B2DRange& rRange ) const + { + return (maRangeX == rRange.maRangeX + && maRangeY == rRange.maRangeY); } - bool operator!=( const B2DRange& rRange ) const - { - return (maRangeX != rRange.maRangeX - || maRangeY != rRange.maRangeY); + bool operator!=( const B2DRange& rRange ) const + { + return (maRangeX != rRange.maRangeX + || maRangeY != rRange.maRangeY); } - B2DRange& operator=(const B2DRange& rRange) - { - maRangeX = rRange.maRangeX; - maRangeY = rRange.maRangeY; - return *this; + B2DRange& operator=(const B2DRange& rRange) + { + maRangeX = rRange.maRangeX; + maRangeY = rRange.maRangeY; + return *this; } bool equal(const B2DRange& rRange) const { - return (maRangeX.equal(rRange.maRangeX) - && maRangeY.equal(rRange.maRangeY)); + return (maRangeX.equal(rRange.maRangeX) + && maRangeY.equal(rRange.maRangeY)); } double getMinX() const @@ -161,7 +161,7 @@ namespace basegfx maRangeY.getMinimum() ); } - + B2DPoint getMaximum() const { return B2DPoint( @@ -177,7 +177,7 @@ namespace basegfx maRangeY.getRange() ); } - + B2DPoint getCenter() const { return B2DPoint( @@ -185,21 +185,21 @@ namespace basegfx maRangeY.getCenter() ); } - + double getCenterX() const { return maRangeX.getCenter(); } - + double getCenterY() const { return maRangeY.getCenter(); } - + bool isInside(const B2DTuple& rTuple) const { return ( - maRangeX.isInside(rTuple.getX()) + maRangeX.isInside(rTuple.getX()) && maRangeY.isInside(rTuple.getY()) ); } @@ -207,7 +207,7 @@ namespace basegfx bool isInside(const B2DRange& rRange) const { return ( - maRangeX.isInside(rRange.maRangeX) + maRangeX.isInside(rRange.maRangeX) && maRangeY.isInside(rRange.maRangeY) ); } @@ -215,7 +215,7 @@ namespace basegfx bool overlaps(const B2DRange& rRange) const { return ( - maRangeX.overlaps(rRange.maRangeX) + maRangeX.overlaps(rRange.maRangeX) && maRangeY.overlaps(rRange.maRangeY) ); } @@ -223,7 +223,7 @@ namespace basegfx bool overlapsMore(const B2DRange& rRange) const { return ( - maRangeX.overlapsMore(rRange.maRangeX) + maRangeX.overlapsMore(rRange.maRangeX) && maRangeY.overlapsMore(rRange.maRangeY) ); } @@ -236,29 +236,29 @@ namespace basegfx void expand(const B2DRange& rRange) { - maRangeX.expand(rRange.maRangeX); - maRangeY.expand(rRange.maRangeY); + maRangeX.expand(rRange.maRangeX); + maRangeY.expand(rRange.maRangeY); } void intersect(const B2DRange& rRange) { - maRangeX.intersect(rRange.maRangeX); - maRangeY.intersect(rRange.maRangeY); + maRangeX.intersect(rRange.maRangeX); + maRangeY.intersect(rRange.maRangeY); } void grow(double fValue) { - maRangeX.grow(fValue); - maRangeY.grow(fValue); + maRangeX.grow(fValue); + maRangeY.grow(fValue); } void transform(const B2DHomMatrix& rMatrix); private: - typedef ::basegfx::BasicRange< ValueType, TraitsType > MyBasicRange; + typedef ::basegfx::BasicRange< ValueType, TraitsType > MyBasicRange; - MyBasicRange maRangeX; - MyBasicRange maRangeY; + MyBasicRange maRangeX; + MyBasicRange maRangeY; }; /** Round double to nearest integer for 2D range @@ -286,9 +286,9 @@ namespace basegfx @return the input vector */ - ::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 ); } // end of namespace basegfx diff --git a/basegfx/inc/basegfx/range/b2drangeclipper.hxx b/basegfx/inc/basegfx/range/b2drangeclipper.hxx index 146273d5d21d..c59329c226ea 100644 --- a/basegfx/inc/basegfx/range/b2drangeclipper.hxx +++ b/basegfx/inc/basegfx/range/b2drangeclipper.hxx @@ -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 @@ -40,13 +40,13 @@ namespace basegfx namespace tools { /** Extract poly-polygon w/o self-intersections from poly-range - + Similar to the solveCrossovers(const B2DPolyPolygon&) method, this one calculates a self-intersection-free poly-polygon with the same topology, and encoding inside/outsidedness via polygon orientation and layering. */ - B2DPolyPolygon solveCrossovers(const std::vector<B2DRange>& rRanges, + B2DPolyPolygon solveCrossovers(const std::vector<B2DRange>& rRanges, const std::vector<B2VectorOrientation>& rOrientations); } } diff --git a/basegfx/inc/basegfx/range/b2drectangle.hxx b/basegfx/inc/basegfx/range/b2drectangle.hxx index c00d13256cea..9a9e1b7cbf80 100644 --- a/basegfx/inc/basegfx/range/b2drectangle.hxx +++ b/basegfx/inc/basegfx/range/b2drectangle.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 diff --git a/basegfx/inc/basegfx/range/b2ibox.hxx b/basegfx/inc/basegfx/range/b2ibox.hxx index 1e2c790dc51d..38e664d4faeb 100644 --- a/basegfx/inc/basegfx/range/b2ibox.hxx +++ b/basegfx/inc/basegfx/range/b2ibox.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 @@ -41,20 +41,20 @@ namespace basegfx { class B2IBox { - public: - typedef sal_Int32 ValueType; - typedef Int32Traits TraitsType; + public: + typedef sal_Int32 ValueType; + typedef Int32Traits TraitsType; - B2IBox() + B2IBox() { } - + explicit B2IBox(const B2ITuple& rTuple) - : maRangeX(rTuple.getX()), + : maRangeX(rTuple.getX()), maRangeY(rTuple.getY()) { } - + B2IBox(sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, @@ -65,7 +65,7 @@ namespace basegfx maRangeX.expand(x2); maRangeY.expand(y2); } - + B2IBox(const B2ITuple& rTuple1, const B2ITuple& rTuple2) : maRangeX(rTuple1.getX()), @@ -73,40 +73,40 @@ namespace basegfx { expand( rTuple2 ); } - + B2IBox(const B2IBox& rBox) : maRangeX(rBox.maRangeX), maRangeY(rBox.maRangeY) { } - bool isEmpty() const + bool isEmpty() const { return maRangeX.isEmpty() || maRangeY.isEmpty(); } - void reset() - { - maRangeX.reset(); - maRangeY.reset(); + void reset() + { + maRangeX.reset(); + maRangeY.reset(); } - bool operator==( const B2IBox& rBox ) const - { - return (maRangeX == rBox.maRangeX - && maRangeY == rBox.maRangeY); + bool operator==( const B2IBox& rBox ) const + { + return (maRangeX == rBox.maRangeX + && maRangeY == rBox.maRangeY); } - bool operator!=( const B2IBox& rBox ) const - { - return (maRangeX != rBox.maRangeX - || maRangeY != rBox.maRangeY); + bool operator!=( const B2IBox& rBox ) const + { + return (maRangeX != rBox.maRangeX + || maRangeY != rBox.maRangeY); } - void operator=(const B2IBox& rBox) - { - maRangeX = rBox.maRangeX; - maRangeY = rBox.maRangeY; + void operator=(const B2IBox& rBox) + { + maRangeX = rBox.maRangeX; + maRangeY = rBox.maRangeY; } sal_Int32 getMinX() const @@ -146,7 +146,7 @@ namespace basegfx maRangeY.getMinimum() ); } - + B2IPoint getMaximum() const { return B2IPoint( @@ -162,7 +162,7 @@ namespace basegfx maRangeY.getRange() ); } - + B2DPoint getCenter() const { return B2DPoint( @@ -170,11 +170,11 @@ namespace basegfx maRangeY.getCenter() ); } - + bool isInside(const B2ITuple& rTuple) const { return ( - maRangeX.isInside(rTuple.getX()) + maRangeX.isInside(rTuple.getX()) && maRangeY.isInside(rTuple.getY()) ); } @@ -182,7 +182,7 @@ namespace basegfx bool isInside(const B2IBox& rBox) const { return ( - maRangeX.isInside(rBox.maRangeX) + maRangeX.isInside(rBox.maRangeX) && maRangeY.isInside(rBox.maRangeY) ); } @@ -190,7 +190,7 @@ namespace basegfx bool overlaps(const B2IBox& rBox) const { return ( - maRangeX.overlaps(rBox.maRangeX) + maRangeX.overlaps(rBox.maRangeX) && maRangeY.overlaps(rBox.maRangeY) ); } @@ -203,25 +203,25 @@ namespace basegfx void expand(const B2IBox& rBox) { - maRangeX.expand(rBox.maRangeX); - maRangeY.expand(rBox.maRangeY); + maRangeX.expand(rBox.maRangeX); + maRangeY.expand(rBox.maRangeY); } void intersect(const B2IBox& rBox) { - maRangeX.intersect(rBox.maRangeX); - maRangeY.intersect(rBox.maRangeY); + maRangeX.intersect(rBox.maRangeX); + maRangeY.intersect(rBox.maRangeY); } void grow(sal_Int32 nValue) { - maRangeX.grow(nValue); - maRangeY.grow(nValue); + maRangeX.grow(nValue); + maRangeY.grow(nValue); } private: - BasicBox maRangeX; - BasicBox maRangeY; + BasicBox maRangeX; + BasicBox maRangeY; }; /** Compute the set difference of the two given boxes @@ -243,9 +243,9 @@ namespace basegfx @return the input vector */ - ::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 ); } // end of namespace basegfx diff --git a/basegfx/inc/basegfx/range/b2irange.hxx b/basegfx/inc/basegfx/range/b2irange.hxx index 5378e487ba95..85ac60df724e 100644 --- a/basegfx/inc/basegfx/range/b2irange.hxx +++ b/basegfx/inc/basegfx/range/b2irange.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 @@ -41,73 +41,73 @@ namespace basegfx { class B2IRange { - public: - typedef sal_Int32 ValueType; - typedef Int32Traits TraitsType; + public: + typedef sal_Int32 ValueType; + typedef Int32Traits TraitsType; - B2IRange() + B2IRange() { } - + explicit B2IRange(const B2ITuple& rTuple) - : maRangeX(rTuple.getX()), + : maRangeX(rTuple.getX()), maRangeY(rTuple.getY()) { } - + B2IRange(sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2) - : maRangeX(x1), + : maRangeX(x1), maRangeY(y1) { maRangeX.expand(x2); maRangeY.expand(y2); } - + B2IRange(const B2ITuple& rTuple1, const B2ITuple& rTuple2) - : maRangeX(rTuple1.getX()), + : maRangeX(rTuple1.getX()), maRangeY(rTuple1.getY()) { expand( rTuple2 ); } - + B2IRange(const B2IRange& rRange) - : maRangeX(rRange.maRangeX), + : maRangeX(rRange.maRangeX), maRangeY(rRange.maRangeY) { } - bool isEmpty() const + bool isEmpty() const { return maRangeX.isEmpty() || maRangeY.isEmpty(); } - void reset() - { - maRangeX.reset(); - maRangeY.reset(); + void reset() + { + maRangeX.reset(); + maRangeY.reset(); } - bool operator==( const B2IRange& rRange ) const - { - return (maRangeX == rRange.maRangeX - && maRangeY == rRange.maRangeY); + bool operator==( const B2IRange& rRange ) const + { + return (maRangeX == rRange.maRangeX + && maRangeY == rRange.maRangeY); } - bool operator!=( const B2IRange& rRange ) const - { - return (maRangeX != rRange.maRangeX - || maRangeY != rRange.maRangeY); + bool operator!=( const B2IRange& rRange ) const + { + return (maRangeX != rRange.maRangeX + || maRangeY != rRange.maRangeY); } - B2IRange& operator=(const B2IRange& rRange) - { - maRangeX = rRange.maRangeX; - maRangeY = rRange.maRangeY; - return *this; + B2IRange& operator=(const B2IRange& rRange) + { + maRangeX = rRange.maRangeX; + maRangeY = rRange.maRangeY; + return *this; } sal_Int32 getMinX() const @@ -147,7 +147,7 @@ namespace basegfx maRangeY.getMinimum() ); } - + B2IPoint getMaximum() const { return B2IPoint( @@ -163,7 +163,7 @@ namespace basegfx maRangeY.getRange() ); } - + B2DPoint getCenter() const { return B2DPoint( @@ -171,11 +171,11 @@ namespace basegfx maRangeY.getCenter() ); } - + bool isInside(const B2ITuple& rTuple) const { return ( - maRangeX.isInside(rTuple.getX()) + maRangeX.isInside(rTuple.getX()) && maRangeY.isInside(rTuple.getY()) ); } @@ -183,7 +183,7 @@ namespace basegfx bool isInside(const B2IRange& rRange) const { return ( - maRangeX.isInside(rRange.maRangeX) + maRangeX.isInside(rRange.maRangeX) && maRangeY.isInside(rRange.maRangeY) ); } @@ -191,7 +191,7 @@ namespace basegfx bool overlaps(const B2IRange& rRange) const { return ( - maRangeX.overlaps(rRange.maRangeX) + maRangeX.overlaps(rRange.maRangeX) && maRangeY.overlaps(rRange.maRangeY) ); } @@ -204,27 +204,27 @@ namespace basegfx void expand(const B2IRange& rRange) { - maRangeX.expand(rRange.maRangeX); - maRangeY.expand(rRange.maRangeY); + maRangeX.expand(rRange.maRangeX); + maRangeY.expand(rRange.maRangeY); } void intersect(const B2IRange& rRange) { - maRangeX.intersect(rRange.maRangeX); - maRangeY.intersect(rRange.maRangeY); + maRangeX.intersect(rRange.maRangeX); + maRangeY.intersect(rRange.maRangeY); } void grow(sal_Int32 nValue) { - maRangeX.grow(nValue); - maRangeY.grow(nValue); + maRangeX.grow(nValue); + maRangeY.grow(nValue); } private: - typedef ::basegfx::BasicRange< ValueType, TraitsType > MyBasicRange; + typedef ::basegfx::BasicRange< ValueType, TraitsType > MyBasicRange; - MyBasicRange maRangeX; - MyBasicRange maRangeY; + MyBasicRange maRangeX; + MyBasicRange maRangeY; }; /** Compute the set difference of the two given ranges @@ -246,9 +246,9 @@ namespace basegfx @return the input vector */ - ::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 ); } // end of namespace basegfx diff --git a/basegfx/inc/basegfx/range/b2irectangle.hxx b/basegfx/inc/basegfx/range/b2irectangle.hxx index 2abc954e0196..965fe7b10bbe 100644 --- a/basegfx/inc/basegfx/range/b2irectangle.hxx +++ b/basegfx/inc/basegfx/range/b2irectangle.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 diff --git a/basegfx/inc/basegfx/range/b3drange.hxx b/basegfx/inc/basegfx/range/b3drange.hxx index 8e1cf8aa9f02..eeec1fa29e16 100644 --- a/basegfx/inc/basegfx/range/b3drange.hxx +++ b/basegfx/inc/basegfx/range/b3drange.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,31 +42,31 @@ namespace basegfx class B3DRange { - typedef ::basegfx::BasicRange< double, DoubleTraits > MyBasicRange; + typedef ::basegfx::BasicRange< double, DoubleTraits > MyBasicRange; - MyBasicRange maRangeX; - MyBasicRange maRangeY; - MyBasicRange maRangeZ; + MyBasicRange maRangeX; + MyBasicRange maRangeY; + MyBasicRange maRangeZ; - public: - B3DRange() + public: + B3DRange() { } - + explicit B3DRange(const B3DTuple& rTuple) - : maRangeX(rTuple.getX()), + : maRangeX(rTuple.getX()), maRangeY(rTuple.getY()), maRangeZ(rTuple.getZ()) { } - + B3DRange(double x1, double y1, double z1, double x2, double y2, double z2) - : maRangeX(x1), + : maRangeX(x1), maRangeY(y1), maRangeZ(z1) { @@ -77,15 +77,15 @@ namespace basegfx B3DRange(const B3DTuple& rTuple1, const B3DTuple& rTuple2) - : maRangeX(rTuple1.getX()), + : maRangeX(rTuple1.getX()), maRangeY(rTuple1.getY()), maRangeZ(rTuple1.getZ()) { expand(rTuple2); } - + B3DRange(const B3DRange& rRange) - : maRangeX(rRange.maRangeX), + : maRangeX(rRange.maRangeX), maRangeY(rRange.maRangeY), maRangeZ(rRange.maRangeZ) { @@ -93,49 +93,49 @@ namespace basegfx explicit B3DRange(const B3IRange& rRange); - bool isEmpty() const + bool isEmpty() const { return ( - maRangeX.isEmpty() - || maRangeY.isEmpty() + maRangeX.isEmpty() + || maRangeY.isEmpty() || maRangeZ.isEmpty() ); } - void reset() - { - maRangeX.reset(); - maRangeY.reset(); - maRangeZ.reset(); + void reset() + { + maRangeX.reset(); + maRangeY.reset(); + maRangeZ.reset(); } - - bool operator==( const B3DRange& rRange ) const - { - return (maRangeX == rRange.maRangeX + + bool operator==( const B3DRange& rRange ) const + { + return (maRangeX == rRange.maRangeX && maRangeY == rRange.maRangeY - && maRangeZ == rRange.maRangeZ); + && maRangeZ == rRange.maRangeZ); } - bool operator!=( const B3DRange& rRange ) const - { - return (maRangeX != rRange.maRangeX + bool operator!=( const B3DRange& rRange ) const + { + return (maRangeX != rRange.maRangeX || maRangeY != rRange.maRangeY - || maRangeZ != rRange.maRangeZ); + || maRangeZ != rRange.maRangeZ); } - B3DRange& operator=(const B3DRange& rRange) - { - maRangeX = rRange.maRangeX; - maRangeY = rRange.maRangeY; - maRangeZ = rRange.maRangeZ; - return *this; + B3DRange& operator=(const B3DRange& rRange) + { + maRangeX = rRange.maRangeX; + maRangeY = rRange.maRangeY; + maRangeZ = rRange.maRangeZ; + return *this; } bool equal(const B3DRange& rRange) const { - return (maRangeX.equal(rRange.maRangeX) + return (maRangeX.equal(rRange.maRangeX) && maRangeY.equal(rRange.maRangeY) - && maRangeZ.equal(rRange.maRangeZ)); + && maRangeZ.equal(rRange.maRangeZ)); } double getMinX() const @@ -191,7 +191,7 @@ namespace basegfx maRangeZ.getMinimum() ); } - + B3DPoint getMaximum() const { return B3DPoint( @@ -209,7 +209,7 @@ namespace basegfx maRangeZ.getRange() ); } - + B3DPoint getCenter() const { return B3DPoint( @@ -218,26 +218,26 @@ namespace basegfx maRangeZ.getCenter() ); } - + double getCenterX() const { return maRangeX.getCenter(); } - + double getCenterY() const { return maRangeY.getCenter(); } - + double getCenterZ() const { return maRangeZ.getCenter(); } - + bool isInside(const B3DTuple& rTuple) const { return ( - maRangeX.isInside(rTuple.getX()) + maRangeX.isInside(rTuple.getX()) && maRangeY.isInside(rTuple.getY()) && maRangeZ.isInside(rTuple.getZ()) ); @@ -246,7 +246,7 @@ namespace basegfx bool isInside(const B3DRange& rRange) const { return ( - maRangeX.isInside(rRange.maRangeX) + maRangeX.isInside(rRange.maRangeX) && maRangeY.isInside(rRange.maRangeY) && maRangeZ.isInside(rRange.maRangeZ) ); @@ -255,7 +255,7 @@ namespace basegfx bool overlaps(const B3DRange& rRange) const { return ( - maRangeX.overlaps(rRange.maRangeX) + maRangeX.overlaps(rRange.maRangeX) && maRangeY.overlaps(rRange.maRangeY) && maRangeZ.overlaps(rRange.maRangeZ) ); @@ -270,23 +270,23 @@ namespace basegfx void expand(const B3DRange& rRange) { - maRangeX.expand(rRange.maRangeX); - maRangeY.expand(rRange.maRangeY); - maRangeZ.expand(rRange.maRangeZ); + maRangeX.expand(rRange.maRangeX); + maRangeY.expand(rRange.maRangeY); + maRangeZ.expand(rRange.maRangeZ); } void intersect(const B3DRange& rRange) { - maRangeX.intersect(rRange.maRangeX); - maRangeY.intersect(rRange.maRangeY); - maRangeZ.intersect(rRange.maRangeZ); + maRangeX.intersect(rRange.maRangeX); + maRangeY.intersect(rRange.maRangeY); + maRangeZ.intersect(rRange.maRangeZ); } void grow(double fValue) { - maRangeX.grow(fValue); - maRangeY.grow(fValue); - maRangeZ.grow(fValue); + maRangeX.grow(fValue); + maRangeY.grow(fValue); + maRangeZ.grow(fValue); } void transform(const B3DHomMatrix& rMatrix); diff --git a/basegfx/inc/basegfx/range/b3dvolume.hxx b/basegfx/inc/basegfx/range/b3dvolume.hxx index 50cac5188271..4891444dc87e 100644 --- a/basegfx/inc/basegfx/range/b3dvolume.hxx +++ b/basegfx/inc/basegfx/range/b3dvolume.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 diff --git a/basegfx/inc/basegfx/range/b3ibox.hxx b/basegfx/inc/basegfx/range/b3ibox.hxx index 7c349becd43c..a219ef41181b 100644 --- a/basegfx/inc/basegfx/range/b3ibox.hxx +++ b/basegfx/inc/basegfx/range/b3ibox.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 @@ -39,22 +39,22 @@ namespace basegfx { class B3IBox { - BasicBox maRangeX; - BasicBox maRangeY; - BasicBox maRangeZ; + BasicBox maRangeX; + BasicBox maRangeY; + BasicBox maRangeZ; - public: - B3IBox() + public: + B3IBox() { } - + explicit B3IBox(const B3ITuple& rTuple) : maRangeX(rTuple.getX()), maRangeY(rTuple.getY()), maRangeZ(rTuple.getZ()) { } - + B3IBox(sal_Int32 x1, sal_Int32 y1, sal_Int32 z1, @@ -86,37 +86,37 @@ namespace basegfx { } - bool isEmpty() const + bool isEmpty() const { return maRangeX.isEmpty() || maRangeY.isEmpty() || maRangeZ.isEmpty(); } - void reset() - { - maRangeX.reset(); - maRangeY.reset(); - maRangeZ.reset(); + void reset() + { + maRangeX.reset(); + maRangeY.reset(); + maRangeZ.reset(); } - - bool operator==( const B3IBox& rBox ) const - { - return (maRangeX == rBox.maRangeX + + bool operator==( const B3IBox& rBox ) const + { + return (maRangeX == rBox.maRangeX && maRangeY == rBox.maRangeY - && maRangeZ == rBox.maRangeZ); + && maRangeZ == rBox.maRangeZ); } - bool operator!=( const B3IBox& rBox ) const - { - return (maRangeX != rBox.maRangeX + bool operator!=( const B3IBox& rBox ) const + { + return (maRangeX != rBox.maRangeX || maRangeY != rBox.maRangeY - || maRangeZ != rBox.maRangeZ); + || maRangeZ != rBox.maRangeZ); } - void operator=(const B3IBox& rBox) - { - maRangeX = rBox.maRangeX; - maRangeY = rBox.maRangeY; - maRangeZ = rBox.maRangeZ; + void operator=(const B3IBox& rBox) + { + maRangeX = rBox.maRangeX; + maRangeY = rBox.maRangeY; + maRangeZ = rBox.maRangeZ; } sal_Int32 getMinX() const @@ -172,7 +172,7 @@ namespace basegfx maRangeZ.getMinimum() ); } - + B3IPoint getMaximum() const { return B3IPoint( @@ -190,7 +190,7 @@ namespace basegfx maRangeZ.getRange() ); } - + B3DPoint getCenter() const { return B3DPoint( @@ -199,11 +199,11 @@ namespace basegfx maRangeZ.getCenter() ); } - + bool isInside(const B3ITuple& rTuple) const { return ( - maRangeX.isInside(rTuple.getX()) + maRangeX.isInside(rTuple.getX()) && maRangeY.isInside(rTuple.getY()) && maRangeZ.isInside(rTuple.getZ()) ); @@ -212,7 +212,7 @@ namespace basegfx bool isInside(const B3IBox& rBox) const { return ( - maRangeX.isInside(rBox.maRangeX) + maRangeX.isInside(rBox.maRangeX) && maRangeY.isInside(rBox.maRangeY) && maRangeZ.isInside(rBox.maRangeZ) ); @@ -221,7 +221,7 @@ namespace basegfx bool overlaps(const B3IBox& rBox) const { return ( - maRangeX.overlaps(rBox.maRangeX) + maRangeX.overlaps(rBox.maRangeX) && maRangeY.overlaps(rBox.maRangeY) && maRangeZ.overlaps(rBox.maRangeZ) ); @@ -236,23 +236,23 @@ namespace basegfx void expand(const B3IBox& rBox) { - maRangeX.expand(rBox.maRangeX); - maRangeY.expand(rBox.maRangeY); - maRangeZ.expand(rBox.maRangeZ); + maRangeX.expand(rBox.maRangeX); + maRangeY.expand(rBox.maRangeY); + maRangeZ.expand(rBox.maRangeZ); } void intersect(const B3IBox& rBox) { - maRangeX.intersect(rBox.maRangeX); - maRangeY.intersect(rBox.maRangeY); - maRangeZ.intersect(rBox.maRangeZ); + maRangeX.intersect(rBox.maRangeX); + maRangeY.intersect(rBox.maRangeY); + maRangeZ.intersect(rBox.maRangeZ); } void grow(sal_Int32 nValue) { - maRangeX.grow(nValue); - maRangeY.grow(nValue); - maRangeZ.grow(nValue); + maRangeX.grow(nValue); + maRangeY.grow(nValue); + maRangeZ.grow(nValue); } }; } // end of namespace basegfx diff --git a/basegfx/inc/basegfx/range/b3irange.hxx b/basegfx/inc/basegfx/range/b3irange.hxx index 32d48812d2cd..b2c8e7f30360 100644 --- a/basegfx/inc/basegfx/range/b3irange.hxx +++ b/basegfx/inc/basegfx/range/b3irange.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 @@ -39,31 +39,31 @@ namespace basegfx { class B3IRange { - typedef ::basegfx::BasicRange< sal_Int32, Int32Traits > MyBasicRange; + typedef ::basegfx::BasicRange< sal_Int32, Int32Traits > MyBasicRange; - MyBasicRange maRangeX; - MyBasicRange maRangeY; - MyBasicRange maRangeZ; + MyBasicRange maRangeX; + MyBasicRange maRangeY; + MyBasicRange maRangeZ; - public: - B3IRange() + public: + B3IRange() { } - + explicit B3IRange(const B3ITuple& rTuple) - : maRangeX(rTuple.getX()), + : maRangeX(rTuple.getX()), maRangeY(rTuple.getY()), maRangeZ(rTuple.getZ()) { } - + B3IRange(sal_Int32 x1, sal_Int32 y1, sal_Int32 z1, sal_Int32 x2, sal_Int32 y2, sal_Int32 z2) - : maRangeX(x1), + : maRangeX(x1), maRangeY(y1), maRangeZ(z1) { @@ -74,7 +74,7 @@ namespace basegfx B3IRange(const B3ITuple& rTuple1, const B3ITuple& rTuple2) - : maRangeX(rTuple1.getX()), + : maRangeX(rTuple1.getX()), maRangeY(rTuple1.getY()), maRangeZ(rTuple1.getZ()) { @@ -82,44 +82,44 @@ namespace basegfx } B3IRange(const B3IRange& rRange) - : maRangeX(rRange.maRangeX), + : maRangeX(rRange.maRangeX), maRangeY(rRange.maRangeY), maRangeZ(rRange.maRangeZ) { } - bool isEmpty() const + bool isEmpty() const { return maRangeX.isEmpty() || maRangeY.isEmpty() || maRangeZ.isEmpty(); } - void reset() - { - maRangeX.reset(); - maRangeY.reset(); - maRangeZ.reset(); + void reset() + { + maRangeX.reset(); + maRangeY.reset(); + maRangeZ.reset(); } - - bool operator==( const B3IRange& rRange ) const - { - return (maRangeX == rRange.maRangeX + + bool operator==( const B3IRange& rRange ) const + { + return (maRangeX == rRange.maRangeX && maRangeY == rRange.maRangeY - && maRangeZ == rRange.maRangeZ); + && maRangeZ == rRange.maRangeZ); } - bool operator!=( const B3IRange& rRange ) const - { - return (maRangeX != rRange.maRangeX + bool operator!=( const B3IRange& rRange ) const + { + return (maRangeX != rRange.maRangeX || maRangeY != rRange.maRangeY - || maRangeZ != rRange.maRangeZ); + || maRangeZ != rRange.maRangeZ); } - B3IRange& operator=(const B3IRange& rRange) - { - maRangeX = rRange.maRangeX; - maRangeY = rRange.maRangeY; - maRangeZ = rRange.maRangeZ; - return *this; + B3IRange& operator=(const B3IRange& rRange) + { + maRangeX = rRange.maRangeX; + maRangeY = rRange.maRangeY; + maRangeZ = rRange.maRangeZ; + return *this; } sal_Int32 getMinX() const @@ -175,7 +175,7 @@ namespace basegfx maRangeZ.getMinimum() ); } - + B3IPoint getMaximum() const { return B3IPoint( @@ -193,7 +193,7 @@ namespace basegfx maRangeZ.getRange() ); } - + B3DPoint getCenter() const { return B3DPoint( @@ -202,11 +202,11 @@ namespace basegfx maRangeZ.getCenter() ); } - + bool isInside(const B3ITuple& rTuple) const { return ( - maRangeX.isInside(rTuple.getX()) + maRangeX.isInside(rTuple.getX()) && maRangeY.isInside(rTuple.getY()) && maRangeZ.isInside(rTuple.getZ()) ); @@ -215,7 +215,7 @@ namespace basegfx bool isInside(const B3IRange& rRange) const { return ( - maRangeX.isInside(rRange.maRangeX) + maRangeX.isInside(rRange.maRangeX) && maRangeY.isInside(rRange.maRangeY) && maRangeZ.isInside(rRange.maRangeZ) ); @@ -224,7 +224,7 @@ namespace basegfx bool overlaps(const B3IRange& rRange) const { return ( - maRangeX.overlaps(rRange.maRangeX) + maRangeX.overlaps(rRange.maRangeX) && maRangeY.overlaps(rRange.maRangeY) && maRangeZ.overlaps(rRange.maRangeZ) ); @@ -239,23 +239,23 @@ namespace basegfx void expand(const B3IRange& rRange) { - maRangeX.expand(rRange.maRangeX); - maRangeY.expand(rRange.maRangeY); - maRangeZ.expand(rRange.maRangeZ); + maRangeX.expand(rRange.maRangeX); + maRangeY.expand(rRange.maRangeY); + maRangeZ.expand(rRange.maRangeZ); } void intersect(const B3IRange& rRange) { - maRangeX.intersect(rRange.maRangeX); - maRangeY.intersect(rRange.maRangeY); - maRangeZ.intersect(rRange.maRangeZ); + maRangeX.intersect(rRange.maRangeX); + maRangeY.intersect(rRange.maRangeY); + maRangeZ.intersect(rRange.maRangeZ); } void grow(sal_Int32 nValue) { - maRangeX.grow(nValue); - maRangeY.grow(nValue); - maRangeZ.grow(nValue); + maRangeX.grow(nValue); + maRangeY.grow(nValue); + maRangeZ.grow(nValue); } }; } // end of namespace basegfx diff --git a/basegfx/inc/basegfx/range/b3ivolume.hxx b/basegfx/inc/basegfx/range/b3ivolume.hxx index 67fe3d2959f6..18f003e11c3e 100644 --- a/basegfx/inc/basegfx/range/b3ivolume.hxx +++ b/basegfx/inc/basegfx/range/b3ivolume.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 diff --git a/basegfx/inc/basegfx/range/basicbox.hxx b/basegfx/inc/basegfx/range/basicbox.hxx index 0159acc9e8e0..3625dd9b48b5 100644 --- a/basegfx/inc/basegfx/range/basicbox.hxx +++ b/basegfx/inc/basegfx/range/basicbox.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 diff --git a/basegfx/inc/basegfx/range/basicrange.hxx b/basegfx/inc/basegfx/range/basicrange.hxx index 8711f95b754c..d8f149f205c8 100644 --- a/basegfx/inc/basegfx/range/basicrange.hxx +++ b/basegfx/inc/basegfx/range/basicrange.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 @@ -39,12 +39,12 @@ namespace basegfx template< typename T, typename Traits > class BasicRange { protected: - T mnMinimum; - T mnMaximum; - + T mnMinimum; + T mnMaximum; + public: - typedef T ValueType; - typedef Traits TraitsType; + typedef T ValueType; + typedef Traits TraitsType; BasicRange() : mnMinimum(Traits::maxVal()), @@ -148,13 +148,13 @@ namespace basegfx return ((rRange.mnMaximum > mnMinimum) && (rRange.mnMinimum < mnMaximum)); } - bool operator==( const BasicRange& rRange ) const - { + bool operator==( const BasicRange& rRange ) const + { return (mnMinimum == rRange.mnMinimum && mnMaximum == rRange.mnMaximum); } - bool operator!=( const BasicRange& rRange ) const - { + bool operator!=( const BasicRange& rRange ) const + { return (mnMinimum != rRange.mnMinimum || mnMaximum != rRange.mnMaximum); } @@ -162,13 +162,13 @@ namespace basegfx { mnMinimum = rRange.mnMinimum; mnMaximum = rRange.mnMaximum; - return *this; + return *this; } bool equal(const BasicRange& rRange) const { return ( - fTools::equal(mnMinimum, rRange.mnMinimum) && + fTools::equal(mnMinimum, rRange.mnMinimum) && fTools::equal(mnMaximum, rRange.mnMaximum)); } @@ -207,7 +207,7 @@ namespace basegfx { mnMinimum = rRange.mnMinimum; } - + if(rRange.mnMaximum > mnMaximum) { mnMaximum = rRange.mnMaximum; @@ -229,7 +229,7 @@ namespace basegfx { mnMinimum = rRange.mnMinimum; } - + if(rRange.mnMaximum < mnMaximum) { mnMaximum = rRange.mnMaximum; diff --git a/basegfx/inc/basegfx/range/rangeexpander.hxx b/basegfx/inc/basegfx/range/rangeexpander.hxx index 509757d79750..6d8e2562e2ad 100644 --- a/basegfx/inc/basegfx/range/rangeexpander.hxx +++ b/basegfx/inc/basegfx/range/rangeexpander.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 @@ -53,9 +53,9 @@ namespace basegfx */ template< typename RangeType > class RangeExpander { - public: - typedef RangeType ValueType; - typedef void result_type; + public: + typedef RangeType ValueType; + typedef void result_type; explicit RangeExpander( ValueType& rBounds ) : mrBounds( rBounds ) diff --git a/basegfx/inc/basegfx/raster/bpixelraster.hxx b/basegfx/inc/basegfx/raster/bpixelraster.hxx index b479384bb806..7516a82b5ca2 100644 --- a/basegfx/inc/basegfx/raster/bpixelraster.hxx +++ b/basegfx/inc/basegfx/raster/bpixelraster.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 @@ -49,10 +49,10 @@ namespace basegfx BPixelRaster& operator=(const BPixelRaster&); protected: - sal_uInt32 mnWidth; - sal_uInt32 mnHeight; - sal_uInt32 mnCount; - BPixel* mpContent; + sal_uInt32 mnWidth; + sal_uInt32 mnHeight; + sal_uInt32 mnCount; + BPixel* mpContent; public: // reset @@ -63,7 +63,7 @@ namespace basegfx // constructor/destructor BPixelRaster(sal_uInt32 nWidth, sal_uInt32 nHeight) - : mnWidth(nWidth), + : mnWidth(nWidth), mnHeight(nHeight), mnCount(nWidth * nHeight), mpContent(new BPixel[mnCount]) @@ -85,12 +85,12 @@ namespace basegfx sal_uInt32 getWidth() const { return mnWidth; } sal_uInt32 getHeight() const { return mnHeight; } sal_uInt32 getCount() const { return mnCount; } - + // data access read only const BPixel& getBPixel(sal_uInt32 nIndex) const { #ifdef DBG_UTIL - if(nIndex >= mnCount) + if(nIndex >= mnCount) { OSL_ENSURE(false, "getBPixel: Access out of range (!)"); return BPixel::getEmptyBPixel(); @@ -103,7 +103,7 @@ namespace basegfx BPixel& getBPixel(sal_uInt32 nIndex) { #ifdef DBG_UTIL - if(nIndex >= mnCount) + if(nIndex >= mnCount) { OSL_ENSURE(false, "getBPixel: Access out of range (!)"); return mpContent[0L]; diff --git a/basegfx/inc/basegfx/raster/bzpixelraster.hxx b/basegfx/inc/basegfx/raster/bzpixelraster.hxx index 9e3cd6db36f1..06b2d41e9cc8 100644 --- a/basegfx/inc/basegfx/raster/bzpixelraster.hxx +++ b/basegfx/inc/basegfx/raster/bzpixelraster.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 @@ -43,7 +43,7 @@ namespace basegfx { protected: // additionally, host a ZBuffer - sal_uInt16* mpZBuffer; + sal_uInt16* mpZBuffer; public: // reset @@ -55,7 +55,7 @@ namespace basegfx // constructor/destructor BZPixelRaster(sal_uInt32 nWidth, sal_uInt32 nHeight) - : BPixelRaster(nWidth, nHeight), + : BPixelRaster(nWidth, nHeight), mpZBuffer(new sal_uInt16[mnCount]) { rtl_zeroMemory(mpZBuffer, sizeof(sal_uInt16) * mnCount); @@ -70,7 +70,7 @@ namespace basegfx const sal_uInt16& getZ(sal_uInt32 nIndex) const { #ifdef DBG_UTIL - if(nIndex >= mnCount) + if(nIndex >= mnCount) { OSL_ENSURE(false, "getZ: Access out of range (!)"); return mpZBuffer[0L]; @@ -83,7 +83,7 @@ namespace basegfx sal_uInt16& getZ(sal_uInt32 nIndex) { #ifdef DBG_UTIL - if(nIndex >= mnCount) + if(nIndex >= mnCount) { OSL_ENSURE(false, "getZ: Access out of range (!)"); return mpZBuffer[0L]; diff --git a/basegfx/inc/basegfx/raster/rasterconvert3d.hxx b/basegfx/inc/basegfx/raster/rasterconvert3d.hxx index 0644fd1923d8..bd5d71778663 100644 --- a/basegfx/inc/basegfx/raster/rasterconvert3d.hxx +++ b/basegfx/inc/basegfx/raster/rasterconvert3d.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 @@ -53,18 +53,18 @@ namespace basegfx class ip_single { private: - double mfVal; - double mfInc; + double mfVal; + double mfInc; public: - ip_single() - : mfVal(0.0), - mfInc(0.0) + ip_single() + : mfVal(0.0), + mfInc(0.0) {} - ip_single(double fVal, double fInc) - : mfVal(fVal), - mfInc(fInc) + ip_single(double fVal, double fInc) + : mfVal(fVal), + mfInc(fInc) {} double getVal() const { return mfVal; } @@ -79,17 +79,17 @@ namespace basegfx class ip_double { private: - ip_single maX; - ip_single maY; + ip_single maX; + ip_single maY; public: - ip_double() - : maX(), + ip_double() + : maX(), maY() {} - ip_double(double fXVal, double fXInc, double fYVal, double fYInc) - : maX(fXVal, fXInc), + ip_double(double fXVal, double fXInc, double fYVal, double fYInc) + : maX(fXVal, fXInc), maY(fYVal, fYInc) {} @@ -105,19 +105,19 @@ namespace basegfx class ip_triple { private: - ip_single maX; - ip_single maY; - ip_single maZ; + ip_single maX; + ip_single maY; + ip_single maZ; public: - ip_triple() - : maX(), + ip_triple() + : maX(), maY(), maZ() {} - ip_triple(double fXVal, double fXInc, double fYVal, double fYInc, double fZVal, double fZInc) - : maX(fXVal, fXInc), + ip_triple(double fXVal, double fXInc, double fYVal, double fYInc, double fZVal, double fZInc) + : maX(fXVal, fXInc), maY(fYVal, fYInc), maZ(fZVal, fZInc) {} @@ -136,15 +136,15 @@ namespace basegfx namespace basegfx { - #define SCANLINE_EMPTY_INDEX (0xffffffff) + #define SCANLINE_EMPTY_INDEX (0xffffffff) class InterpolatorProvider3D { private: - ::std::vector< ip_triple > maColorInterpolators; - ::std::vector< ip_triple > maNormalInterpolators; - ::std::vector< ip_double > maTextureInterpolators; - ::std::vector< ip_triple > maInverseTextureInterpolators; + ::std::vector< ip_triple > maColorInterpolators; + ::std::vector< ip_triple > maNormalInterpolators; + ::std::vector< ip_double > maTextureInterpolators; + ::std::vector< ip_triple > maInverseTextureInterpolators; protected: sal_uInt32 addColorInterpolator(const BColor& rA, const BColor& rB, double fInvYDelta) @@ -213,19 +213,19 @@ namespace basegfx class RasterConversionLineEntry3D { private: - ip_single maX; - ip_single maZ; - sal_Int32 mnY; - sal_uInt32 mnCount; + ip_single maX; + ip_single maZ; + sal_Int32 mnY; + sal_uInt32 mnCount; - sal_uInt32 mnColorIndex; - sal_uInt32 mnNormalIndex; - sal_uInt32 mnTextureIndex; - sal_uInt32 mnInverseTextureIndex; + sal_uInt32 mnColorIndex; + sal_uInt32 mnNormalIndex; + sal_uInt32 mnTextureIndex; + sal_uInt32 mnInverseTextureIndex; public: RasterConversionLineEntry3D(const double& rfX, const double& rfDeltaX, const double& rfZ, const double& rfDeltaZ, sal_Int32 nY, sal_uInt32 nCount) - : maX(rfX, rfDeltaX), + : maX(rfX, rfDeltaX), maZ(rfZ, rfDeltaZ), mnY(nY), mnCount(nCount), @@ -312,7 +312,7 @@ namespace basegfx { private: // the line entries for an area conversion run - ::std::vector< RasterConversionLineEntry3D > maLineEntries; + ::std::vector< RasterConversionLineEntry3D > maLineEntries; struct lineComparator { diff --git a/basegfx/inc/basegfx/tools/b2dclipstate.hxx b/basegfx/inc/basegfx/tools/b2dclipstate.hxx index 4550df124588..bc3d1c1e664b 100644 --- a/basegfx/inc/basegfx/tools/b2dclipstate.hxx +++ b/basegfx/inc/basegfx/tools/b2dclipstate.hxx @@ -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 @@ -78,7 +78,7 @@ namespace basegfx /// unshare this poly-range with all internally shared instances void makeUnique(); - + /// Set clip to 'null' - nothing is visible void makeNull(); /// returns true when clip is 'null' - nothing is visible diff --git a/basegfx/inc/basegfx/tools/canvastools.hxx b/basegfx/inc/basegfx/tools/canvastools.hxx index 1dae369e80c8..1841d1f0ed82 100644 --- a/basegfx/inc/basegfx/tools/canvastools.hxx +++ b/basegfx/inc/basegfx/tools/canvastools.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 @@ -54,7 +54,7 @@ namespace com { namespace sun { namespace star { namespace rendering class XPolyPolygon2D; } } } } -namespace com { namespace sun { namespace star { namespace awt +namespace com { namespace sun { namespace star { namespace awt { struct Point; struct Size; @@ -80,101 +80,101 @@ namespace basegfx // Polygon conversions // =================================================================== - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > - xPolyPolygonFromB2DPolygon( const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XGraphicDevice >& xGraphicDevice, - const ::basegfx::B2DPolygon& rPoly ); + ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > + xPolyPolygonFromB2DPolygon( const ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XGraphicDevice >& xGraphicDevice, + const ::basegfx::B2DPolygon& rPoly ); - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > - xPolyPolygonFromB2DPolyPolygon( const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XGraphicDevice >& xGraphicDevice, - const ::basegfx::B2DPolyPolygon& rPolyPoly ); + ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > + xPolyPolygonFromB2DPolyPolygon( const ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XGraphicDevice >& xGraphicDevice, + const ::basegfx::B2DPolyPolygon& rPolyPoly ); - ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Sequence< - ::com::sun::star::geometry::RealBezierSegment2D > > + ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Sequence< + ::com::sun::star::geometry::RealBezierSegment2D > > bezierSequenceSequenceFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly ); - ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Sequence< - ::com::sun::star::geometry::RealPoint2D > > + ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Sequence< + ::com::sun::star::geometry::RealPoint2D > > pointSequenceSequenceFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly ); - ::basegfx::B2DPolygon polygonFromPoint2DSequence( - const ::com::sun::star::uno::Sequence< + ::basegfx::B2DPolygon polygonFromPoint2DSequence( + const ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D >& rPoints ); - ::basegfx::B2DPolyPolygon polyPolygonFromPoint2DSequenceSequence( - const ::com::sun::star::uno::Sequence< + ::basegfx::B2DPolyPolygon polyPolygonFromPoint2DSequenceSequence( + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& rPoints ); - ::basegfx::B2DPolygon polygonFromBezier2DSequence( - const ::com::sun::star::uno::Sequence< + ::basegfx::B2DPolygon polygonFromBezier2DSequence( + const ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D >& rPoints ); - ::basegfx::B2DPolyPolygon polyPolygonFromBezier2DSequenceSequence( - const ::com::sun::star::uno::Sequence< + ::basegfx::B2DPolyPolygon polyPolygonFromBezier2DSequenceSequence( + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D > >& rPoints ); ::basegfx::B2DPolyPolygon b2DPolyPolygonFromXPolyPolygon2D( - const ::com::sun::star::uno::Reference< + const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& rPoly ); // Matrix conversions // =================================================================== - ::com::sun::star::geometry::AffineMatrix2D& - affineMatrixFromHomMatrix( ::com::sun::star::geometry::AffineMatrix2D& matrix, - const ::basegfx::B2DHomMatrix& transform); + ::com::sun::star::geometry::AffineMatrix2D& + affineMatrixFromHomMatrix( ::com::sun::star::geometry::AffineMatrix2D& matrix, + const ::basegfx::B2DHomMatrix& transform); ::com::sun::star::geometry::AffineMatrix3D& affineMatrixFromHomMatrix3D( - ::com::sun::star::geometry::AffineMatrix3D& matrix, + ::com::sun::star::geometry::AffineMatrix3D& matrix, const ::basegfx::B3DHomMatrix& transform); - ::basegfx::B2DHomMatrix& - homMatrixFromAffineMatrix( ::basegfx::B2DHomMatrix& transform, - const ::com::sun::star::geometry::AffineMatrix2D& matrix ); + ::basegfx::B2DHomMatrix& + homMatrixFromAffineMatrix( ::basegfx::B2DHomMatrix& transform, + const ::com::sun::star::geometry::AffineMatrix2D& matrix ); ::basegfx::B2DHomMatrix homMatrixFromAffineMatrix( const ::com::sun::star::geometry::AffineMatrix2D& matrix ); ::basegfx::B3DHomMatrix homMatrixFromAffineMatrix3D( const ::com::sun::star::geometry::AffineMatrix3D& matrix ); - ::com::sun::star::geometry::Matrix2D& + ::com::sun::star::geometry::Matrix2D& matrixFromHomMatrix( ::com::sun::star::geometry::Matrix2D& matrix, - const ::basegfx::B2DHomMatrix& transform); + const ::basegfx::B2DHomMatrix& transform); - ::basegfx::B2DHomMatrix& - homMatrixFromMatrix( ::basegfx::B2DHomMatrix& transform, + ::basegfx::B2DHomMatrix& + homMatrixFromMatrix( ::basegfx::B2DHomMatrix& transform, const ::com::sun::star::geometry::Matrix2D& matrix ); // Geometry conversions // =================================================================== - ::com::sun::star::geometry::RealSize2D size2DFromB2DSize( const ::basegfx::B2DVector& ); - ::com::sun::star::geometry::RealPoint2D point2DFromB2DPoint( const ::basegfx::B2DPoint& ); - ::com::sun::star::geometry::RealRectangle2D rectangle2DFromB2DRectangle( const ::basegfx::B2DRange& ); - ::com::sun::star::geometry::RealRectangle3D rectangle3DFromB3DRectangle( const ::basegfx::B3DRange& ); - - ::basegfx::B2DVector b2DSizeFromRealSize2D( const ::com::sun::star::geometry::RealSize2D& ); - ::basegfx::B2DPoint b2DPointFromRealPoint2D( const ::com::sun::star::geometry::RealPoint2D& ); - ::basegfx::B2DRange b2DRectangleFromRealRectangle2D( const ::com::sun::star::geometry::RealRectangle2D& ); - ::basegfx::B3DRange b3DRectangleFromRealRectangle3D( const ::com::sun::star::geometry::RealRectangle3D& ); + ::com::sun::star::geometry::RealSize2D size2DFromB2DSize( const ::basegfx::B2DVector& ); + ::com::sun::star::geometry::RealPoint2D point2DFromB2DPoint( const ::basegfx::B2DPoint& ); + ::com::sun::star::geometry::RealRectangle2D rectangle2DFromB2DRectangle( const ::basegfx::B2DRange& ); + ::com::sun::star::geometry::RealRectangle3D rectangle3DFromB3DRectangle( const ::basegfx::B3DRange& ); - ::com::sun::star::geometry::IntegerSize2D integerSize2DFromB2ISize( const ::basegfx::B2IVector& ); - ::com::sun::star::geometry::IntegerPoint2D integerPoint2DFromB2IPoint( const ::basegfx::B2IPoint& ); - ::com::sun::star::geometry::IntegerRectangle2D integerRectangle2DFromB2IRectangle( const ::basegfx::B2IRange& ); + ::basegfx::B2DVector b2DSizeFromRealSize2D( const ::com::sun::star::geometry::RealSize2D& ); + ::basegfx::B2DPoint b2DPointFromRealPoint2D( const ::com::sun::star::geometry::RealPoint2D& ); + ::basegfx::B2DRange b2DRectangleFromRealRectangle2D( const ::com::sun::star::geometry::RealRectangle2D& ); + ::basegfx::B3DRange b3DRectangleFromRealRectangle3D( const ::com::sun::star::geometry::RealRectangle3D& ); - ::basegfx::B2IVector b2ISizeFromIntegerSize2D( const ::com::sun::star::geometry::IntegerSize2D& ); - ::basegfx::B2IPoint b2IPointFromIntegerPoint2D( const ::com::sun::star::geometry::IntegerPoint2D& ); - ::basegfx::B2IRange b2IRectangleFromIntegerRectangle2D( const ::com::sun::star::geometry::IntegerRectangle2D& ); + ::com::sun::star::geometry::IntegerSize2D integerSize2DFromB2ISize( const ::basegfx::B2IVector& ); + ::com::sun::star::geometry::IntegerPoint2D integerPoint2DFromB2IPoint( const ::basegfx::B2IPoint& ); + ::com::sun::star::geometry::IntegerRectangle2D integerRectangle2DFromB2IRectangle( const ::basegfx::B2IRange& ); - ::com::sun::star::awt::Size awtSizeFromB2ISize( const ::basegfx::B2IVector& ); - ::com::sun::star::awt::Point awtPointFromB2IPoint( const ::basegfx::B2IPoint& ); - ::com::sun::star::awt::Rectangle awtRectangleFromB2IRectangle( const ::basegfx::B2IRange& ); + ::basegfx::B2IVector b2ISizeFromIntegerSize2D( const ::com::sun::star::geometry::IntegerSize2D& ); + ::basegfx::B2IPoint b2IPointFromIntegerPoint2D( const ::com::sun::star::geometry::IntegerPoint2D& ); + ::basegfx::B2IRange b2IRectangleFromIntegerRectangle2D( const ::com::sun::star::geometry::IntegerRectangle2D& ); + + ::com::sun::star::awt::Size awtSizeFromB2ISize( const ::basegfx::B2IVector& ); + ::com::sun::star::awt::Point awtPointFromB2IPoint( const ::basegfx::B2IPoint& ); + ::com::sun::star::awt::Rectangle awtRectangleFromB2IRectangle( const ::basegfx::B2IRange& ); - ::basegfx::B2IVector b2ISizeFromAwtSize( const ::com::sun::star::awt::Size& ); - ::basegfx::B2IPoint b2IPointFromAwtPoint( const ::com::sun::star::awt::Point& ); - ::basegfx::B2IRange b2IRectangleFromAwtRectangle( const ::com::sun::star::awt::Rectangle& ); + ::basegfx::B2IVector b2ISizeFromAwtSize( const ::com::sun::star::awt::Size& ); + ::basegfx::B2IPoint b2IPointFromAwtPoint( const ::com::sun::star::awt::Point& ); + ::basegfx::B2IRange b2IRectangleFromAwtRectangle( const ::com::sun::star::awt::Rectangle& ); // Geometry comparisons // =================================================================== @@ -203,8 +203,8 @@ namespace basegfx @return the closest integer range, which completely contains rRange. */ - ::basegfx::B2IRange b2ISurroundingRangeFromB2DRange( const ::basegfx::B2DRange& rRange ); - + ::basegfx::B2IRange b2ISurroundingRangeFromB2DRange( const ::basegfx::B2DRange& rRange ); + /** Return smalltest B2DRange with integer values, which completely contains given floating point range. @@ -214,8 +214,8 @@ namespace basegfx @return the closest B2DRange with integer coordinates, which completely contains rRange. */ - ::basegfx::B2DRange b2DSurroundingIntegerRangeFromB2DRange( const ::basegfx::B2DRange& rRange ); - + ::basegfx::B2DRange b2DSurroundingIntegerRangeFromB2DRange( const ::basegfx::B2DRange& rRange ); + } } diff --git a/basegfx/inc/basegfx/tools/debugplotter.hxx b/basegfx/inc/basegfx/tools/debugplotter.hxx index 0a0f4d5bafa4..c1718f9ab1a4 100644 --- a/basegfx/inc/basegfx/tools/debugplotter.hxx +++ b/basegfx/inc/basegfx/tools/debugplotter.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,7 +35,7 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> #include <rtl/string.hxx> -#include <boost/utility.hpp> // for noncopyable +#include <boost/utility.hpp> // for noncopyable #include <vector> #include <utility> #include <iosfwd> @@ -60,48 +60,48 @@ namespace basegfx public: /** Create new debug output object - @param pTitle + @param pTitle Title of the debug output, will appear in trace output */ explicit DebugPlotter( const sal_Char* pTitle ); /** Create new debug output object - @param pTitle + @param pTitle Title of the debug output, will appear in trace output @param rOutputStream Stream to write output to. Must stay valid over the lifetime of this object! - */ + */ DebugPlotter( const sal_Char* pTitle, ::std::ostream& rOutputStream ); ~DebugPlotter(); - void plot( const B2DPoint& rPoint, - const sal_Char* pTitle ); - void plot( const B2DVector& rVec, - const sal_Char* pTitle ); - void plot( const B2DCubicBezier& rBezier, - const sal_Char* pTitle ); - void plot( const B2DRange& rRange, - const sal_Char* pTitle ); - void plot( const B2DPolygon& rPoly, - const sal_Char* pTitle ); - void plot( const B2DPolyPolygon& rPoly, - const sal_Char* pTitle ); + void plot( const B2DPoint& rPoint, + const sal_Char* pTitle ); + void plot( const B2DVector& rVec, + const sal_Char* pTitle ); + void plot( const B2DCubicBezier& rBezier, + const sal_Char* pTitle ); + void plot( const B2DRange& rRange, + const sal_Char* pTitle ); + void plot( const B2DPolygon& rPoly, + const sal_Char* pTitle ); + void plot( const B2DPolyPolygon& rPoly, + const sal_Char* pTitle ); private: void print( const sal_Char* ); - ::rtl::OString maTitle; - ::std::vector< ::std::pair< B2DPoint, ::rtl::OString > > maPoints; - ::std::vector< ::std::pair< B2DVector, ::rtl::OString > > maVectors; - ::std::vector< ::std::pair< B2DRange, ::rtl::OString > > maRanges; - ::std::vector< ::std::pair< B2DPolygon, ::rtl::OString > > maPolygons; + ::rtl::OString maTitle; + ::std::vector< ::std::pair< B2DPoint, ::rtl::OString > > maPoints; + ::std::vector< ::std::pair< B2DVector, ::rtl::OString > > maVectors; + ::std::vector< ::std::pair< B2DRange, ::rtl::OString > > maRanges; + ::std::vector< ::std::pair< B2DPolygon, ::rtl::OString > > maPolygons; - ::std::ostream* mpOutputStream; + ::std::ostream* mpOutputStream; }; } diff --git a/basegfx/inc/basegfx/tools/gradienttools.hxx b/basegfx/inc/basegfx/tools/gradienttools.hxx index dea18fe67565..a84d6f8cc1ba 100644 --- a/basegfx/inc/basegfx/tools/gradienttools.hxx +++ b/basegfx/inc/basegfx/tools/gradienttools.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 @@ -99,11 +99,11 @@ namespace basegfx Gradient angle (from ODF) */ ODFGradientInfo& createLinearODFGradientInfo(ODFGradientInfo& o_rGradientInfo, - const B2DRange& rTargetArea, - sal_uInt32 nSteps, - double fBorder, + const B2DRange& rTargetArea, + sal_uInt32 nSteps, + double fBorder, double fAngle); - + /** Calculate linear gradient blend value This method generates you the lerp alpha value for @@ -158,9 +158,9 @@ namespace basegfx Gradient angle (from ODF) */ ODFGradientInfo& createAxialODFGradientInfo(ODFGradientInfo& o_rGradientInfo, - const B2DRange& rTargetArea, - sal_uInt32 nSteps, - double fBorder, + const B2DRange& rTargetArea, + sal_uInt32 nSteps, + double fBorder, double fAngle); /** Calculate axial gradient blend value @@ -189,7 +189,7 @@ namespace basegfx return t; } - + /** Create matrix for ODF's radial gradient definition @param o_rGradientInfo @@ -213,11 +213,11 @@ namespace basegfx Gradient angle (from ODF) */ ODFGradientInfo& createRadialODFGradientInfo(ODFGradientInfo& o_rGradientInfo, - const B2DRange& rTargetArea, + const B2DRange& rTargetArea, const B2DVector& rOffset, - sal_uInt32 nSteps, + sal_uInt32 nSteps, double fBorder); - + /** Calculate radial gradient blend value This method generates you the lerp alpha value for @@ -272,10 +272,10 @@ namespace basegfx Gradient angle (from ODF) */ 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); /** Calculate elliptical gradient blend value @@ -320,10 +320,10 @@ namespace basegfx Gradient angle (from ODF) */ 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); /** Calculate square gradient blend value @@ -381,10 +381,10 @@ namespace basegfx Gradient angle (from ODF) */ 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); /** Calculate rectangular gradient blend value diff --git a/basegfx/inc/basegfx/tools/keystoplerp.hxx b/basegfx/inc/basegfx/tools/keystoplerp.hxx index 1762e09a60ef..a8d22931193f 100644 --- a/basegfx/inc/basegfx/tools/keystoplerp.hxx +++ b/basegfx/inc/basegfx/tools/keystoplerp.hxx @@ -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 diff --git a/basegfx/inc/basegfx/tools/lerp.hxx b/basegfx/inc/basegfx/tools/lerp.hxx index dd513400835b..8147b763944c 100644 --- a/basegfx/inc/basegfx/tools/lerp.hxx +++ b/basegfx/inc/basegfx/tools/lerp.hxx @@ -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,11 +47,11 @@ namespace basegfx @param t As usual, t must be in the [0,1] range */ - template< typename ValueType > ValueType lerp( const ValueType& rFrom, - const ValueType& rTo, - double t ) + template< typename ValueType > ValueType lerp( const ValueType& rFrom, + const ValueType& rTo, + double t ) { - // This is only to suppress a double->int warning. All other + // This is only to suppress a double->int warning. All other // types should be okay here. return static_cast<ValueType>( (1.0-t)*rFrom + t*rTo ); } diff --git a/basegfx/inc/basegfx/tools/rectcliptools.hxx b/basegfx/inc/basegfx/tools/rectcliptools.hxx index 7e2ff80876ca..18bd6c57ec2c 100644 --- a/basegfx/inc/basegfx/tools/rectcliptools.hxx +++ b/basegfx/inc/basegfx/tools/rectcliptools.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 @@ -37,7 +37,7 @@ namespace basegfx { namespace tools { - namespace RectClipFlags + namespace RectClipFlags { static const sal_uInt32 LEFT = (sal_Int32)0x01; static const sal_uInt32 RIGHT = (sal_Int32)0x02; @@ -53,9 +53,9 @@ namespace basegfx outside one or more of the four half planes defining the rectangle (see RectClipFlags for possible values) */ - template< class Point, class Rect > inline + template< class Point, class Rect > inline sal_uInt32 getCohenSutherlandClipFlags( const Point& rP, - const Rect& rR ) + const Rect& rR ) { // maxY | minY | maxX | minX sal_uInt32 clip = (rP.getX() < rR.getMinX()) << 0; diff --git a/basegfx/inc/basegfx/tools/tools.hxx b/basegfx/inc/basegfx/tools/tools.hxx index 8b519e0b1371..888dd319b37d 100644 --- a/basegfx/inc/basegfx/tools/tools.hxx +++ b/basegfx/inc/basegfx/tools/tools.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 @@ -43,7 +43,7 @@ namespace basegfx This function clips a line given by two points against the given rectangle. The resulting line is returned in the given points. - + @param io_rStart Start point of the line. On return, contains the clipped start point. @@ -58,9 +58,9 @@ namespace basegfx @return true, when at least part of the line is visible after the clip, false otherwise */ - 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 ); /** Expand given parallelogram, such that it extends beyond bound rect in a given direction. @@ -120,11 +120,11 @@ namespace basegfx @param rFitTarget The rectangle to fit the parallelogram into. */ - 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 ); } } diff --git a/basegfx/inc/basegfx/tools/unopolypolygon.hxx b/basegfx/inc/basegfx/tools/unopolypolygon.hxx index a5bc22b2d5bb..95282f5f1a84 100644 --- a/basegfx/inc/basegfx/tools/unopolypolygon.hxx +++ b/basegfx/inc/basegfx/tools/unopolypolygon.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 @@ -39,10 +39,10 @@ namespace basegfx -{ +{ namespace unotools { - typedef ::cppu::WeakComponentImplHelper3< + typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::rendering::XLinePolyPolygon2D, ::com::sun::star::rendering::XBezierPolyPolygon2D, ::com::sun::star::lang::XServiceInfo > UnoPolyPolygonBase; @@ -89,9 +89,9 @@ namespace unotools throw ::com::sun::star::lang::IndexOutOfBoundsException(); } - B2DPolyPolygon getSubsetPolyPolygon( sal_Int32 nPolygonIndex, - sal_Int32 nNumberOfPolygons, - sal_Int32 nPointIndex, + B2DPolyPolygon getSubsetPolyPolygon( sal_Int32 nPolygonIndex, + sal_Int32 nNumberOfPolygons, + sal_Int32 nPointIndex, sal_Int32 nNumberOfPoints ) const; /// Get cow copy of internal polygon. not thread-safe outside this object. diff --git a/basegfx/inc/basegfx/tuple/b2dtuple.hxx b/basegfx/inc/basegfx/tuple/b2dtuple.hxx index 6a4ab1e32f9d..d8c1eb16630f 100644 --- a/basegfx/inc/basegfx/tuple/b2dtuple.hxx +++ b/basegfx/inc/basegfx/tuple/b2dtuple.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 @@ -48,64 +48,64 @@ namespace basegfx class B2DTuple { protected: - double mfX; - double mfY; - - public: - /** Create a 2D Tuple + double mfX; + double mfY; + + public: + /** Create a 2D Tuple The tuple is initialized to (0.0, 0.0) */ - B2DTuple() - : mfX(0.0), - mfY(0.0) + B2DTuple() + : mfX(0.0), + mfY(0.0) {} - /** Create a 2D Tuple + /** Create a 2D Tuple @param fX This parameter is used to initialize the X-coordinate of the 2D Tuple. - + @param fY This parameter is used to initialize the Y-coordinate of the 2D Tuple. */ - B2DTuple(double fX, double fY) - : mfX( fX ), - mfY( fY ) + B2DTuple(double fX, double fY) + : mfX( fX ), + mfY( fY ) {} - /** Create a copy of a 2D Tuple + /** Create a copy of a 2D Tuple @param rTup The 2D Tuple which will be copied. */ - B2DTuple(const B2DTuple& rTup) - : mfX( rTup.mfX ), - mfY( rTup.mfY ) + B2DTuple(const B2DTuple& rTup) + : mfX( rTup.mfX ), + mfY( rTup.mfY ) {} - /** Create a copy of a 2D integer Tuple + /** Create a copy of a 2D integer Tuple @param rTup The 2D Tuple which will be copied. */ explicit B2DTuple(const B2ITuple& rTup); - ~B2DTuple() + ~B2DTuple() {} /// Get X-Coordinate of 2D Tuple double getX() const - { - return mfX; + { + return mfX; } /// Get Y-Coordinate of 2D Tuple double getY() const - { - return mfY; + { + return mfY; } /// Set X-Coordinate of 2D Tuple @@ -121,8 +121,8 @@ namespace basegfx } /// Array-access to 2D Tuple - const double& operator[] (int nPos) const - { + const double& operator[] (int nPos) const + { // Here, normally one if(...) should be used. In the assumption that // both double members can be accessed as an array a shortcut is used here. // if(0 == nPos) return mfX; return mfY; @@ -131,7 +131,7 @@ namespace basegfx /// Array-access to 2D Tuple double& operator[] (int nPos) - { + { // Here, normally one if(...) should be used. In the assumption that // both double members can be accessed as an array a shortcut is used here. // if(0 == nPos) return mfX; return mfY; @@ -142,99 +142,99 @@ namespace basegfx ////////////////////////////////////////////////////////////////////// bool equalZero() const - { - return (this == &getEmptyTuple() || + { + return (this == &getEmptyTuple() || (fTools::equalZero(mfX) && fTools::equalZero(mfY))); } bool equalZero(const double& rfSmallValue) const - { - return (this == &getEmptyTuple() || + { + return (this == &getEmptyTuple() || (fTools::equalZero(mfX, rfSmallValue) && fTools::equalZero(mfY, rfSmallValue))); } bool equal(const B2DTuple& rTup) const - { + { return ( this == &rTup || - (fTools::equal(mfX, rTup.mfX) && + (fTools::equal(mfX, rTup.mfX) && fTools::equal(mfY, rTup.mfY))); } bool equal(const B2DTuple& rTup, const double& rfSmallValue) const - { + { return ( this == &rTup || - (fTools::equal(mfX, rTup.mfX, rfSmallValue) && + (fTools::equal(mfX, rTup.mfX, rfSmallValue) && fTools::equal(mfY, rTup.mfY, rfSmallValue))); } // operators ////////////////////////////////////////////////////////////////////// - B2DTuple& operator+=( const B2DTuple& rTup ) - { + B2DTuple& operator+=( const B2DTuple& rTup ) + { mfX += rTup.mfX; - mfY += rTup.mfY; - return *this; + mfY += rTup.mfY; + return *this; } - B2DTuple& operator-=( const B2DTuple& rTup ) - { + B2DTuple& operator-=( const B2DTuple& rTup ) + { mfX -= rTup.mfX; - mfY -= rTup.mfY; - return *this; + mfY -= rTup.mfY; + return *this; } - B2DTuple& operator/=( const B2DTuple& rTup ) - { + B2DTuple& operator/=( const B2DTuple& rTup ) + { mfX /= rTup.mfX; - mfY /= rTup.mfY; - return *this; + mfY /= rTup.mfY; + return *this; } - B2DTuple& operator*=( const B2DTuple& rTup ) - { + B2DTuple& operator*=( const B2DTuple& rTup ) + { mfX *= rTup.mfX; - mfY *= rTup.mfY; - return *this; + mfY *= rTup.mfY; + return *this; } - B2DTuple& operator*=(double t) - { - mfX *= t; - mfY *= t; - return *this; + B2DTuple& operator*=(double t) + { + mfX *= t; + mfY *= t; + return *this; } - B2DTuple& operator/=(double t) - { + B2DTuple& operator/=(double t) + { const double fVal(1.0 / t); - mfX *= fVal; - mfY *= fVal; - return *this; + mfX *= fVal; + mfY *= fVal; + return *this; } - B2DTuple operator-(void) const - { - return B2DTuple(-mfX, -mfY); + B2DTuple operator-(void) const + { + return B2DTuple(-mfX, -mfY); } - - bool operator==( const B2DTuple& rTup ) const - { + + bool operator==( const B2DTuple& rTup ) const + { return equal(rTup); } - bool operator!=( const B2DTuple& rTup ) const - { + bool operator!=( const B2DTuple& rTup ) const + { return !equal(rTup); } - - B2DTuple& operator=( const B2DTuple& rTup ) - { + + B2DTuple& operator=( const B2DTuple& rTup ) + { mfX = rTup.mfX; - mfY = rTup.mfY; - return *this; + mfY = rTup.mfY; + return *this; } void correctValues(const double fCompareValue = 0.0); @@ -245,109 +245,109 @@ namespace basegfx // external operators ////////////////////////////////////////////////////////////////////////// - inline B2DTuple minimum(const B2DTuple& rTupA, const B2DTuple& rTupB) - { + inline B2DTuple minimum(const B2DTuple& rTupA, const B2DTuple& rTupB) + { B2DTuple 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; } - inline B2DTuple maximum(const B2DTuple& rTupA, const B2DTuple& rTupB) - { + inline B2DTuple maximum(const B2DTuple& rTupA, const B2DTuple& rTupB) + { B2DTuple 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; } - inline B2DTuple absolute(const B2DTuple& rTup) - { + inline B2DTuple absolute(const B2DTuple& rTup) + { B2DTuple aAbs( (0.0 > rTup.getX()) ? -rTup.getX() : rTup.getX(), - (0.0 > rTup.getY()) ? -rTup.getY() : rTup.getY()); + (0.0 > rTup.getY()) ? -rTup.getY() : rTup.getY()); return aAbs; } - inline B2DTuple interpolate(const B2DTuple& rOld1, const B2DTuple& rOld2, double t) - { + inline B2DTuple interpolate(const B2DTuple& rOld1, const B2DTuple& 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; } - inline B2DTuple average(const B2DTuple& rOld1, const B2DTuple& rOld2) - { + inline B2DTuple average(const B2DTuple& rOld1, const B2DTuple& rOld2) + { B2DTuple aAvg( (rOld1.getX() + rOld2.getX()) * 0.5, - (rOld1.getY() + rOld2.getY()) * 0.5); + (rOld1.getY() + rOld2.getY()) * 0.5); return aAvg; } - + inline B2DTuple average(const B2DTuple& rOld1, const B2DTuple& rOld2, const B2DTuple& 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; } inline B2DTuple operator+(const B2DTuple& rTupA, const B2DTuple& rTupB) - { - B2DTuple aSum(rTupA); - aSum += rTupB; - return aSum; + { + B2DTuple aSum(rTupA); + aSum += rTupB; + return aSum; } inline B2DTuple operator-(const B2DTuple& rTupA, const B2DTuple& rTupB) - { - B2DTuple aSub(rTupA); - aSub -= rTupB; - return aSub; + { + B2DTuple aSub(rTupA); + aSub -= rTupB; + return aSub; } inline B2DTuple operator/(const B2DTuple& rTupA, const B2DTuple& rTupB) - { - B2DTuple aDiv(rTupA); - aDiv /= rTupB; - return aDiv; + { + B2DTuple aDiv(rTupA); + aDiv /= rTupB; + return aDiv; } inline B2DTuple operator*(const B2DTuple& rTupA, const B2DTuple& rTupB) - { - B2DTuple aMul(rTupA); - aMul *= rTupB; - return aMul; + { + B2DTuple aMul(rTupA); + aMul *= rTupB; + return aMul; } inline B2DTuple operator*(const B2DTuple& rTup, double t) - { - B2DTuple aNew(rTup); - aNew *= t; - return aNew; + { + B2DTuple aNew(rTup); + aNew *= t; + return aNew; } inline B2DTuple operator*(double t, const B2DTuple& rTup) - { - B2DTuple aNew(rTup); - aNew *= t; - return aNew; + { + B2DTuple aNew(rTup); + aNew *= t; + return aNew; } inline B2DTuple operator/(const B2DTuple& rTup, double t) - { - B2DTuple aNew(rTup); - aNew /= t; - return aNew; + { + B2DTuple aNew(rTup); + aNew /= t; + return aNew; } inline B2DTuple operator/(double t, const B2DTuple& rTup) { - B2DTuple aNew(t, t); - B2DTuple aTmp(rTup); - aNew /= aTmp; - return aNew; + B2DTuple aNew(t, t); + B2DTuple aTmp(rTup); + aNew /= aTmp; + return aNew; } /** Round double to nearest integer for 2D tuple diff --git a/basegfx/inc/basegfx/tuple/b2i64tuple.hxx b/basegfx/inc/basegfx/tuple/b2i64tuple.hxx index a75e13755820..5d78c407b4da 100644 --- a/basegfx/inc/basegfx/tuple/b2i64tuple.hxx +++ b/basegfx/inc/basegfx/tuple/b2i64tuple.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 @@ -46,57 +46,57 @@ namespace basegfx class B2I64Tuple { protected: - sal_Int64 mnX; - sal_Int64 mnY; - - public: - /** Create a 2D Tuple + sal_Int64 mnX; + sal_Int64 mnY; + + public: + /** Create a 2D Tuple The tuple is initialized to (0, 0) */ - B2I64Tuple() - : mnX(0), - mnY(0) + B2I64Tuple() + : mnX(0), + mnY(0) {} - /** Create a 2D Tuple + /** Create a 2D Tuple @param fX This parameter is used to initialize the X-coordinate of the 2D Tuple. - + @param fY This parameter is used to initialize the Y-coordinate of the 2D Tuple. */ - B2I64Tuple(sal_Int64 fX, sal_Int64 fY) - : mnX( fX ), - mnY( fY ) + B2I64Tuple(sal_Int64 fX, sal_Int64 fY) + : mnX( fX ), + mnY( fY ) {} - /** Create a copy of a 2D Tuple + /** Create a copy of a 2D Tuple @param rTup The 2D Tuple which will be copied. */ - B2I64Tuple(const B2I64Tuple& rTup) - : mnX( rTup.mnX ), - mnY( rTup.mnY ) + B2I64Tuple(const B2I64Tuple& rTup) + : mnX( rTup.mnX ), + mnY( rTup.mnY ) {} - ~B2I64Tuple() + ~B2I64Tuple() {} /// Get X-Coordinate of 2D Tuple sal_Int64 getX() const - { - return mnX; + { + return mnX; } /// Get Y-Coordinate of 2D Tuple sal_Int64 getY() const - { - return mnY; + { + return mnY; } /// Set X-Coordinate of 2D Tuple @@ -112,8 +112,8 @@ namespace basegfx } /// Array-access to 2D Tuple - const sal_Int64& operator[] (int nPos) const - { + const sal_Int64& operator[] (int nPos) const + { // Here, normally one if(...) should be used. In the assumption that // both sal_Int64 members can be accessed as an array a shortcut is used here. // if(0 == nPos) return mnX; return mnY; @@ -122,7 +122,7 @@ namespace basegfx /// Array-access to 2D Tuple sal_Int64& operator[] (int nPos) - { + { // Here, normally one if(...) should be used. In the assumption that // both sal_Int64 members can be accessed as an array a shortcut is used here. // if(0 == nPos) return mnX; return mnY; @@ -132,70 +132,70 @@ namespace basegfx // operators ////////////////////////////////////////////////////////////////////// - B2I64Tuple& operator+=( const B2I64Tuple& rTup ) - { + B2I64Tuple& operator+=( const B2I64Tuple& rTup ) + { mnX += rTup.mnX; - mnY += rTup.mnY; - return *this; + mnY += rTup.mnY; + return *this; } - B2I64Tuple& operator-=( const B2I64Tuple& rTup ) - { + B2I64Tuple& operator-=( const B2I64Tuple& rTup ) + { mnX -= rTup.mnX; - mnY -= rTup.mnY; - return *this; + mnY -= rTup.mnY; + return *this; } - B2I64Tuple& operator/=( const B2I64Tuple& rTup ) - { + B2I64Tuple& operator/=( const B2I64Tuple& rTup ) + { mnX /= rTup.mnX; - mnY /= rTup.mnY; - return *this; + mnY /= rTup.mnY; + return *this; } - B2I64Tuple& operator*=( const B2I64Tuple& rTup ) - { + B2I64Tuple& operator*=( const B2I64Tuple& rTup ) + { mnX *= rTup.mnX; - mnY *= rTup.mnY; - return *this; + mnY *= rTup.mnY; + return *this; } - B2I64Tuple& operator*=(sal_Int64 t) - { - mnX *= t; - mnY *= t; - return *this; + B2I64Tuple& operator*=(sal_Int64 t) + { + mnX *= t; + mnY *= t; + return *this; } - B2I64Tuple& operator/=(sal_Int64 t) - { - mnX /= t; - mnY /= t; - return *this; + B2I64Tuple& operator/=(sal_Int64 t) + { + mnX /= t; + mnY /= t; + return *this; } - B2I64Tuple operator-(void) const - { - return B2I64Tuple(-mnX, -mnY); + B2I64Tuple operator-(void) const + { + return B2I64Tuple(-mnX, -mnY); } - + bool equalZero() const { return mnX == 0 && mnY == 0; } - bool operator==( const B2I64Tuple& rTup ) const - { + bool operator==( const B2I64Tuple& rTup ) const + { return this == &rTup || (rTup.mnX == mnX && rTup.mnY == mnY); } - bool operator!=( const B2I64Tuple& rTup ) const - { + bool operator!=( const B2I64Tuple& rTup ) const + { return !(*this == rTup); } - - B2I64Tuple& operator=( const B2I64Tuple& rTup ) - { + + B2I64Tuple& operator=( const B2I64Tuple& rTup ) + { mnX = rTup.mnX; - mnY = rTup.mnY; - return *this; + mnY = rTup.mnY; + return *this; } static const B2I64Tuple& getEmptyTuple(); @@ -204,109 +204,109 @@ namespace basegfx // external operators ////////////////////////////////////////////////////////////////////////// - inline B2I64Tuple minimum(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB) - { + inline B2I64Tuple minimum(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB) + { B2I64Tuple 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; } - inline B2I64Tuple maximum(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB) - { + inline B2I64Tuple maximum(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB) + { B2I64Tuple 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; } - inline B2I64Tuple absolute(const B2I64Tuple& rTup) - { + inline B2I64Tuple absolute(const B2I64Tuple& rTup) + { B2I64Tuple aAbs( (0 > rTup.getX()) ? -rTup.getX() : rTup.getX(), - (0 > rTup.getY()) ? -rTup.getY() : rTup.getY()); + (0 > rTup.getY()) ? -rTup.getY() : rTup.getY()); return aAbs; } - inline B2DTuple interpolate(const B2I64Tuple& rOld1, const B2I64Tuple& rOld2, double t) - { + inline B2DTuple interpolate(const B2I64Tuple& rOld1, const B2I64Tuple& 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; } - inline B2DTuple average(const B2I64Tuple& rOld1, const B2I64Tuple& rOld2) - { + inline B2DTuple average(const B2I64Tuple& rOld1, const B2I64Tuple& rOld2) + { B2DTuple aAvg( (rOld1.getX() + rOld2.getX()) * 0.5, - (rOld1.getY() + rOld2.getY()) * 0.5); + (rOld1.getY() + rOld2.getY()) * 0.5); return aAvg; } - + inline B2DTuple average(const B2I64Tuple& rOld1, const B2I64Tuple& rOld2, const B2I64Tuple& 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; } inline B2I64Tuple operator+(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB) - { - B2I64Tuple aSum(rTupA); - aSum += rTupB; - return aSum; + { + B2I64Tuple aSum(rTupA); + aSum += rTupB; + return aSum; } inline B2I64Tuple operator-(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB) - { - B2I64Tuple aSub(rTupA); - aSub -= rTupB; - return aSub; + { + B2I64Tuple aSub(rTupA); + aSub -= rTupB; + return aSub; } inline B2I64Tuple operator/(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB) - { - B2I64Tuple aDiv(rTupA); - aDiv /= rTupB; - return aDiv; + { + B2I64Tuple aDiv(rTupA); + aDiv /= rTupB; + return aDiv; } inline B2I64Tuple operator*(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB) - { - B2I64Tuple aMul(rTupA); - aMul *= rTupB; - return aMul; + { + B2I64Tuple aMul(rTupA); + aMul *= rTupB; + return aMul; } inline B2I64Tuple operator*(const B2I64Tuple& rTup, sal_Int64 t) - { - B2I64Tuple aNew(rTup); - aNew *= t; - return aNew; + { + B2I64Tuple aNew(rTup); + aNew *= t; + return aNew; } inline B2I64Tuple operator*(sal_Int64 t, const B2I64Tuple& rTup) - { - B2I64Tuple aNew(rTup); - aNew *= t; - return aNew; + { + B2I64Tuple aNew(rTup); + aNew *= t; + return aNew; } inline B2I64Tuple operator/(const B2I64Tuple& rTup, sal_Int64 t) - { - B2I64Tuple aNew(rTup); - aNew /= t; - return aNew; + { + B2I64Tuple aNew(rTup); + aNew /= t; + return aNew; } inline B2I64Tuple operator/(sal_Int64 t, const B2I64Tuple& rTup) { - B2I64Tuple aNew(t, t); - B2I64Tuple aTmp(rTup); - aNew /= aTmp; - return aNew; + B2I64Tuple aNew(t, t); + B2I64Tuple aTmp(rTup); + aNew /= aTmp; + return aNew; } } // end of namespace basegfx diff --git a/basegfx/inc/basegfx/tuple/b2ituple.hxx b/basegfx/inc/basegfx/tuple/b2ituple.hxx index 636862f365b8..2611d386e7d6 100644 --- a/basegfx/inc/basegfx/tuple/b2ituple.hxx +++ b/basegfx/inc/basegfx/tuple/b2ituple.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 @@ -45,57 +45,57 @@ namespace basegfx class B2ITuple { protected: - sal_Int32 mnX; - sal_Int32 mnY; - - public: - /** Create a 2D Tuple + sal_Int32 mnX; + sal_Int32 mnY; + + public: + /** Create a 2D Tuple The tuple is initialized to (0, 0) */ - B2ITuple() - : mnX(0), - mnY(0) + B2ITuple() + : mnX(0), + mnY(0) {} - /** Create a 2D Tuple + /** Create a 2D Tuple @param fX This parameter is used to initialize the X-coordinate of the 2D Tuple. - + @param fY This parameter is used to initialize the Y-coordinate of the 2D Tuple. */ - B2ITuple(sal_Int32 fX, sal_Int32 fY) - : mnX( fX ), - mnY( fY ) + B2ITuple(sal_Int32 fX, sal_Int32 fY) + : mnX( fX ), + mnY( fY ) {} - /** Create a copy of a 2D Tuple + /** Create a copy of a 2D Tuple @param rTup The 2D Tuple which will be copied. */ - B2ITuple(const B2ITuple& rTup) - : mnX( rTup.mnX ), - mnY( rTup.mnY ) + B2ITuple(const B2ITuple& rTup) + : mnX( rTup.mnX ), + mnY( rTup.mnY ) {} - ~B2ITuple() + ~B2ITuple() {} /// Get X-Coordinate of 2D Tuple sal_Int32 getX() const - { - return mnX; + { + return mnX; } /// Get Y-Coordinate of 2D Tuple sal_Int32 getY() const - { - return mnY; + { + return mnY; } /// Set X-Coordinate of 2D Tuple @@ -111,8 +111,8 @@ namespace basegfx } /// Array-access to 2D Tuple - const sal_Int32& operator[] (int nPos) const - { + const sal_Int32& operator[] (int nPos) const + { // Here, normally one if(...) should be used. In the assumption that // both sal_Int32 members can be accessed as an array a shortcut is used here. // if(0 == nPos) return mnX; return mnY; @@ -121,7 +121,7 @@ namespace basegfx /// Array-access to 2D Tuple sal_Int32& operator[] (int nPos) - { + { // Here, normally one if(...) should be used. In the assumption that // both sal_Int32 members can be accessed as an array a shortcut is used here. // if(0 == nPos) return mnX; return mnY; @@ -131,70 +131,70 @@ namespace basegfx // operators ////////////////////////////////////////////////////////////////////// - B2ITuple& operator+=( const B2ITuple& rTup ) - { + B2ITuple& operator+=( const B2ITuple& rTup ) + { mnX += rTup.mnX; - mnY += rTup.mnY; - return *this; + mnY += rTup.mnY; + return *this; } - B2ITuple& operator-=( const B2ITuple& rTup ) - { + B2ITuple& operator-=( const B2ITuple& rTup ) + { mnX -= rTup.mnX; - mnY -= rTup.mnY; - return *this; + mnY -= rTup.mnY; + return *this; } - B2ITuple& operator/=( const B2ITuple& rTup ) - { + B2ITuple& operator/=( const B2ITuple& rTup ) + { mnX /= rTup.mnX; - mnY /= rTup.mnY; - return *this; + mnY /= rTup.mnY; + return *this; } - B2ITuple& operator*=( const B2ITuple& rTup ) - { + B2ITuple& operator*=( const B2ITuple& rTup ) + { mnX *= rTup.mnX; - mnY *= rTup.mnY; - return *this; + mnY *= rTup.mnY; + return *this; } - B2ITuple& operator*=(sal_Int32 t) - { - mnX *= t; - mnY *= t; - return *this; + B2ITuple& operator*=(sal_Int32 t) + { + mnX *= t; + mnY *= t; + return *this; } - B2ITuple& operator/=(sal_Int32 t) - { - mnX /= t; - mnY /= t; - return *this; + B2ITuple& operator/=(sal_Int32 t) + { + mnX /= t; + mnY /= t; + return *this; } - B2ITuple operator-(void) const - { - return B2ITuple(-mnX, -mnY); + B2ITuple operator-(void) const + { + return B2ITuple(-mnX, -mnY); } - + bool equalZero() const { return mnX == 0 && mnY == 0; } - bool operator==( const B2ITuple& rTup ) const - { + bool operator==( const B2ITuple& rTup ) const + { return this == &rTup || (rTup.mnX == mnX && rTup.mnY == mnY); } - bool operator!=( const B2ITuple& rTup ) const - { + bool operator!=( const B2ITuple& rTup ) const + { return !(*this == rTup); } - - B2ITuple& operator=( const B2ITuple& rTup ) - { + + B2ITuple& operator=( const B2ITuple& rTup ) + { mnX = rTup.mnX; - mnY = rTup.mnY; - return *this; + mnY = rTup.mnY; + return *this; } static const B2ITuple& getEmptyTuple(); @@ -205,16 +205,16 @@ namespace basegfx class B2DTuple; - B2ITuple minimum(const B2ITuple& rTupA, const B2ITuple& rTupB); - - B2ITuple maximum(const B2ITuple& rTupA, const B2ITuple& rTupB); + B2ITuple minimum(const B2ITuple& rTupA, const B2ITuple& rTupB); - B2ITuple absolute(const B2ITuple& rTup); + B2ITuple maximum(const B2ITuple& rTupA, const B2ITuple& rTupB); - B2DTuple interpolate(const B2ITuple& rOld1, const B2ITuple& rOld2, double t); + B2ITuple absolute(const B2ITuple& rTup); - B2DTuple average(const B2ITuple& rOld1, const B2ITuple& rOld2); + B2DTuple interpolate(const B2ITuple& rOld1, const B2ITuple& rOld2, double t); + B2DTuple average(const B2ITuple& rOld1, const B2ITuple& rOld2); + B2DTuple average(const B2ITuple& rOld1, const B2ITuple& rOld2, const B2ITuple& rOld3); B2ITuple operator+(const B2ITuple& rTupA, const B2ITuple& rTupB); diff --git a/basegfx/inc/basegfx/tuple/b3dtuple.hxx b/basegfx/inc/basegfx/tuple/b3dtuple.hxx index dd2329f1c4bd..b8d975537dd7 100644 --- a/basegfx/inc/basegfx/tuple/b3dtuple.hxx +++ b/basegfx/inc/basegfx/tuple/b3dtuple.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 @@ -48,78 +48,78 @@ namespace basegfx class B3DTuple { protected: - double mfX; - double mfY; - double mfZ; + double mfX; + double mfY; + double mfZ; public: - /** Create a 3D Tuple + /** Create a 3D Tuple The tuple is initialized to (0.0, 0.0, 0.0) */ B3DTuple() - : mfX(0.0), + : mfX(0.0), mfY(0.0), mfZ(0.0) {} - /** Create a 3D Tuple + /** Create a 3D Tuple @param fX This parameter is used to initialize the X-coordinate of the 3D Tuple. - + @param fY This parameter is used to initialize the Y-coordinate of the 3D Tuple. - + @param fZ This parameter is used to initialize the Z-coordinate of the 3D Tuple. */ B3DTuple(double fX, double fY, double fZ) - : mfX(fX), + : mfX(fX), mfY(fY), mfZ(fZ) {} - /** Create a copy of a 3D Tuple + /** Create a copy of a 3D Tuple @param rTup The 3D Tuple which will be copied. */ - B3DTuple(const B3DTuple& rTup) - : mfX( rTup.mfX ), + B3DTuple(const B3DTuple& rTup) + : mfX( rTup.mfX ), mfY( rTup.mfY ), - mfZ( rTup.mfZ ) + mfZ( rTup.mfZ ) {} - /** Create a copy of a 3D integer Tuple + /** Create a copy of a 3D integer Tuple @param rTup The 3D Tuple which will be copied. */ explicit B3DTuple(const B3ITuple& rTup); - ~B3DTuple() + ~B3DTuple() {} /// get X-Coordinate of 3D Tuple double getX() const - { - return mfX; + { + return mfX; } /// get Y-Coordinate of 3D Tuple double getY() const - { - return mfY; + { + return mfY; } /// get Z-Coordinate of 3D Tuple double getZ() const - { - return mfZ; + { + return mfZ; } /// set X-Coordinate of 3D Tuple @@ -141,8 +141,8 @@ namespace basegfx } /// Array-access to 3D Tuple - const double& operator[] (int nPos) const - { + const double& operator[] (int nPos) const + { // Here, normally two if(...)'s should be used. In the assumption that // both double members can be accessed as an array a shortcut is used here. // if(0 == nPos) return mfX; if(1 == nPos) return mfY; return mfZ; @@ -151,7 +151,7 @@ namespace basegfx /// Array-access to 3D Tuple double& operator[] (int nPos) - { + { // Here, normally two if(...)'s should be used. In the assumption that // both double members can be accessed as an array a shortcut is used here. // if(0 == nPos) return mfX; if(1 == nPos) return mfY; return mfZ; @@ -162,26 +162,26 @@ namespace basegfx ////////////////////////////////////////////////////////////////////// bool equalZero() const - { - return (this == &getEmptyTuple() || - (::basegfx::fTools::equalZero(mfX) - && ::basegfx::fTools::equalZero(mfY) + { + return (this == &getEmptyTuple() || + (::basegfx::fTools::equalZero(mfX) + && ::basegfx::fTools::equalZero(mfY) && ::basegfx::fTools::equalZero(mfZ))); } bool equalZero(const double& rfSmallValue) const - { - return (this == &getEmptyTuple() || - (::basegfx::fTools::equalZero(mfX, rfSmallValue) + { + return (this == &getEmptyTuple() || + (::basegfx::fTools::equalZero(mfX, rfSmallValue) && ::basegfx::fTools::equalZero(mfY, rfSmallValue) && ::basegfx::fTools::equalZero(mfZ, rfSmallValue))); } bool equal(const B3DTuple& rTup) const - { + { return ( this == &rTup || - (::basegfx::fTools::equal(mfX, rTup.mfX) && + (::basegfx::fTools::equal(mfX, rTup.mfX) && ::basegfx::fTools::equal(mfY, rTup.mfY) && ::basegfx::fTools::equal(mfZ, rTup.mfZ))); } @@ -190,84 +190,84 @@ namespace basegfx { return ( this == &rTup || - (::basegfx::fTools::equal(mfX, rTup.mfX, rfSmallValue) && - ::basegfx::fTools::equal(mfY, rTup.mfY, rfSmallValue) && + (::basegfx::fTools::equal(mfX, rTup.mfX, rfSmallValue) && + ::basegfx::fTools::equal(mfY, rTup.mfY, rfSmallValue) && ::basegfx::fTools::equal(mfZ, rTup.mfZ, rfSmallValue))); } // operators ////////////////////////////////////////////////////////////////////// - B3DTuple& operator+=( const B3DTuple& rTup ) - { + B3DTuple& operator+=( const B3DTuple& rTup ) + { mfX += rTup.mfX; - mfY += rTup.mfY; - mfZ += rTup.mfZ; - return *this; + mfY += rTup.mfY; + mfZ += rTup.mfZ; + return *this; } - B3DTuple& operator-=( const B3DTuple& rTup ) - { + B3DTuple& operator-=( const B3DTuple& rTup ) + { mfX -= rTup.mfX; - mfY -= rTup.mfY; - mfZ -= rTup.mfZ; - return *this; + mfY -= rTup.mfY; + mfZ -= rTup.mfZ; + return *this; } - B3DTuple& operator/=( const B3DTuple& rTup ) - { + B3DTuple& operator/=( const B3DTuple& rTup ) + { mfX /= rTup.mfX; - mfY /= rTup.mfY; - mfZ /= rTup.mfZ; - return *this; + mfY /= rTup.mfY; + mfZ /= rTup.mfZ; + return *this; } - B3DTuple& operator*=( const B3DTuple& rTup ) - { + B3DTuple& operator*=( const B3DTuple& rTup ) + { mfX *= rTup.mfX; - mfY *= rTup.mfY; - mfZ *= rTup.mfZ; - return *this; + mfY *= rTup.mfY; + mfZ *= rTup.mfZ; + return *this; } - B3DTuple& operator*=(double t) - { - mfX *= t; - mfY *= t; - mfZ *= t; - return *this; + B3DTuple& operator*=(double t) + { + mfX *= t; + mfY *= t; + mfZ *= t; + return *this; } - B3DTuple& operator/=(double t) - { + B3DTuple& operator/=(double t) + { const double fVal(1.0 / t); - mfX *= fVal; - mfY *= fVal; - mfZ *= fVal; - return *this; + mfX *= fVal; + mfY *= fVal; + mfZ *= fVal; + return *this; } - B3DTuple operator-(void) const - { - return B3DTuple(-mfX, -mfY, -mfZ); + B3DTuple operator-(void) const + { + return B3DTuple(-mfX, -mfY, -mfZ); } - bool operator==( const B3DTuple& rTup ) const - { + bool operator==( const B3DTuple& rTup ) const + { return equal(rTup); } - bool operator!=( const B3DTuple& rTup ) const - { + bool operator!=( const B3DTuple& rTup ) const + { return !equal(rTup); } - - B3DTuple& operator=( const B3DTuple& rTup ) - { + + B3DTuple& operator=( const B3DTuple& rTup ) + { mfX = rTup.mfX; - mfY = rTup.mfY; - mfZ = rTup.mfZ; - return *this; + mfY = rTup.mfY; + mfZ = rTup.mfZ; + return *this; } void correctValues(const double fCompareValue = 0.0) @@ -283,7 +283,7 @@ namespace basegfx { mfY = 0.0; } - + if(::basegfx::fTools::equalZero(mfZ)) { mfZ = 0.0; @@ -295,12 +295,12 @@ namespace basegfx { mfX = fCompareValue; } - + if(::basegfx::fTools::equal(mfY, fCompareValue)) { mfY = fCompareValue; } - + if(::basegfx::fTools::equal(mfZ, fCompareValue)) { mfZ = fCompareValue; @@ -314,114 +314,114 @@ namespace basegfx // external operators ////////////////////////////////////////////////////////////////////////// - inline B3DTuple minimum(const B3DTuple& rTupA, const B3DTuple& rTupB) - { + inline B3DTuple minimum(const B3DTuple& rTupA, const B3DTuple& rTupB) + { B3DTuple aMin( (rTupB.getX() < rTupA.getX()) ? rTupB.getX() : rTupA.getX(), (rTupB.getY() < rTupA.getY()) ? rTupB.getY() : rTupA.getY(), - (rTupB.getZ() < rTupA.getZ()) ? rTupB.getZ() : rTupA.getZ()); + (rTupB.getZ() < rTupA.getZ()) ? rTupB.getZ() : rTupA.getZ()); return aMin; } - inline B3DTuple maximum(const B3DTuple& rTupA, const B3DTuple& rTupB) - { + inline B3DTuple maximum(const B3DTuple& rTupA, const B3DTuple& rTupB) + { B3DTuple aMax( (rTupB.getX() > rTupA.getX()) ? rTupB.getX() : rTupA.getX(), (rTupB.getY() > rTupA.getY()) ? rTupB.getY() : rTupA.getY(), - (rTupB.getZ() > rTupA.getZ()) ? rTupB.getZ() : rTupA.getZ()); + (rTupB.getZ() > rTupA.getZ()) ? rTupB.getZ() : rTupA.getZ()); return aMax; } - inline B3DTuple absolute(const B3DTuple& rTup) - { + inline B3DTuple absolute(const B3DTuple& rTup) + { B3DTuple aAbs( (0.0 > rTup.getX()) ? -rTup.getX() : rTup.getX(), (0.0 > rTup.getY()) ? -rTup.getY() : rTup.getY(), - (0.0 > rTup.getZ()) ? -rTup.getZ() : rTup.getZ()); + (0.0 > rTup.getZ()) ? -rTup.getZ() : rTup.getZ()); return aAbs; } - inline B3DTuple interpolate(const B3DTuple& rOld1, const B3DTuple& rOld2, double t) - { + inline B3DTuple interpolate(const B3DTuple& rOld1, const B3DTuple& rOld2, double t) + { B3DTuple aInt( ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(), ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY(), - ((rOld2.getZ() - rOld1.getZ()) * t) + rOld1.getZ()); + ((rOld2.getZ() - rOld1.getZ()) * t) + rOld1.getZ()); return aInt; } - inline B3DTuple average(const B3DTuple& rOld1, const B3DTuple& rOld2) - { + inline B3DTuple average(const B3DTuple& rOld1, const B3DTuple& rOld2) + { B3DTuple aAvg( (rOld1.getX() + rOld2.getX()) * 0.5, (rOld1.getY() + rOld2.getY()) * 0.5, - (rOld1.getZ() + rOld2.getZ()) * 0.5); + (rOld1.getZ() + rOld2.getZ()) * 0.5); return aAvg; } - + inline B3DTuple average(const B3DTuple& rOld1, const B3DTuple& rOld2, const B3DTuple& rOld3) - { + { B3DTuple aAvg( (rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0), (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0), - (rOld1.getZ() + rOld2.getZ() + rOld3.getZ()) * (1.0 / 3.0)); + (rOld1.getZ() + rOld2.getZ() + rOld3.getZ()) * (1.0 / 3.0)); return aAvg; } - + inline B3DTuple operator+(const B3DTuple& rTupA, const B3DTuple& rTupB) - { - B3DTuple aSum(rTupA); - aSum += rTupB; - return aSum; + { + B3DTuple aSum(rTupA); + aSum += rTupB; + return aSum; } inline B3DTuple operator-(const B3DTuple& rTupA, const B3DTuple& rTupB) - { - B3DTuple aSub(rTupA); - aSub -= rTupB; - return aSub; + { + B3DTuple aSub(rTupA); + aSub -= rTupB; + return aSub; } inline B3DTuple operator/(const B3DTuple& rTupA, const B3DTuple& rTupB) - { - B3DTuple aDiv(rTupA); - aDiv /= rTupB; - return aDiv; + { + B3DTuple aDiv(rTupA); + aDiv /= rTupB; + return aDiv; } inline B3DTuple operator*(const B3DTuple& rTupA, const B3DTuple& rTupB) - { - B3DTuple aMul(rTupA); - aMul *= rTupB; - return aMul; + { + B3DTuple aMul(rTupA); + aMul *= rTupB; + return aMul; } inline B3DTuple operator*(const B3DTuple& rTup, double t) - { - B3DTuple aNew(rTup); - aNew *= t; - return aNew; + { + B3DTuple aNew(rTup); + aNew *= t; + return aNew; } inline B3DTuple operator*(double t, const B3DTuple& rTup) - { - B3DTuple aNew(rTup); - aNew *= t; - return aNew; + { + B3DTuple aNew(rTup); + aNew *= t; + return aNew; } inline B3DTuple operator/(const B3DTuple& rTup, double t) - { - B3DTuple aNew(rTup); - aNew /= t; - return aNew; + { + B3DTuple aNew(rTup); + aNew /= t; + return aNew; } inline B3DTuple operator/(double t, const B3DTuple& rTup) { - B3DTuple aNew(rTup); - aNew /= t; - return aNew; + B3DTuple aNew(rTup); + aNew /= t; + return aNew; } /** Round double to nearest integer for 3D tuple diff --git a/basegfx/inc/basegfx/tuple/b3i64tuple.hxx b/basegfx/inc/basegfx/tuple/b3i64tuple.hxx index b4b3416ce887..1fd4e1eb3a2c 100644 --- a/basegfx/inc/basegfx/tuple/b3i64tuple.hxx +++ b/basegfx/inc/basegfx/tuple/b3i64tuple.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 @@ -46,71 +46,71 @@ namespace basegfx class B3I64Tuple { protected: - sal_Int64 mnX; - sal_Int64 mnY; - sal_Int64 mnZ; + sal_Int64 mnX; + sal_Int64 mnY; + sal_Int64 mnZ; public: - /** Create a 3D Tuple + /** Create a 3D Tuple The tuple is initialized to (0, 0, 0) */ B3I64Tuple() - : mnX(0), + : mnX(0), mnY(0), mnZ(0) {} - /** Create a 3D Tuple + /** Create a 3D Tuple @param nX This parameter is used to initialize the X-coordinate of the 3D Tuple. - + @param nY This parameter is used to initialize the Y-coordinate of the 3D Tuple. - + @param nZ This parameter is used to initialize the Z-coordinate of the 3D Tuple. */ B3I64Tuple(sal_Int64 nX, sal_Int64 nY, sal_Int64 nZ) - : mnX(nX), + : mnX(nX), mnY(nY), mnZ(nZ) {} - /** Create a copy of a 3D Tuple + /** Create a copy of a 3D Tuple @param rTup The 3D Tuple which will be copied. */ - B3I64Tuple(const B3I64Tuple& rTup) - : mnX( rTup.mnX ), + B3I64Tuple(const B3I64Tuple& rTup) + : mnX( rTup.mnX ), mnY( rTup.mnY ), - mnZ( rTup.mnZ ) + mnZ( rTup.mnZ ) {} - ~B3I64Tuple() + ~B3I64Tuple() {} /// get X-Coordinate of 3D Tuple sal_Int64 getX() const - { - return mnX; + { + return mnX; } /// get Y-Coordinate of 3D Tuple sal_Int64 getY() const - { - return mnY; + { + return mnY; } /// get Z-Coordinate of 3D Tuple sal_Int64 getZ() const - { - return mnZ; + { + return mnZ; } /// set X-Coordinate of 3D Tuple @@ -132,8 +132,8 @@ namespace basegfx } /// Array-access to 3D Tuple - const sal_Int64& operator[] (int nPos) const - { + const sal_Int64& operator[] (int nPos) const + { // Here, normally two if(...)'s should be used. In the assumption that // both sal_Int64 members can be accessed as an array a shortcut is used here. // if(0 == nPos) return mnX; if(1 == nPos) return mnY; return mnZ; @@ -142,7 +142,7 @@ namespace basegfx /// Array-access to 3D Tuple sal_Int64& operator[] (int nPos) - { + { // Here, normally two if(...)'s should be used. In the assumption that // both sal_Int64 members can be accessed as an array a shortcut is used here. // if(0 == nPos) return mnX; if(1 == nPos) return mnY; return mnZ; @@ -152,81 +152,81 @@ namespace basegfx // operators ////////////////////////////////////////////////////////////////////// - B3I64Tuple& operator+=( const B3I64Tuple& rTup ) - { + B3I64Tuple& operator+=( const B3I64Tuple& rTup ) + { mnX += rTup.mnX; - mnY += rTup.mnY; - mnZ += rTup.mnZ; - return *this; + mnY += rTup.mnY; + mnZ += rTup.mnZ; + return *this; } - B3I64Tuple& operator-=( const B3I64Tuple& rTup ) - { + B3I64Tuple& operator-=( const B3I64Tuple& rTup ) + { mnX -= rTup.mnX; - mnY -= rTup.mnY; - mnZ -= rTup.mnZ; - return *this; + mnY -= rTup.mnY; + mnZ -= rTup.mnZ; + return *this; } - B3I64Tuple& operator/=( const B3I64Tuple& rTup ) - { + B3I64Tuple& operator/=( const B3I64Tuple& rTup ) + { mnX /= rTup.mnX; - mnY /= rTup.mnY; - mnZ /= rTup.mnZ; - return *this; + mnY /= rTup.mnY; + mnZ /= rTup.mnZ; + return *this; } - B3I64Tuple& operator*=( const B3I64Tuple& rTup ) - { + B3I64Tuple& operator*=( const B3I64Tuple& rTup ) + { mnX *= rTup.mnX; - mnY *= rTup.mnY; - mnZ *= rTup.mnZ; - return *this; + mnY *= rTup.mnY; + mnZ *= rTup.mnZ; + return *this; } - B3I64Tuple& operator*=(sal_Int64 t) - { - mnX *= t; - mnY *= t; - mnZ *= t; - return *this; + B3I64Tuple& operator*=(sal_Int64 t) + { + mnX *= t; + mnY *= t; + mnZ *= t; + return *this; } - B3I64Tuple& operator/=(sal_Int64 t) - { - mnX /= t; - mnY /= t; - mnZ /= t; - return *this; + B3I64Tuple& operator/=(sal_Int64 t) + { + mnX /= t; + mnY /= t; + mnZ /= t; + return *this; } - B3I64Tuple operator-(void) const - { - return B3I64Tuple(-mnX, -mnY, -mnZ); + B3I64Tuple operator-(void) const + { + return B3I64Tuple(-mnX, -mnY, -mnZ); } bool equalZero() const - { - return (this == &getEmptyTuple() || + { + return (this == &getEmptyTuple() || (mnX == 0 && mnY == 0 && mnZ == 0)); } - bool operator==( const B3I64Tuple& rTup ) const - { + bool operator==( const B3I64Tuple& rTup ) const + { return this == &rTup || (rTup.mnX == mnX && rTup.mnY == mnY && rTup.mnZ == mnZ); } - bool operator!=( const B3I64Tuple& rTup ) const - { + bool operator!=( const B3I64Tuple& rTup ) const + { return !(*this == rTup); } - - B3I64Tuple& operator=( const B3I64Tuple& rTup ) - { + + B3I64Tuple& operator=( const B3I64Tuple& rTup ) + { mnX = rTup.mnX; - mnY = rTup.mnY; - mnZ = rTup.mnZ; - return *this; + mnY = rTup.mnY; + mnZ = rTup.mnZ; + return *this; } static const B3I64Tuple& getEmptyTuple(); @@ -235,115 +235,115 @@ namespace basegfx // external operators ////////////////////////////////////////////////////////////////////////// - inline B3I64Tuple minimum(const B3I64Tuple& rTupA, const B3I64Tuple& rTupB) - { + inline B3I64Tuple minimum(const B3I64Tuple& rTupA, const B3I64Tuple& rTupB) + { B3I64Tuple aMin( (rTupB.getX() < rTupA.getX()) ? rTupB.getX() : rTupA.getX(), (rTupB.getY() < rTupA.getY()) ? rTupB.getY() : rTupA.getY(), - (rTupB.getZ() < rTupA.getZ()) ? rTupB.getZ() : rTupA.getZ()); + (rTupB.getZ() < rTupA.getZ()) ? rTupB.getZ() : rTupA.getZ()); return aMin; } - inline B3I64Tuple maximum(const B3I64Tuple& rTupA, const B3I64Tuple& rTupB) - { + inline B3I64Tuple maximum(const B3I64Tuple& rTupA, const B3I64Tuple& rTupB) + { B3I64Tuple aMax( (rTupB.getX() > rTupA.getX()) ? rTupB.getX() : rTupA.getX(), (rTupB.getY() > rTupA.getY()) ? rTupB.getY() : rTupA.getY(), - (rTupB.getZ() > rTupA.getZ()) ? rTupB.getZ() : rTupA.getZ()); + (rTupB.getZ() > rTupA.getZ()) ? rTupB.getZ() : rTupA.getZ()); return aMax; } - inline B3I64Tuple absolute(const B3I64Tuple& rTup) - { + inline B3I64Tuple absolute(const B3I64Tuple& rTup) + { B3I64Tuple aAbs( (0 > rTup.getX()) ? -rTup.getX() : rTup.getX(), (0 > rTup.getY()) ? -rTup.getY() : rTup.getY(), - (0 > rTup.getZ()) ? -rTup.getZ() : rTup.getZ()); + (0 > rTup.getZ()) ? -rTup.getZ() : rTup.getZ()); return aAbs; } - inline B3DTuple interpolate(const B3I64Tuple& rOld1, const B3I64Tuple& rOld2, double t) - { + inline B3DTuple interpolate(const B3I64Tuple& rOld1, const B3I64Tuple& rOld2, double t) + { B3DTuple aInt( ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(), ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY(), - ((rOld2.getZ() - rOld1.getZ()) * t) + rOld1.getZ()); + ((rOld2.getZ() - rOld1.getZ()) * t) + rOld1.getZ()); return aInt; } - inline B3DTuple average(const B3I64Tuple& rOld1, const B3I64Tuple& rOld2) - { + inline B3DTuple average(const B3I64Tuple& rOld1, const B3I64Tuple& rOld2) + { B3DTuple aAvg( (rOld1.getX() + rOld2.getX()) * 0.5, (rOld1.getY() + rOld2.getY()) * 0.5, - (rOld1.getZ() + rOld2.getZ()) * 0.5); + (rOld1.getZ() + rOld2.getZ()) * 0.5); return aAvg; } - + inline B3DTuple average(const B3I64Tuple& rOld1, const B3I64Tuple& rOld2, const B3I64Tuple& rOld3) - { + { B3DTuple aAvg( (rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0), (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0), - (rOld1.getZ() + rOld2.getZ() + rOld3.getZ()) * (1.0 / 3.0)); + (rOld1.getZ() + rOld2.getZ() + rOld3.getZ()) * (1.0 / 3.0)); return aAvg; } - + inline B3I64Tuple operator+(const B3I64Tuple& rTupA, const B3I64Tuple& rTupB) - { - B3I64Tuple aSum(rTupA); - aSum += rTupB; - return aSum; + { + B3I64Tuple aSum(rTupA); + aSum += rTupB; + return aSum; } inline B3I64Tuple operator-(const B3I64Tuple& rTupA, const B3I64Tuple& rTupB) - { - B3I64Tuple aSub(rTupA); - aSub -= rTupB; - return aSub; + { + B3I64Tuple aSub(rTupA); + aSub -= rTupB; + return aSub; } inline B3I64Tuple operator/(const B3I64Tuple& rTupA, const B3I64Tuple& rTupB) - { - B3I64Tuple aDiv(rTupA); - aDiv /= rTupB; - return aDiv; + { + B3I64Tuple aDiv(rTupA); + aDiv /= rTupB; + return aDiv; } inline B3I64Tuple operator*(const B3I64Tuple& rTupA, const B3I64Tuple& rTupB) - { - B3I64Tuple aMul(rTupA); - aMul *= rTupB; - return aMul; + { + B3I64Tuple aMul(rTupA); + aMul *= rTupB; + return aMul; } inline B3I64Tuple operator*(const B3I64Tuple& rTup, sal_Int64 t) - { - B3I64Tuple aNew(rTup); - aNew *= t; - return aNew; + { + B3I64Tuple aNew(rTup); + aNew *= t; + return aNew; } inline B3I64Tuple operator*(sal_Int64 t, const B3I64Tuple& rTup) - { - B3I64Tuple aNew(rTup); - aNew *= t; - return aNew; + { + B3I64Tuple aNew(rTup); + aNew *= t; + return aNew; } inline B3I64Tuple operator/(const B3I64Tuple& rTup, sal_Int64 t) - { - B3I64Tuple aNew(rTup); - aNew /= t; - return aNew; + { + B3I64Tuple aNew(rTup); + aNew /= t; + return aNew; } inline B3I64Tuple operator/(sal_Int64 t, const B3I64Tuple& rTup) { - B3I64Tuple aNew(t, t, t); - B3I64Tuple aTmp(rTup); - aNew /= aTmp; - return aNew; + B3I64Tuple aNew(t, t, t); + B3I64Tuple aTmp(rTup); + aNew /= aTmp; + return aNew; } } // end of namespace basegfx diff --git a/basegfx/inc/basegfx/tuple/b3ituple.hxx b/basegfx/inc/basegfx/tuple/b3ituple.hxx index 619ce145b6b9..d8787af93f9a 100644 --- a/basegfx/inc/basegfx/tuple/b3ituple.hxx +++ b/basegfx/inc/basegfx/tuple/b3ituple.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 @@ -46,71 +46,71 @@ namespace basegfx class B3ITuple { protected: - sal_Int32 mnX; - sal_Int32 mnY; - sal_Int32 mnZ; + sal_Int32 mnX; + sal_Int32 mnY; + sal_Int32 mnZ; public: - /** Create a 3D Tuple + /** Create a 3D Tuple The tuple is initialized to (0, 0, 0) */ B3ITuple() - : mnX(0), + : mnX(0), mnY(0), mnZ(0) {} - /** Create a 3D Tuple + /** Create a 3D Tuple @param nX This parameter is used to initialize the X-coordinate of the 3D Tuple. - + @param nY This parameter is used to initialize the Y-coordinate of the 3D Tuple. - + @param nZ This parameter is used to initialize the Z-coordinate of the 3D Tuple. */ B3ITuple(sal_Int32 nX, sal_Int32 nY, sal_Int32 nZ) - : mnX(nX), + : mnX(nX), mnY(nY), mnZ(nZ) {} - /** Create a copy of a 3D Tuple + /** Create a copy of a 3D Tuple @param rTup The 3D Tuple which will be copied. */ - B3ITuple(const B3ITuple& rTup) - : mnX( rTup.mnX ), + B3ITuple(const B3ITuple& rTup) + : mnX( rTup.mnX ), mnY( rTup.mnY ), - mnZ( rTup.mnZ ) + mnZ( rTup.mnZ ) {} - ~B3ITuple() + ~B3ITuple() {} /// get X-Coordinate of 3D Tuple sal_Int32 getX() const - { - return mnX; + { + return mnX; } /// get Y-Coordinate of 3D Tuple sal_Int32 getY() const - { - return mnY; + { + return mnY; } /// get Z-Coordinate of 3D Tuple sal_Int32 getZ() const - { - return mnZ; + { + return mnZ; } /// set X-Coordinate of 3D Tuple @@ -132,8 +132,8 @@ namespace basegfx } /// Array-access to 3D Tuple - const sal_Int32& operator[] (int nPos) const - { + const sal_Int32& operator[] (int nPos) const + { // Here, normally two if(...)'s should be used. In the assumption that // both sal_Int32 members can be accessed as an array a shortcut is used here. // if(0 == nPos) return mnX; if(1 == nPos) return mnY; return mnZ; @@ -142,7 +142,7 @@ namespace basegfx /// Array-access to 3D Tuple sal_Int32& operator[] (int nPos) - { + { // Here, normally two if(...)'s should be used. In the assumption that // both sal_Int32 members can be accessed as an array a shortcut is used here. // if(0 == nPos) return mnX; if(1 == nPos) return mnY; return mnZ; @@ -152,81 +152,81 @@ namespace basegfx // operators ////////////////////////////////////////////////////////////////////// - B3ITuple& operator+=( const B3ITuple& rTup ) - { + B3ITuple& operator+=( const B3ITuple& rTup ) + { mnX += rTup.mnX; - mnY += rTup.mnY; - mnZ += rTup.mnZ; - return *this; + mnY += rTup.mnY; + mnZ += rTup.mnZ; + return *this; } - B3ITuple& operator-=( const B3ITuple& rTup ) - { + B3ITuple& operator-=( const B3ITuple& rTup ) + { mnX -= rTup.mnX; - mnY -= rTup.mnY; - mnZ -= rTup.mnZ; - return *this; + mnY -= rTup.mnY; + mnZ -= rTup.mnZ; + return *this; } - B3ITuple& operator/=( const B3ITuple& rTup ) - { + B3ITuple& operator/=( const B3ITuple& rTup ) + { mnX /= rTup.mnX; - mnY /= rTup.mnY; - mnZ /= rTup.mnZ; - return *this; + mnY /= rTup.mnY; + mnZ /= rTup.mnZ; + return *this; } - B3ITuple& operator*=( const B3ITuple& rTup ) - { + B3ITuple& operator*=( const B3ITuple& rTup ) + { mnX *= rTup.mnX; - mnY *= rTup.mnY; - mnZ *= rTup.mnZ; - return *this; + mnY *= rTup.mnY; + mnZ *= rTup.mnZ; + return *this; } - B3ITuple& operator*=(sal_Int32 t) - { - mnX *= t; - mnY *= t; - mnZ *= t; - return *this; + B3ITuple& operator*=(sal_Int32 t) + { + mnX *= t; + mnY *= t; + mnZ *= t; + return *this; } - B3ITuple& operator/=(sal_Int32 t) - { - mnX /= t; - mnY /= t; - mnZ /= t; - return *this; + B3ITuple& operator/=(sal_Int32 t) + { + mnX /= t; + mnY /= t; + mnZ /= t; + return *this; } - B3ITuple operator-(void) const - { - return B3ITuple(-mnX, -mnY, -mnZ); + B3ITuple operator-(void) const + { + return B3ITuple(-mnX, -mnY, -mnZ); } bool equalZero() const - { - return (this == &getEmptyTuple() || + { + return (this == &getEmptyTuple() || (mnX == 0 && mnY == 0 && mnZ == 0)); } - bool operator==( const B3ITuple& rTup ) const - { + bool operator==( const B3ITuple& rTup ) const + { return this == &rTup || (rTup.mnX == mnX && rTup.mnY == mnY && rTup.mnZ == mnZ); } - bool operator!=( const B3ITuple& rTup ) const - { + bool operator!=( const B3ITuple& rTup ) const + { return !(*this == rTup); } - - B3ITuple& operator=( const B3ITuple& rTup ) - { + + B3ITuple& operator=( const B3ITuple& rTup ) + { mnX = rTup.mnX; - mnY = rTup.mnY; - mnZ = rTup.mnZ; - return *this; + mnY = rTup.mnY; + mnZ = rTup.mnZ; + return *this; } static const B3ITuple& getEmptyTuple(); @@ -235,115 +235,115 @@ namespace basegfx // external operators ////////////////////////////////////////////////////////////////////////// - inline B3ITuple minimum(const B3ITuple& rTupA, const B3ITuple& rTupB) - { + inline B3ITuple minimum(const B3ITuple& rTupA, const B3ITuple& rTupB) + { B3ITuple aMin( (rTupB.getX() < rTupA.getX()) ? rTupB.getX() : rTupA.getX(), (rTupB.getY() < rTupA.getY()) ? rTupB.getY() : rTupA.getY(), - (rTupB.getZ() < rTupA.getZ()) ? rTupB.getZ() : rTupA.getZ()); + (rTupB.getZ() < rTupA.getZ()) ? rTupB.getZ() : rTupA.getZ()); return aMin; } - inline B3ITuple maximum(const B3ITuple& rTupA, const B3ITuple& rTupB) - { + inline B3ITuple maximum(const B3ITuple& rTupA, const B3ITuple& rTupB) + { B3ITuple aMax( (rTupB.getX() > rTupA.getX()) ? rTupB.getX() : rTupA.getX(), (rTupB.getY() > rTupA.getY()) ? rTupB.getY() : rTupA.getY(), - (rTupB.getZ() > rTupA.getZ()) ? rTupB.getZ() : rTupA.getZ()); + (rTupB.getZ() > rTupA.getZ()) ? rTupB.getZ() : rTupA.getZ()); return aMax; } - inline B3ITuple absolute(const B3ITuple& rTup) - { + inline B3ITuple absolute(const B3ITuple& rTup) + { B3ITuple aAbs( (0 > rTup.getX()) ? -rTup.getX() : rTup.getX(), (0 > rTup.getY()) ? -rTup.getY() : rTup.getY(), - (0 > rTup.getZ()) ? -rTup.getZ() : rTup.getZ()); + (0 > rTup.getZ()) ? -rTup.getZ() : rTup.getZ()); return aAbs; } - inline B3DTuple interpolate(const B3ITuple& rOld1, const B3ITuple& rOld2, double t) - { + inline B3DTuple interpolate(const B3ITuple& rOld1, const B3ITuple& rOld2, double t) + { B3DTuple aInt( ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(), ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY(), - ((rOld2.getZ() - rOld1.getZ()) * t) + rOld1.getZ()); + ((rOld2.getZ() - rOld1.getZ()) * t) + rOld1.getZ()); return aInt; } - inline B3DTuple average(const B3ITuple& rOld1, const B3ITuple& rOld2) - { + inline B3DTuple average(const B3ITuple& rOld1, const B3ITuple& rOld2) + { B3DTuple aAvg( (rOld1.getX() + rOld2.getX()) * 0.5, (rOld1.getY() + rOld2.getY()) * 0.5, - (rOld1.getZ() + rOld2.getZ()) * 0.5); + (rOld1.getZ() + rOld2.getZ()) * 0.5); return aAvg; } - + inline B3DTuple average(const B3ITuple& rOld1, const B3ITuple& rOld2, const B3ITuple& rOld3) - { + { B3DTuple aAvg( (rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0), (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0), - (rOld1.getZ() + rOld2.getZ() + rOld3.getZ()) * (1.0 / 3.0)); + (rOld1.getZ() + rOld2.getZ() + rOld3.getZ()) * (1.0 / 3.0)); return aAvg; } - + inline B3ITuple operator+(const B3ITuple& rTupA, const B3ITuple& rTupB) - { - B3ITuple aSum(rTupA); - aSum += rTupB; - return aSum; + { + B3ITuple aSum(rTupA); + aSum += rTupB; + return aSum; } inline B3ITuple operator-(const B3ITuple& rTupA, const B3ITuple& rTupB) - { - B3ITuple aSub(rTupA); - aSub -= rTupB; - return aSub; + { + B3ITuple aSub(rTupA); + aSub -= rTupB; + return aSub; } inline B3ITuple operator/(const B3ITuple& rTupA, const B3ITuple& rTupB) - { - B3ITuple aDiv(rTupA); - aDiv /= rTupB; - return aDiv; + { + B3ITuple aDiv(rTupA); + aDiv /= rTupB; + return aDiv; } inline B3ITuple operator*(const B3ITuple& rTupA, const B3ITuple& rTupB) - { - B3ITuple aMul(rTupA); - aMul *= rTupB; - return aMul; + { + B3ITuple aMul(rTupA); + aMul *= rTupB; + return aMul; } inline B3ITuple operator*(const B3ITuple& rTup, sal_Int32 t) - { - B3ITuple aNew(rTup); - aNew *= t; - return aNew; + { + B3ITuple aNew(rTup); + aNew *= t; + return aNew; } inline B3ITuple operator*(sal_Int32 t, const B3ITuple& rTup) - { - B3ITuple aNew(rTup); - aNew *= t; - return aNew; + { + B3ITuple aNew(rTup); + aNew *= t; + return aNew; } inline B3ITuple operator/(const B3ITuple& rTup, sal_Int32 t) - { - B3ITuple aNew(rTup); - aNew /= t; - return aNew; + { + B3ITuple aNew(rTup); + aNew /= t; + return aNew; } inline B3ITuple operator/(sal_Int32 t, const B3ITuple& rTup) { - B3ITuple aNew(t, t, t); - B3ITuple aTmp(rTup); - aNew /= aTmp; - return aNew; + B3ITuple aNew(t, t, t); + B3ITuple aTmp(rTup); + aNew /= aTmp; + return aNew; } } // end of namespace basegfx diff --git a/basegfx/inc/basegfx/vector/b2dsize.hxx b/basegfx/inc/basegfx/vector/b2dsize.hxx index 7af1d3b2ea84..4681a30405b8 100644 --- a/basegfx/inc/basegfx/vector/b2dsize.hxx +++ b/basegfx/inc/basegfx/vector/b2dsize.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 diff --git a/basegfx/inc/basegfx/vector/b2dvector.hxx b/basegfx/inc/basegfx/vector/b2dvector.hxx index b2efaa52f5f2..109145b556d6 100644 --- a/basegfx/inc/basegfx/vector/b2dvector.hxx +++ b/basegfx/inc/basegfx/vector/b2dvector.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 @@ -48,73 +48,73 @@ namespace basegfx */ class B2DVector : public ::basegfx::B2DTuple { - public: - /** Create a 2D Vector + public: + /** Create a 2D Vector The vector is initialized to (0.0, 0.0) */ - B2DVector() - : B2DTuple() + B2DVector() + : B2DTuple() {} - /** Create a 2D Vector + /** Create a 2D Vector @param fX This parameter is used to initialize the X-coordinate of the 2D Vector. - + @param fY This parameter is used to initialize the Y-coordinate of the 2D Vector. */ - B2DVector(double fX, double fY) - : B2DTuple(fX, fY) + B2DVector(double fX, double fY) + : B2DTuple(fX, fY) {} - /** Create a copy of a 2D Vector + /** Create a copy of a 2D Vector @param rVec The 2D Vector which will be copied. */ - B2DVector(const B2DVector& rVec) - : B2DTuple(rVec) + B2DVector(const B2DVector& rVec) + : B2DTuple(rVec) {} - /** Create a copy of a 2D Vector + /** Create a copy of a 2D Vector @param rVec The 2D Vector which will be copied. */ - B2DVector(const ::basegfx::B2IVector& rVec) - : B2DTuple(rVec) + B2DVector(const ::basegfx::B2IVector& rVec) + : B2DTuple(rVec) {} /** constructor with tuple to allow copy-constructing from B2DTuple-based classes */ - B2DVector(const ::basegfx::B2DTuple& rTuple) - : B2DTuple(rTuple) + B2DVector(const ::basegfx::B2DTuple& rTuple) + : B2DTuple(rTuple) {} - ~B2DVector() + ~B2DVector() {} /** *=operator to allow usage from B2DVector, too */ - B2DVector& operator*=( const B2DVector& rPnt ) - { + B2DVector& operator*=( const B2DVector& rPnt ) + { mfX *= rPnt.mfX; - mfY *= rPnt.mfY; - return *this; + mfY *= rPnt.mfY; + return *this; } /** *=operator to allow usage from B2DVector, too */ - B2DVector& operator*=(double t) - { - mfX *= t; - mfY *= t; - return *this; + B2DVector& operator*=(double t) + { + mfX *= t; + mfY *= t; + return *this; } /** assignment operator to allow assigning the results @@ -195,7 +195,7 @@ namespace basegfx static const B2DVector& getEmptyVector(); }; - + // external operators ////////////////////////////////////////////////////////////////////////// @@ -250,14 +250,14 @@ namespace basegfx bool areParallel( const B2DVector& rVecA, const B2DVector& rVecB ); /** Transform vector by given transformation matrix. - + Since this is a vector, translational components of the matrix are disregarded. */ B2DVector operator*( const B2DHomMatrix& rMat, const B2DVector& rVec ); /** Test continuity between given vectors. - + The two given vectors are assumed to describe control points on a common point. Calculate if there is a continuity between them. */ diff --git a/basegfx/inc/basegfx/vector/b2enums.hxx b/basegfx/inc/basegfx/vector/b2enums.hxx index f364c8e1d51d..7159d3594676 100644 --- a/basegfx/inc/basegfx/vector/b2enums.hxx +++ b/basegfx/inc/basegfx/vector/b2enums.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 @@ -33,43 +33,43 @@ namespace basegfx { - /** Descriptor for the mathematical orientations of two 2D Vectors + /** Descriptor for the mathematical orientations of two 2D Vectors */ enum B2VectorOrientation { /// mathematically positive oriented ORIENTATION_POSITIVE = 0, - + /// mathematically negative oriented ORIENTATION_NEGATIVE, - + /// mathematically neutral, thus parallel ORIENTATION_NEUTRAL }; - /** Descriptor for the mathematical continuity of two 2D Vectors + /** Descriptor for the mathematical continuity of two 2D Vectors */ enum B2VectorContinuity { /// none CONTINUITY_NONE = 0, - + /// mathematically negative oriented CONTINUITY_C1, - + /// mathematically neutral, thus parallel CONTINUITY_C2 }; - /** Descriptor for possible line joins between two line segments + /** Descriptor for possible line joins between two line segments */ enum B2DLineJoin { - B2DLINEJOIN_NONE, // no rounding - B2DLINEJOIN_MIDDLE, // calc middle value between joints - B2DLINEJOIN_BEVEL, // join edges with line - B2DLINEJOIN_MITER, // extend till cut - B2DLINEJOIN_ROUND // create arc + B2DLINEJOIN_NONE, // no rounding + B2DLINEJOIN_MIDDLE, // calc middle value between joints + B2DLINEJOIN_BEVEL, // join edges with line + B2DLINEJOIN_MITER, // extend till cut + B2DLINEJOIN_ROUND // create arc }; } // end of namespace basegfx diff --git a/basegfx/inc/basegfx/vector/b2isize.hxx b/basegfx/inc/basegfx/vector/b2isize.hxx index a1738548742f..e904513dde8a 100644 --- a/basegfx/inc/basegfx/vector/b2isize.hxx +++ b/basegfx/inc/basegfx/vector/b2isize.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 diff --git a/basegfx/inc/basegfx/vector/b2ivector.hxx b/basegfx/inc/basegfx/vector/b2ivector.hxx index 8327f9236d96..1b32569ec675 100644 --- a/basegfx/inc/basegfx/vector/b2ivector.hxx +++ b/basegfx/inc/basegfx/vector/b2ivector.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 @@ -47,64 +47,64 @@ namespace basegfx */ class B2IVector : public ::basegfx::B2ITuple { - public: - /** Create a 2D Vector + public: + /** Create a 2D Vector The vector is initialized to (0, 0) */ - B2IVector() - : B2ITuple() + B2IVector() + : B2ITuple() {} - /** Create a 2D Vector + /** Create a 2D Vector @param nX This parameter is used to initialize the X-coordinate of the 2D Vector. - + @param nY This parameter is used to initialize the Y-coordinate of the 2D Vector. */ - B2IVector(sal_Int32 nX, sal_Int32 nY) - : B2ITuple(nX, nY) + B2IVector(sal_Int32 nX, sal_Int32 nY) + : B2ITuple(nX, nY) {} - /** Create a copy of a 2D Vector + /** Create a copy of a 2D Vector @param rVec The 2D Vector which will be copied. */ - B2IVector(const B2IVector& rVec) - : B2ITuple(rVec) + B2IVector(const B2IVector& rVec) + : B2ITuple(rVec) {} /** constructor with tuple to allow copy-constructing from B2ITuple-based classes */ - B2IVector(const ::basegfx::B2ITuple& rTuple) - : B2ITuple(rTuple) + B2IVector(const ::basegfx::B2ITuple& rTuple) + : B2ITuple(rTuple) {} - ~B2IVector() + ~B2IVector() {} /** *=operator to allow usage from B2IVector, too */ - B2IVector& operator*=( const B2IVector& rPnt ) - { + B2IVector& operator*=( const B2IVector& rPnt ) + { mnX *= rPnt.mnX; - mnY *= rPnt.mnY; - return *this; + mnY *= rPnt.mnY; + return *this; } /** *=operator to allow usage from B2IVector, too */ - B2IVector& operator*=(sal_Int32 t) - { - mnX *= t; - mnY *= t; - return *this; + B2IVector& operator*=(sal_Int32 t) + { + mnX *= t; + mnY *= t; + return *this; } /** assignment operator to allow assigning the results @@ -171,7 +171,7 @@ namespace basegfx static const B2IVector& getEmptyVector(); }; - + // external operators ////////////////////////////////////////////////////////////////////////// @@ -213,14 +213,14 @@ namespace basegfx bool areParallel( const B2IVector& rVecA, const B2IVector& rVecB ); /** Transform vector by given transformation matrix. - + Since this is a vector, translational components of the matrix are disregarded. */ B2IVector operator*( const B2DHomMatrix& rMat, const B2IVector& rVec ); /** Test continuity between given vectors. - + The two given vectors are assumed to describe control points on a common point. Calculate if there is a continuity between them. */ diff --git a/basegfx/inc/basegfx/vector/b3dsize.hxx b/basegfx/inc/basegfx/vector/b3dsize.hxx index 757314cadcf1..ab1fa4d5a4f4 100644 --- a/basegfx/inc/basegfx/vector/b3dsize.hxx +++ b/basegfx/inc/basegfx/vector/b3dsize.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 diff --git a/basegfx/inc/basegfx/vector/b3dvector.hxx b/basegfx/inc/basegfx/vector/b3dvector.hxx index 17c61b0437e2..9942e19569a8 100644 --- a/basegfx/inc/basegfx/vector/b3dvector.hxx +++ b/basegfx/inc/basegfx/vector/b3dvector.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 @@ -49,80 +49,80 @@ namespace basegfx class B3DVector : public ::basegfx::B3DTuple { public: - /** Create a 3D Vector + /** Create a 3D Vector The vector is initialized to (0.0, 0.0, 0.0) */ B3DVector() - : B3DTuple() + : B3DTuple() {} - /** Create a 3D Vector + /** Create a 3D Vector @param fX This parameter is used to initialize the X-coordinate of the 3D Vector. - + @param fY This parameter is used to initialize the Y-coordinate of the 3D Vector. - + @param fZ This parameter is used to initialize the Z-coordinate of the 3D Vector. */ B3DVector(double fX, double fY, double fZ) - : B3DTuple(fX, fY, fZ) + : B3DTuple(fX, fY, fZ) {} - /** Create a copy of a 3D Vector + /** Create a copy of a 3D Vector @param rVec The 3D Vector which will be copied. */ - B3DVector(const B3DVector& rVec) - : B3DTuple(rVec) + B3DVector(const B3DVector& rVec) + : B3DTuple(rVec) {} /** constructor with tuple to allow copy-constructing from B3DTuple-based classes */ - B3DVector(const ::basegfx::B3DTuple& rTuple) - : B3DTuple(rTuple) + B3DVector(const ::basegfx::B3DTuple& rTuple) + : B3DTuple(rTuple) {} - ~B3DVector() + ~B3DVector() {} /** *=operator to allow usage from B3DVector, too */ - B3DVector& operator*=( const B3DVector& rPnt ) - { + B3DVector& operator*=( const B3DVector& rPnt ) + { mfX *= rPnt.mfX; - mfY *= rPnt.mfY; - mfZ *= rPnt.mfZ; - return *this; + mfY *= rPnt.mfY; + mfZ *= rPnt.mfZ; + return *this; } /** *=operator to allow usage from B3DVector, too */ - B3DVector& operator*=(double t) - { - mfX *= t; - mfY *= t; - mfZ *= t; - return *this; + B3DVector& operator*=(double t) + { + mfX *= t; + mfY *= t; + mfZ *= t; + return *this; } /** assignment operator to allow assigning the results of B3DTuple calculations */ - B3DVector& operator=( const ::basegfx::B3DTuple& rVec ) - { + B3DVector& operator=( const ::basegfx::B3DTuple& rVec ) + { mfX = rVec.getX(); - mfY = rVec.getY(); - mfZ = rVec.getZ(); - return *this; + mfY = rVec.getY(); + mfZ = rVec.getZ(); + return *this; } /** Calculate the length of this 3D Vector @@ -309,7 +309,7 @@ namespace basegfx bool areParallel( const B3DVector& rVecA, const B3DVector& rVecB ); /** Transform vector by given transformation matrix. - + Since this is a vector, translational components of the matrix are disregarded. */ diff --git a/basegfx/inc/basegfx/vector/b3isize.hxx b/basegfx/inc/basegfx/vector/b3isize.hxx index 5aa85d904751..f22a46a11a5e 100644 --- a/basegfx/inc/basegfx/vector/b3isize.hxx +++ b/basegfx/inc/basegfx/vector/b3isize.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 diff --git a/basegfx/inc/basegfx/vector/b3ivector.hxx b/basegfx/inc/basegfx/vector/b3ivector.hxx index 5cbd869cad5f..23ebc6bcca4a 100644 --- a/basegfx/inc/basegfx/vector/b3ivector.hxx +++ b/basegfx/inc/basegfx/vector/b3ivector.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 @@ -47,80 +47,80 @@ namespace basegfx class B3IVector : public ::basegfx::B3ITuple { public: - /** Create a 3D Vector + /** Create a 3D Vector The vector is initialized to (0, 0, 0) */ B3IVector() - : B3ITuple() + : B3ITuple() {} - /** Create a 3D Vector + /** Create a 3D Vector @param nX This parameter is used to initialize the X-coordinate of the 3D Vector. - + @param nY This parameter is used to initialize the Y-coordinate of the 3D Vector. - + @param nZ This parameter is used to initialize the Z-coordinate of the 3D Vector. */ B3IVector(sal_Int32 nX, sal_Int32 nY, sal_Int32 nZ) - : B3ITuple(nX, nY, nZ) + : B3ITuple(nX, nY, nZ) {} - /** Create a copy of a 3D Vector + /** Create a copy of a 3D Vector @param rVec The 3D Vector which will be copied. */ - B3IVector(const B3IVector& rVec) - : B3ITuple(rVec) + B3IVector(const B3IVector& rVec) + : B3ITuple(rVec) {} /** constructor with tuple to allow copy-constructing from B3ITuple-based classes */ - B3IVector(const ::basegfx::B3ITuple& rTuple) - : B3ITuple(rTuple) + B3IVector(const ::basegfx::B3ITuple& rTuple) + : B3ITuple(rTuple) {} - ~B3IVector() + ~B3IVector() {} /** *=operator to allow usage from B3IVector, too */ - B3IVector& operator*=( const B3IVector& rPnt ) - { + B3IVector& operator*=( const B3IVector& rPnt ) + { mnX *= rPnt.mnX; - mnY *= rPnt.mnY; - mnZ *= rPnt.mnZ; - return *this; + mnY *= rPnt.mnY; + mnZ *= rPnt.mnZ; + return *this; } /** *=operator to allow usage from B3IVector, too */ - B3IVector& operator*=(sal_Int32 t) - { - mnX *= t; - mnY *= t; - mnZ *= t; - return *this; + B3IVector& operator*=(sal_Int32 t) + { + mnX *= t; + mnY *= t; + mnZ *= t; + return *this; } /** assignment operator to allow assigning the results of B3ITuple calculations */ - B3IVector& operator=( const ::basegfx::B3ITuple& rVec ) - { + B3IVector& operator=( const ::basegfx::B3ITuple& rVec ) + { mnX = rVec.getX(); - mnY = rVec.getY(); - mnZ = rVec.getZ(); - return *this; + mnY = rVec.getY(); + mnZ = rVec.getZ(); + return *this; } /** Calculate the length of this 3D Vector @@ -230,7 +230,7 @@ namespace basegfx ////////////////////////////////////////////////////////////////////////// /** Transform vector by given transformation matrix. - + Since this is a vector, translational components of the matrix are disregarded. */ diff --git a/basegfx/inc/pch/precompiled_basegfx.cxx b/basegfx/inc/pch/precompiled_basegfx.cxx index b71fb5b8c6f6..849d5eefa9b5 100644 --- a/basegfx/inc/pch/precompiled_basegfx.cxx +++ b/basegfx/inc/pch/precompiled_basegfx.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/inc/pch/precompiled_basegfx.hxx b/basegfx/inc/pch/precompiled_basegfx.hxx index f1c1f59f06f5..72f6f137b85e 100644 --- a/basegfx/inc/pch/precompiled_basegfx.hxx +++ b/basegfx/inc/pch/precompiled_basegfx.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 diff --git a/basegfx/qa/mkpolygons.pl b/basegfx/qa/mkpolygons.pl index b465a4f845ab..8d00fa936fa3 100644 --- a/basegfx/qa/mkpolygons.pl +++ b/basegfx/qa/mkpolygons.pl @@ -1,6 +1,6 @@ : eval 'exec perl -wS $0 ${1+"$@"}' - if 0; + if 0; # # 2009 Copyright Novell, Inc. & Sun Microsystems, Inc. @@ -10,8 +10,8 @@ eval 'exec perl -wS $0 ${1+"$@"}' # only, as published by the Free Software Foundation. # -use IO::File; -use Cwd; +use IO::File; +use Cwd; use File::Spec; use File::Spec::Functions; use File::Temp; @@ -25,72 +25,72 @@ $TempDir = ""; ############################################################################### -# Open a file with the given name. -# First it is checked if the temporary directory, in which all files for -# the document are gathered, is already present and create it if it is not. -# Then create the path to the file inside the temporary directory. -# Finally open the file and return a file handle to it. +# Open a file with the given name. +# First it is checked if the temporary directory, in which all files for +# the document are gathered, is already present and create it if it is not. +# Then create the path to the file inside the temporary directory. +# Finally open the file and return a file handle to it. # -sub open_file +sub open_file { - my $filename = pop @_; - - # Create base directory of temporary directory tree if not alreay - # present. + my $filename = pop @_; + + # Create base directory of temporary directory tree if not alreay + # present. if ($TempDir eq "") { $TempDir = File::Temp::tempdir (CLEANUP => 1); } - - # Create the path to the file. + + # Create the path to the file. my $fullname = File::Spec->catfile ($TempDir, $filename); my ($volume,$directories,$file) = File::Spec->splitpath ($fullname); mkpath (File::Spec->catpath ($volume,$directories,"")); - - # Open the file and return a file handle to it. + + # Open the file and return a file handle to it. return new IO::File ($fullname, "w"); } ############################################################################### -# Zip the files in the directory tree into the given file. +# Zip the files in the directory tree into the given file. # -sub zip_dirtree +sub zip_dirtree { - my $filename = pop @_; - - my $cwd = getcwd; - my $zip_name = $filename; - - # We are about to change the directory. - # Therefore create an absolute pathname for the zip archive. - - # First transfer the drive from $cwd to $zip_name. This is a - # workaround for a bug in file_name_is_absolute which thinks - # the the path \bla is an absolute path under DOS. + my $filename = pop @_; + + my $cwd = getcwd; + my $zip_name = $filename; + + # We are about to change the directory. + # Therefore create an absolute pathname for the zip archive. + + # First transfer the drive from $cwd to $zip_name. This is a + # workaround for a bug in file_name_is_absolute which thinks + # the the path \bla is an absolute path under DOS. my ($volume,$directories,$file) = File::Spec->splitpath ($zip_name); my ($volume_cwd,$directories_cwd,$file_cwd) = File::Spec->splitpath ($cwd); $volume = $volume_cwd if ($volume eq ""); $zip_name = File::Spec->catpath ($volume,$directories,$file); - - # Add the current working directory to a relative path. + + # Add the current working directory to a relative path. if ( ! file_name_is_absolute ($zip_name)) { $zip_name = File::Spec->catfile ($cwd, $zip_name); - - # Try everything to clean up the name. + + # Try everything to clean up the name. $zip_name = File::Spec->rel2abs ($filename); $zip_name = File::Spec->canonpath ($zip_name); - - # Remove .. directories from the middle of the path. + + # Remove .. directories from the middle of the path. while ($zip_name =~ /\/[^\/][^\.\/][^\/]*\/\.\.\//) { $zip_name = $` . "/" . $'; } } - # Just in case the zip program gets confused by an existing file with the - # same name as the one to be written that file is removed first. + # Just in case the zip program gets confused by an existing file with the + # same name as the one to be written that file is removed first. if ( -e $filename) { if (unlink ($filename) == 0) @@ -100,9 +100,9 @@ sub zip_dirtree return; } } - - # Finally create the zip file. First change into the temporary directory - # so that the resulting zip file contains only paths relative to it. + + # Finally create the zip file. First change into the temporary directory + # so that the resulting zip file contains only paths relative to it. print "zipping [$ZipCmd $ZipFlags $zip_name *]\n"; chdir ($TempDir); system ("$ZipCmd $ZipFlags $zip_name *"); @@ -249,9 +249,9 @@ sub writeManifest ############################################################################### -# Print usage information. +# Print usage information. # -sub usage () +sub usage () { print <<END_OF_USAGE; usage: $0 <option>* [<SvgD-values>] @@ -264,9 +264,9 @@ END_OF_USAGE } ############################################################################### -# Process the command line. +# Process the command line. # -sub process_command_line +sub process_command_line { foreach (@ARGV) { @@ -276,9 +276,9 @@ sub process_command_line exit 0; } } - + $global_output_name = "polygons.odp"; - my $j = 0, $noMoreOptions = 0; + my $j = 0, $noMoreOptions = 0; for (my $i=0; $i<$#ARGV; $i++) { if ( !$noMoreOptions and $ARGV[$i] eq "-o") @@ -307,12 +307,12 @@ sub process_command_line } ############################################################################### -# Main +# Main ############################################################################### $ZipCmd = $ENV{LOG_FILE_ZIP_CMD}; $ZipFlags = $ENV{LOG_FILE_ZIP_FLAGS}; -# Provide default values for the zip command and it's flags. +# Provide default values for the zip command and it's flags. if ( ! defined $ZipCmd) { $ZipCmd = "zip" unless defined $ZipCmd; 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); diff --git a/basegfx/test/basegfx1d.cxx b/basegfx/test/basegfx1d.cxx index 40ebba3810fe..f7bf8df310f2 100644 --- a/basegfx/test/basegfx1d.cxx +++ b/basegfx/test/basegfx1d.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/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx index c06843c04115..93c8392e7619 100644 --- a/basegfx/test/basegfx2d.cxx +++ b/basegfx/test/basegfx2d.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 @@ -151,7 +151,7 @@ public: void impex() { - B2DPolyPolygon aPoly; + B2DPolyPolygon aPoly; ::rtl::OUString aExport; CPPUNIT_ASSERT_MESSAGE("importing simple rectangle from SVG-D", @@ -297,23 +297,23 @@ public: B2DPolyRange aRange; aRange.appendElement(B2DRange(0,0,1,1),ORIENTATION_POSITIVE); aRange.appendElement(B2DRange(2,2,3,3),ORIENTATION_POSITIVE); - - CPPUNIT_ASSERT_MESSAGE("simple poly range - count", + + CPPUNIT_ASSERT_MESSAGE("simple poly range - count", aRange.count() == 2); - CPPUNIT_ASSERT_MESSAGE("simple poly range - first element", + CPPUNIT_ASSERT_MESSAGE("simple poly range - first element", aRange.getElement(0).head == B2DRange(0,0,1,1)); - CPPUNIT_ASSERT_MESSAGE("simple poly range - second element", + CPPUNIT_ASSERT_MESSAGE("simple poly range - second element", aRange.getElement(1).head == B2DRange(2,2,3,3)); // B2DPolyRange relies on correctly orientated rects const B2DRange aRect(0,0,1,1); - CPPUNIT_ASSERT_MESSAGE("createPolygonFromRect - correct orientation", + CPPUNIT_ASSERT_MESSAGE("createPolygonFromRect - correct orientation", tools::getOrientation( tools::createPolygonFromRect(aRect)) == ORIENTATION_POSITIVE ); } - // Change the following lines only, if you add, remove or rename - // member functions of the current class, + // Change the following lines only, if you add, remove or rename + // member functions of the current class, // because these macros are need by auto register mechanism. CPPUNIT_TEST_SUITE(b2dpolyrange); @@ -324,15 +324,15 @@ public: class b2dbeziertools : public CppUnit::TestFixture { private: - B2DCubicBezier aHalfCircle; // not exactly, but a look-alike - B2DCubicBezier aQuarterCircle; // not exactly, but a look-alike - B2DCubicBezier aLoop; // identical endpoints, curve goes back to where it started - B2DCubicBezier aStraightLineDistinctEndPoints; // truly a line - B2DCubicBezier aStraightLineDistinctEndPoints2; // truly a line, with slightly different control points - B2DCubicBezier aStraightLineIdenticalEndPoints; // degenerate case of aLoop + B2DCubicBezier aHalfCircle; // not exactly, but a look-alike + B2DCubicBezier aQuarterCircle; // not exactly, but a look-alike + B2DCubicBezier aLoop; // identical endpoints, curve goes back to where it started + B2DCubicBezier aStraightLineDistinctEndPoints; // truly a line + B2DCubicBezier aStraightLineDistinctEndPoints2; // truly a line, with slightly different control points + B2DCubicBezier aStraightLineIdenticalEndPoints; // degenerate case of aLoop B2DCubicBezier aStraightLineIdenticalEndPoints2;// degenerate case of aLoop, with slightly different control points - B2DCubicBezier aCrossing; // curve self-intersects somewhere in the middle - B2DCubicBezier aCusp; // curve has a point of undefined tangency + B2DCubicBezier aCrossing; // curve self-intersects somewhere in the middle + B2DCubicBezier aCusp; // curve has a point of undefined tangency public: @@ -347,16 +347,16 @@ public: const B2DPoint quarterDown( 0.25, 0.25 ); const B2DPoint quarterUp( 0.75, 0.75 ); - aHalfCircle = B2DCubicBezier(a00, a01, a11, a10); + aHalfCircle = B2DCubicBezier(a00, a01, a11, a10); // The spline control points become // - // (R * cos(A), R * sin(A)) - // (R * cos(A) - h * sin(A), R * sin(A) + h * cos (A)) - // (R * cos(B) + h * sin(B), R * sin(B) - h * cos (B)) - // (R * cos(B), R * sin(B)) + // (R * cos(A), R * sin(A)) + // (R * cos(A) - h * sin(A), R * sin(A) + h * cos (A)) + // (R * cos(B) + h * sin(B), R * sin(B) - h * cos (B)) + // (R * cos(B), R * sin(B)) // - // where h = 4/3 * R * tan ((B-A)/4) + // where h = 4/3 * R * tan ((B-A)/4) // // with R being the radius, A start angle and B end angle (A < B). // @@ -365,17 +365,17 @@ public: // Choosing R=1, A=0, B=pi/2 const double h( 4.0/3.0 * tan(M_PI/8.0) ); - aQuarterCircle = B2DCubicBezier(a10 + B2DPoint(1.0,0.0), + aQuarterCircle = B2DCubicBezier(a10 + B2DPoint(1.0,0.0), B2DPoint(B2DPoint( 1.0, h ) + B2DPoint(1.0,0.0)), B2DPoint(B2DPoint( h, 1.0) + B2DPoint(1.0,0.0)), a01 + B2DPoint(1.0,0.0)); - aCusp = B2DCubicBezier(a00 + B2DPoint(2.0,0.0), + aCusp = B2DCubicBezier(a00 + B2DPoint(2.0,0.0), B2DPoint(a11 + B2DPoint(2.0,0.0)), B2DPoint(a01 + B2DPoint(2.0,0.0)), a10 + B2DPoint(2.0,0.0)); - aLoop = B2DCubicBezier(a00 + B2DPoint(3.0,0.0), + aLoop = B2DCubicBezier(a00 + B2DPoint(3.0,0.0), B2DPoint(a01 + B2DPoint(3.0,0.0)), B2DPoint(a10 + B2DPoint(3.0,0.0)), a00 + B2DPoint(3.0,0.0)); @@ -400,7 +400,7 @@ public: B2DPoint(quarterUp + B2DPoint(7.0,0.0)), a00 + B2DPoint(7.0,0.0)); - aCrossing = B2DCubicBezier(a00 + B2DPoint(8.0,0.0), + aCrossing = B2DCubicBezier(a00 + B2DPoint(8.0,0.0), B2DPoint(B2DPoint(2.0,2.0) + B2DPoint(8.0,0.0)), B2DPoint(B2DPoint(-1.0,2.0) + B2DPoint(8.0,0.0)), a10 + B2DPoint(8.0,0.0)); @@ -546,7 +546,7 @@ public: // because these macros are need by auto register mechanism. CPPUNIT_TEST_SUITE(b2dbeziertools); - CPPUNIT_TEST(adaptiveByDistance); // TODO: add tests for quadratic bezier (subdivide and degree reduction) + CPPUNIT_TEST(adaptiveByDistance); // TODO: add tests for quadratic bezier (subdivide and degree reduction) CPPUNIT_TEST(adaptiveByAngle); CPPUNIT_TEST_SUITE_END(); }; // class b2dcubicbezier @@ -584,12 +584,12 @@ public: class b2dhommatrix : public CppUnit::TestFixture { private: - B2DHomMatrix maIdentity; - B2DHomMatrix maScale; - B2DHomMatrix maTranslate; - B2DHomMatrix maShear; - B2DHomMatrix maAffine; - B2DHomMatrix maPerspective; + B2DHomMatrix maIdentity; + B2DHomMatrix maScale; + B2DHomMatrix maTranslate; + B2DHomMatrix maShear; + B2DHomMatrix maAffine; + B2DHomMatrix maPerspective; public: // initialise your test code values here. @@ -642,12 +642,12 @@ public: void equal() { - B2DHomMatrix aIdentity; - B2DHomMatrix aScale; - B2DHomMatrix aTranslate; - B2DHomMatrix aShear; - B2DHomMatrix aAffine; - B2DHomMatrix aPerspective; + B2DHomMatrix aIdentity; + B2DHomMatrix aScale; + B2DHomMatrix aTranslate; + B2DHomMatrix aShear; + B2DHomMatrix aAffine; + B2DHomMatrix aPerspective; // setup some test matrices aIdentity.identity(); // force compact layout @@ -1099,7 +1099,7 @@ public: aNonRect5.setControlPoints(1,B2DPoint(1,0),B2DPoint(-11,0)); aNonRect5.setClosed(true); - CPPUNIT_ASSERT_MESSAGE("checking rectangle-ness of rectangle 1", + CPPUNIT_ASSERT_MESSAGE("checking rectangle-ness of rectangle 1", tools::isRectangle( aRect1 )); CPPUNIT_ASSERT_MESSAGE("checking rectangle-ness of rectangle 2", tools::isRectangle( aRect2 )); @@ -1111,7 +1111,7 @@ public: !tools::isRectangle( aNonRect3 )); CPPUNIT_ASSERT_MESSAGE("checking non-rectangle-ness of polygon 4", !tools::isRectangle( aNonRect4 )); - CPPUNIT_ASSERT_MESSAGE("checking non-rectangle-ness of polygon 5", + CPPUNIT_ASSERT_MESSAGE("checking non-rectangle-ness of polygon 5", !tools::isRectangle( aNonRect5 )); } @@ -1299,118 +1299,118 @@ public: // insert your test code here. void hslTest() { - CPPUNIT_ASSERT_MESSAGE("white", + CPPUNIT_ASSERT_MESSAGE("white", tools::rgb2hsl(maWhite) == BColor(0,0,1)); - CPPUNIT_ASSERT_MESSAGE("black", + CPPUNIT_ASSERT_MESSAGE("black", tools::rgb2hsl(maBlack) == BColor(0,0,0)); - CPPUNIT_ASSERT_MESSAGE("red", + CPPUNIT_ASSERT_MESSAGE("red", tools::rgb2hsl(maRed) == BColor(0,1,0.5)); - CPPUNIT_ASSERT_MESSAGE("green", + CPPUNIT_ASSERT_MESSAGE("green", tools::rgb2hsl(maGreen) == BColor(120,1,0.5)); - CPPUNIT_ASSERT_MESSAGE("blue", + CPPUNIT_ASSERT_MESSAGE("blue", tools::rgb2hsl(maBlue) == BColor(240,1,0.5)); - CPPUNIT_ASSERT_MESSAGE("yellow", + CPPUNIT_ASSERT_MESSAGE("yellow", tools::rgb2hsl(maYellow) == BColor(60,1,0.5)); - CPPUNIT_ASSERT_MESSAGE("magenta", + CPPUNIT_ASSERT_MESSAGE("magenta", tools::rgb2hsl(maMagenta) == BColor(300,1,0.5)); - CPPUNIT_ASSERT_MESSAGE("cyan", + CPPUNIT_ASSERT_MESSAGE("cyan", tools::rgb2hsl(maCyan) == BColor(180,1,0.5)); - CPPUNIT_ASSERT_MESSAGE("third hue case", + CPPUNIT_ASSERT_MESSAGE("third hue case", tools::rgb2hsl(BColor(0,0.5,1)) == BColor(210,1,0.5)); - CPPUNIT_ASSERT_MESSAGE("roundtrip white", + CPPUNIT_ASSERT_MESSAGE("roundtrip white", tools::hsl2rgb(tools::rgb2hsl(maWhite)) == maWhite); - CPPUNIT_ASSERT_MESSAGE("roundtrip black", + CPPUNIT_ASSERT_MESSAGE("roundtrip black", tools::hsl2rgb(tools::rgb2hsl(maBlack)) == maBlack); - CPPUNIT_ASSERT_MESSAGE("roundtrip red", + CPPUNIT_ASSERT_MESSAGE("roundtrip red", tools::hsl2rgb(tools::rgb2hsl(maRed)) == maRed); - CPPUNIT_ASSERT_MESSAGE("roundtrip green", + CPPUNIT_ASSERT_MESSAGE("roundtrip green", tools::hsl2rgb(tools::rgb2hsl(maGreen)) == maGreen); - CPPUNIT_ASSERT_MESSAGE("roundtrip blue", + CPPUNIT_ASSERT_MESSAGE("roundtrip blue", tools::hsl2rgb(tools::rgb2hsl(maBlue)) == maBlue); - CPPUNIT_ASSERT_MESSAGE("roundtrip yellow", + CPPUNIT_ASSERT_MESSAGE("roundtrip yellow", tools::hsl2rgb(tools::rgb2hsl(maYellow)) == maYellow); - CPPUNIT_ASSERT_MESSAGE("roundtrip magenta", + CPPUNIT_ASSERT_MESSAGE("roundtrip magenta", tools::hsl2rgb(tools::rgb2hsl(maMagenta)) == maMagenta); - CPPUNIT_ASSERT_MESSAGE("roundtrip cyan", + CPPUNIT_ASSERT_MESSAGE("roundtrip cyan", tools::hsl2rgb(tools::rgb2hsl(maCyan)) == maCyan); - CPPUNIT_ASSERT_MESSAGE("grey10", + CPPUNIT_ASSERT_MESSAGE("grey10", tools::rgb2hsl(maWhite*.1) == BColor(0,0,.1)); - CPPUNIT_ASSERT_MESSAGE("grey90", + CPPUNIT_ASSERT_MESSAGE("grey90", tools::rgb2hsl(maWhite*.9) == BColor(0,0,.9)); - CPPUNIT_ASSERT_MESSAGE("red/2", + CPPUNIT_ASSERT_MESSAGE("red/2", tools::rgb2hsl(maRed*.5) == BColor(0,1,0.25)); - CPPUNIT_ASSERT_MESSAGE("green/2", + CPPUNIT_ASSERT_MESSAGE("green/2", tools::rgb2hsl(maGreen*.5) == BColor(120,1,0.25)); - CPPUNIT_ASSERT_MESSAGE("blue/2", + CPPUNIT_ASSERT_MESSAGE("blue/2", tools::rgb2hsl(maBlue*.5) == BColor(240,1,0.25)); - CPPUNIT_ASSERT_MESSAGE("yellow/2", + CPPUNIT_ASSERT_MESSAGE("yellow/2", tools::rgb2hsl(maYellow*.5) == BColor(60,1,0.25)); - CPPUNIT_ASSERT_MESSAGE("magenta/2", + CPPUNIT_ASSERT_MESSAGE("magenta/2", tools::rgb2hsl(maMagenta*.5) == BColor(300,1,0.25)); - CPPUNIT_ASSERT_MESSAGE("cyan/2", + CPPUNIT_ASSERT_MESSAGE("cyan/2", tools::rgb2hsl(maCyan*.5) == BColor(180,1,0.25)); - CPPUNIT_ASSERT_MESSAGE("pastel", + CPPUNIT_ASSERT_MESSAGE("pastel", tools::rgb2hsl(BColor(.75,.25,.25)) == BColor(0,.5,.5)); } // insert your test code here. void hsvTest() { - CPPUNIT_ASSERT_MESSAGE("white", + CPPUNIT_ASSERT_MESSAGE("white", tools::rgb2hsv(maWhite) == BColor(0,0,1)); - CPPUNIT_ASSERT_MESSAGE("black", + CPPUNIT_ASSERT_MESSAGE("black", tools::rgb2hsv(maBlack) == BColor(0,0,0)); - CPPUNIT_ASSERT_MESSAGE("red", + CPPUNIT_ASSERT_MESSAGE("red", tools::rgb2hsv(maRed) == BColor(0,1,1)); - CPPUNIT_ASSERT_MESSAGE("green", + CPPUNIT_ASSERT_MESSAGE("green", tools::rgb2hsv(maGreen) == BColor(120,1,1)); - CPPUNIT_ASSERT_MESSAGE("blue", + CPPUNIT_ASSERT_MESSAGE("blue", tools::rgb2hsv(maBlue) == BColor(240,1,1)); - CPPUNIT_ASSERT_MESSAGE("yellow", + CPPUNIT_ASSERT_MESSAGE("yellow", tools::rgb2hsv(maYellow) == BColor(60,1,1)); - CPPUNIT_ASSERT_MESSAGE("magenta", + CPPUNIT_ASSERT_MESSAGE("magenta", tools::rgb2hsv(maMagenta) == BColor(300,1,1)); - CPPUNIT_ASSERT_MESSAGE("cyan", + CPPUNIT_ASSERT_MESSAGE("cyan", tools::rgb2hsv(maCyan) == BColor(180,1,1)); - CPPUNIT_ASSERT_MESSAGE("roundtrip white", + CPPUNIT_ASSERT_MESSAGE("roundtrip white", tools::hsv2rgb(tools::rgb2hsv(maWhite)) == maWhite); - CPPUNIT_ASSERT_MESSAGE("roundtrip black", + CPPUNIT_ASSERT_MESSAGE("roundtrip black", tools::hsv2rgb(tools::rgb2hsv(maBlack)) == maBlack); - CPPUNIT_ASSERT_MESSAGE("roundtrip red", + CPPUNIT_ASSERT_MESSAGE("roundtrip red", tools::hsv2rgb(tools::rgb2hsv(maRed)) == maRed); - CPPUNIT_ASSERT_MESSAGE("roundtrip green", + CPPUNIT_ASSERT_MESSAGE("roundtrip green", tools::hsv2rgb(tools::rgb2hsv(maGreen)) == maGreen); - CPPUNIT_ASSERT_MESSAGE("roundtrip blue", + CPPUNIT_ASSERT_MESSAGE("roundtrip blue", tools::hsv2rgb(tools::rgb2hsv(maBlue)) == maBlue); - CPPUNIT_ASSERT_MESSAGE("roundtrip yellow", + CPPUNIT_ASSERT_MESSAGE("roundtrip yellow", tools::hsv2rgb(tools::rgb2hsv(maYellow)) == maYellow); - CPPUNIT_ASSERT_MESSAGE("roundtrip magenta", + CPPUNIT_ASSERT_MESSAGE("roundtrip magenta", tools::hsv2rgb(tools::rgb2hsv(maMagenta)) == maMagenta); - CPPUNIT_ASSERT_MESSAGE("roundtrip cyan", + CPPUNIT_ASSERT_MESSAGE("roundtrip cyan", tools::hsv2rgb(tools::rgb2hsv(maCyan)) == maCyan); - CPPUNIT_ASSERT_MESSAGE("grey10", + CPPUNIT_ASSERT_MESSAGE("grey10", tools::rgb2hsv(maWhite*.1) == BColor(0,0,.1)); - CPPUNIT_ASSERT_MESSAGE("grey90", + CPPUNIT_ASSERT_MESSAGE("grey90", tools::rgb2hsv(maWhite*.9) == BColor(0,0,.9)); - CPPUNIT_ASSERT_MESSAGE("red/2", + CPPUNIT_ASSERT_MESSAGE("red/2", tools::rgb2hsv(maRed*.5) == BColor(0,1,0.5)); - CPPUNIT_ASSERT_MESSAGE("green/2", + CPPUNIT_ASSERT_MESSAGE("green/2", tools::rgb2hsv(maGreen*.5) == BColor(120,1,0.5)); - CPPUNIT_ASSERT_MESSAGE("blue/2", + CPPUNIT_ASSERT_MESSAGE("blue/2", tools::rgb2hsv(maBlue*.5) == BColor(240,1,0.5)); - CPPUNIT_ASSERT_MESSAGE("yellow/2", + CPPUNIT_ASSERT_MESSAGE("yellow/2", tools::rgb2hsv(maYellow*.5) == BColor(60,1,0.5)); - CPPUNIT_ASSERT_MESSAGE("magenta/2", + CPPUNIT_ASSERT_MESSAGE("magenta/2", tools::rgb2hsv(maMagenta*.5) == BColor(300,1,0.5)); - CPPUNIT_ASSERT_MESSAGE("cyan/2", + CPPUNIT_ASSERT_MESSAGE("cyan/2", tools::rgb2hsv(maCyan*.5) == BColor(180,1,0.5)); - CPPUNIT_ASSERT_MESSAGE("pastel", + CPPUNIT_ASSERT_MESSAGE("pastel", tools::rgb2hsv(BColor(.5,.25,.25)) == BColor(0,.5,.5)); } @@ -1426,8 +1426,8 @@ public: tools::rgb2ciexyz(maCyan); } - // Change the following lines only, if you add, remove or rename - // member functions of the current class, + // Change the following lines only, if you add, remove or rename + // member functions of the current class, // because these macros are need by auto register mechanism. CPPUNIT_TEST_SUITE(bcolor); diff --git a/basegfx/test/basegfx3d.cxx b/basegfx/test/basegfx3d.cxx index 1233b8cd255f..ae962434a484 100644 --- a/basegfx/test/basegfx3d.cxx +++ b/basegfx/test/basegfx3d.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/test/basegfxtools.cxx b/basegfx/test/basegfxtools.cxx index 4811369a9e9c..49f53756c785 100644 --- a/basegfx/test/basegfxtools.cxx +++ b/basegfx/test/basegfxtools.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 @@ -99,8 +99,8 @@ public: CPPUNIT_ASSERT_MESSAGE("0.51", nIndex==1 && fAlpha==1.0); } - // Change the following lines only, if you add, remove or rename - // member functions of the current class, + // Change the following lines only, if you add, remove or rename + // member functions of the current class, // because these macros are need by auto register mechanism. CPPUNIT_TEST_SUITE(KeyStopLerpTest); diff --git a/basegfx/test/boxclipper.cxx b/basegfx/test/boxclipper.cxx index 404d9b9848ac..82eddfc3ee6c 100644 --- a/basegfx/test/boxclipper.cxx +++ b/basegfx/test/boxclipper.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 @@ -67,7 +67,7 @@ inline double getRandomOrdinal( const ::std::size_t n ) inline bool compare(const B2DPoint& left, const B2DPoint& right) { - return left.getX()<right.getX() + return left.getX()<right.getX() || (left.getX()==right.getX() && left.getY()<right.getY()); } @@ -149,7 +149,7 @@ public: aRingIntersection2.appendElement( aWest2, ORIENTATION_NEGATIVE ); aRingIntersectExtraStrip = aRingIntersection2; - aRingIntersectExtraStrip.appendElement( B2DRange(0, -25, 200, 25), + aRingIntersectExtraStrip.appendElement( B2DRange(0, -25, 200, 25), ORIENTATION_NEGATIVE ); aComplexIntersections.appendElement( aCenter, ORIENTATION_NEGATIVE ); @@ -246,7 +246,7 @@ public: void verifyPoly(const char* sName, const char* sSvg, const B2DPolyRange& toTest) { B2DPolyPolygon aTmp1; - CPPUNIT_ASSERT_MESSAGE(sName, + CPPUNIT_ASSERT_MESSAGE(sName, tools::importFromSvgD( aTmp1, rtl::OUString::createFromAscii(sSvg))); @@ -301,12 +301,12 @@ public: verifyPoly("randomIntersections", randomIntersections, aRandomIntersections); } - void dumpSvg(const char* pName, + void dumpSvg(const char* pName, const ::basegfx::B2DPolyPolygon& rPoly) { (void)pName; (void)rPoly; #if defined(VERBOSE) - fprintf(stderr, "%s - svg:d=\"%s\"\n", + fprintf(stderr, "%s - svg:d=\"%s\"\n", pName, rtl::OUStringToOString( basegfx::tools::exportToSvgD(rPoly), RTL_TEXTENCODING_UTF8).getStr() ); @@ -344,12 +344,12 @@ public: rRange.getElement(i).head); if( rRange.getElement(i).tail.head == ORIENTATION_NEGATIVE ) aRect.flip(); - + genericClip.append(aRect); } #if defined(VERBOSE) - fprintf(stderr, "%s input - svg:d=\"%s\"\n", + fprintf(stderr, "%s input - svg:d=\"%s\"\n", pName, rtl::OUStringToOString( basegfx::tools::exportToSvgD( genericClip), @@ -362,7 +362,7 @@ public: normalizePoly( boxClipResult))); #if defined(VERBOSE) - fprintf(stderr, "%s boxclipper - svg:d=\"%s\"\n", + fprintf(stderr, "%s boxclipper - svg:d=\"%s\"\n", pName, rtl::OUStringToOString( boxClipSvg, RTL_TEXTENCODING_UTF8).getStr() ); @@ -374,13 +374,13 @@ public: normalizePoly( genericClip))); #if defined(VERBOSE) - fprintf(stderr, "%s genclipper - svg:d=\"%s\"\n", + fprintf(stderr, "%s genclipper - svg:d=\"%s\"\n", pName, rtl::OUStringToOString( genericClipSvg, RTL_TEXTENCODING_UTF8).getStr() ); #endif - CPPUNIT_ASSERT_MESSAGE(pName, + CPPUNIT_ASSERT_MESSAGE(pName, genericClipSvg == boxClipSvg); } @@ -396,7 +396,7 @@ public: validatePoly("intersectionSE", aIntersectionSE); validatePoly("intersectionSW", aIntersectionSW); validatePoly("intersectionNW", aIntersectionNW); - // subtle differences on Solaris Intel, comparison not smart enough + // subtle differences on Solaris Intel, comparison not smart enough // (due to floating point inaccuracies) //validatePoly("ringIntersection", aRingIntersection); //validatePoly("ringIntersection2", aRingIntersection2); @@ -406,14 +406,14 @@ public: //validatePoly("randomIntersections", aRandomIntersections); } - // Change the following lines only, if you add, remove or rename - // member functions of the current class, + // Change the following lines only, if you add, remove or rename + // member functions of the current class, // because these macros are need by auto register mechanism. CPPUNIT_TEST_SUITE(boxclipper); CPPUNIT_TEST(validatePoly); CPPUNIT_TEST(verifyPoly); - CPPUNIT_TEST(getPolyPolygon); + CPPUNIT_TEST(getPolyPolygon); CPPUNIT_TEST_SUITE_END(); }; diff --git a/basegfx/test/clipstate.cxx b/basegfx/test/clipstate.cxx index f1a6b4361618..588389664058 100644 --- a/basegfx/test/clipstate.cxx +++ b/basegfx/test/clipstate.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,11 +56,11 @@ namespace basegfx2d class clipstate : public CppUnit::TestFixture { private: - tools::B2DClipState aUnion1; - tools::B2DClipState aUnion2; - tools::B2DClipState aIntersect; - tools::B2DClipState aXor; - tools::B2DClipState aSubtract; + tools::B2DClipState aUnion1; + tools::B2DClipState aUnion2; + tools::B2DClipState aIntersect; + tools::B2DClipState aXor; + tools::B2DClipState aSubtract; public: void setUp() @@ -110,14 +110,14 @@ public: void verifyPoly(const char* sName, const char* sSvg, const tools::B2DClipState& toTest) { #if defined(VERBOSE) - fprintf(stderr, "%s - svg:d=\"%s\"\n", + fprintf(stderr, "%s - svg:d=\"%s\"\n", sName, rtl::OUStringToOString( basegfx::tools::exportToSvgD(toTest.getClipPoly()), RTL_TEXTENCODING_UTF8).getStr() ); #endif B2DPolyPolygon aTmp1; - CPPUNIT_ASSERT_MESSAGE(sName, + CPPUNIT_ASSERT_MESSAGE(sName, tools::importFromSvgD( aTmp1, rtl::OUString::createFromAscii(sSvg))); @@ -152,7 +152,7 @@ public: void verifyMixedClips() { - tools::B2DClipState aMixedClip; + tools::B2DClipState aMixedClip; const char* unionSvg="m100 10v90h-90v10h-20v-10h-90v-90h-10v-20h10v-90h90v-10h20v10h90v90h10v20z"; diff --git a/basegfx/test/export.map b/basegfx/test/export.map index 3308588ef6f8..0dbbcc5a7372 100644 --- a/basegfx/test/export.map +++ b/basegfx/test/export.map @@ -1,7 +1,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/test/genericclipper.cxx b/basegfx/test/genericclipper.cxx index 8b51a37ff5be..0eb4b4b75f97 100644 --- a/basegfx/test/genericclipper.cxx +++ b/basegfx/test/genericclipper.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 @@ -84,8 +84,8 @@ public: void tearDown() {} - void validate(const char* pName, - const char* pValidSvgD, + void validate(const char* pName, + const char* pValidSvgD, B2DPolyPolygon (*pFunc)(const B2DPolyPolygon&, const B2DPolyPolygon&)) { const B2DPolyPolygon aSelfIntersect( @@ -93,12 +93,12 @@ public: const B2DPolyPolygon aRect( tools::prepareForPolygonOperation(aShiftedRectangle)); #if defined(VERBOSE) - fprintf(stderr, "%s input LHS - svg:d=\"%s\"\n", + fprintf(stderr, "%s input LHS - svg:d=\"%s\"\n", pName, rtl::OUStringToOString( basegfx::tools::exportToSvgD( aSelfIntersect), RTL_TEXTENCODING_UTF8).getStr() ); - fprintf(stderr, "%s input RHS - svg:d=\"%s\"\n", + fprintf(stderr, "%s input RHS - svg:d=\"%s\"\n", pName, rtl::OUStringToOString( basegfx::tools::exportToSvgD( aRect), @@ -109,7 +109,7 @@ public: pFunc(aSelfIntersect, aRect); #if defined(VERBOSE) - fprintf(stderr, "%s - svg:d=\"%s\"\n", + fprintf(stderr, "%s - svg:d=\"%s\"\n", pName, rtl::OUStringToOString( basegfx::tools::exportToSvgD(aRes), RTL_TEXTENCODING_UTF8).getStr() ); @@ -145,8 +145,8 @@ public: validate("validateDiff", pValid, &tools::solvePolygonOperationDiff); } - // Change the following lines only, if you add, remove or rename - // member functions of the current class, + // Change the following lines only, if you add, remove or rename + // member functions of the current class, // because these macros are need by auto register mechanism. CPPUNIT_TEST_SUITE(genericclipper); diff --git a/basegfx/test/testtools.cxx b/basegfx/test/testtools.cxx index 3b2ec3051324..1265df264c5b 100644 --- a/basegfx/test/testtools.cxx +++ b/basegfx/test/testtools.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 @@ -54,7 +54,7 @@ namespace basegfx // mode, therefore every plot has at least _two_ // functions: one for the x and one for the y value, both // depending on t. - mrOutputStream << "#!/usr/bin/gnuplot -persist" << ::std::endl + mrOutputStream << "#!/usr/bin/gnuplot -persist" << ::std::endl << "#" << ::std::endl << "# automatically generated by basegfx::testtools::Plotter, don't change!" << ::std::endl << "#" << ::std::endl @@ -96,7 +96,7 @@ namespace basegfx public: PointWriter( ::std::ostream& rOutputStream ) : mrOutputStream( rOutputStream ) - { + { } void operator()( const B2DPoint& rPoint ) const @@ -106,7 +106,7 @@ namespace basegfx } private: - ::std::ostream& mrOutputStream; + ::std::ostream& mrOutputStream; }; } @@ -114,7 +114,7 @@ namespace basegfx { // End the plot line mrOutputStream << ::std::endl; - + // write stored data points. Cannot write before, since // this is an inline dataset, which must be after the plot <...> // line @@ -127,7 +127,7 @@ namespace basegfx if( pointCount < 1 ) return; - + if( pointCount == 1 ) { plot( rPoly.getB2DPoint(0) ); @@ -140,9 +140,9 @@ namespace basegfx if(rPoly.isNextControlPointUsed(i) || rPoly.isPrevControlPointUsed(i + 1)) { const B2DCubicBezier aBezierPlot( - rPoly.getB2DPoint(i), rPoly.getNextControlPoint(i), + rPoly.getB2DPoint(i), rPoly.getNextControlPoint(i), rPoly.getPrevControlPoint(i + 1), rPoly.getB2DPoint(i + 1)); - + plot(aBezierPlot); } else @@ -177,19 +177,19 @@ namespace basegfx // decompose into four lines plot( B2DPoint(rRect.getMinX(), - rRect.getMinY()), + rRect.getMinY()), B2DPoint(rRect.getMaxX(), rRect.getMinY()) ); plot( B2DPoint(rRect.getMaxX(), - rRect.getMinY()), + rRect.getMinY()), B2DPoint(rRect.getMaxX(), rRect.getMaxY()) ); plot( B2DPoint(rRect.getMaxX(), - rRect.getMaxY()), + rRect.getMaxY()), B2DPoint(rRect.getMinX(), rRect.getMaxY()) ); plot( B2DPoint(rRect.getMinX(), - rRect.getMaxY()), + rRect.getMaxY()), B2DPoint(rRect.getMinX(), rRect.getMinY()) ); } @@ -198,10 +198,10 @@ namespace basegfx { writeSeparator(); mrOutputStream << "line(" << rStartPoint.getX() - << "," << rEndPoint.getX() + << "," << rEndPoint.getX() << ",t), " << "line(" << rStartPoint.getY() - << "," << rEndPoint.getY() + << "," << rEndPoint.getY() << ",t)"; } @@ -209,13 +209,13 @@ namespace basegfx { writeSeparator(); mrOutputStream << "cubicBezier(" << rCurve.getStartPoint().getX() - << "," << rCurve.getControlPointA().getX() - << "," << rCurve.getControlPointB().getX() + << "," << rCurve.getControlPointA().getX() + << "," << rCurve.getControlPointB().getX() << "," << rCurve.getEndPoint().getX() << ",t), " << "cubicBezier(" << rCurve.getStartPoint().getY() - << "," << rCurve.getControlPointA().getY() - << "," << rCurve.getControlPointB().getY() + << "," << rCurve.getControlPointA().getY() + << "," << rCurve.getControlPointB().getY() << "," << rCurve.getEndPoint().getY() << ",t)"; } diff --git a/basegfx/test/testtools.hxx b/basegfx/test/testtools.hxx index c355df27376a..98cf53c4af08 100644 --- a/basegfx/test/testtools.hxx +++ b/basegfx/test/testtools.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 @@ -89,9 +89,9 @@ namespace basegfx private: void writeSeparator(); - ::std::ostream& mrOutputStream; - ::std::vector< B2DPoint > maPoints; - bool mbFirstElement; + ::std::ostream& mrOutputStream; + ::std::vector< B2DPoint > maPoints; + bool mbFirstElement; }; } } |