incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1394141 - in /incubator/ooo/trunk/main: basegfx/inc/basegfx/pixel/ basegfx/inc/basegfx/point/ basegfx/inc/basegfx/raster/ basegfx/inc/basegfx/tuple/ basegfx/source/point/ basegfx/source/tools/ basegfx/source/tuple/ drawinglayer/source/text...
Date Thu, 04 Oct 2012 16:27:23 GMT
Author: alg
Date: Thu Oct  4 16:27:22 2012
New Revision: 1394141

URL: http://svn.apache.org/viewvc?rev=1394141&view=rev
Log:
#120604# corrected 3d gradients, adapted basegfx to be smarter in some areas

Modified:
    incubator/ooo/trunk/main/basegfx/inc/basegfx/pixel/bpixel.hxx
    incubator/ooo/trunk/main/basegfx/inc/basegfx/point/b2dhompoint.hxx
    incubator/ooo/trunk/main/basegfx/inc/basegfx/point/b3dhompoint.hxx
    incubator/ooo/trunk/main/basegfx/inc/basegfx/raster/rasterconvert3d.hxx
    incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b2dtuple.hxx
    incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b2i64tuple.hxx
    incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b2ituple.hxx
    incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b3dtuple.hxx
    incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b3i64tuple.hxx
    incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b3ituple.hxx
    incubator/ooo/trunk/main/basegfx/source/point/b2dhompoint.cxx
    incubator/ooo/trunk/main/basegfx/source/tools/gradienttools.cxx
    incubator/ooo/trunk/main/basegfx/source/tuple/b2ituple.cxx
    incubator/ooo/trunk/main/drawinglayer/source/texture/texture.cxx

Modified: incubator/ooo/trunk/main/basegfx/inc/basegfx/pixel/bpixel.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/basegfx/inc/basegfx/pixel/bpixel.hxx?rev=1394141&r1=1394140&r2=1394141&view=diff
==============================================================================
--- incubator/ooo/trunk/main/basegfx/inc/basegfx/pixel/bpixel.hxx (original)
+++ incubator/ooo/trunk/main/basegfx/inc/basegfx/pixel/bpixel.hxx Thu Oct  4 16:27:22 2012
@@ -138,22 +138,20 @@ namespace basegfx
 
 	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()); 
-		return aMin;
+        return BPixel(
+            std::min(rTupB.getRed(), rTupA.getRed()),
+            std::min(rTupB.getGreen(), rTupA.getGreen()),
+            std::min(rTupB.getBlue(), rTupA.getBlue()),
+            std::min(rTupB.getOpacity(), rTupA.getOpacity()));
 	}
 
 	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()); 
-		return aMax;
+        return BPixel(
+            std::max(rTupB.getRed(), rTupA.getRed()),
+            std::max(rTupB.getGreen(), rTupA.getGreen()),
+            std::max(rTupB.getBlue(), rTupA.getBlue()),
+            std::max(rTupB.getOpacity(), rTupA.getOpacity())); 
 	}
 
 	inline BPixel interpolate(const BPixel& rOld1, const BPixel& rOld2, double t) 
@@ -174,7 +172,8 @@ namespace basegfx
 		{
 			const sal_uInt32 nFactor(fround(256.0 * t));
 			const sal_uInt32 nNegFac(256L - nFactor);
-			return BPixel(
+			
+            return BPixel(
 				(sal_uInt8)(((sal_uInt32)rOld1.getRed() * nNegFac + (sal_uInt32)rOld2.getRed() * nFactor) >> 8L),
 				(sal_uInt8)(((sal_uInt32)rOld1.getGreen() * nNegFac + (sal_uInt32)rOld2.getGreen() * nFactor) >> 8L),
 				(sal_uInt8)(((sal_uInt32)rOld1.getBlue() * nNegFac + (sal_uInt32)rOld2.getBlue() * nFactor) >> 8L),
@@ -184,34 +183,20 @@ namespace basegfx
 
 	inline BPixel average(const BPixel& rOld1, const BPixel& rOld2) 
 	{ 
-		if(rOld1 == rOld2)
-		{
-			return rOld1;
-		}
-		else
-		{
-			return BPixel(
-				(sal_uInt8)(((sal_uInt32)rOld1.getRed() + (sal_uInt32)rOld2.getRed()) >> 1L),
-				(sal_uInt8)(((sal_uInt32)rOld1.getGreen() + (sal_uInt32)rOld2.getGreen()) >> 1L),
-				(sal_uInt8)(((sal_uInt32)rOld1.getBlue() + (sal_uInt32)rOld2.getBlue()) >> 1L),
-				(sal_uInt8)(((sal_uInt32)rOld1.getOpacity() + (sal_uInt32)rOld2.getOpacity()) >> 1L));
-		}
+        return BPixel(
+            rOld1.getRed() == rOld2.getRed() ? rOld1.getRed() : (sal_uInt8)(((sal_uInt32)rOld1.getRed() + (sal_uInt32)rOld2.getRed()) >> 1L),
+            rOld1.getGreen() == rOld2.getGreen() ? rOld1.getGreen() : (sal_uInt8)(((sal_uInt32)rOld1.getGreen() + (sal_uInt32)rOld2.getGreen()) >> 1L),
+            rOld1.getBlue() == rOld2.getBlue() ? rOld1.getBlue() : (sal_uInt8)(((sal_uInt32)rOld1.getBlue() + (sal_uInt32)rOld2.getBlue()) >> 1L),
+            rOld1.getOpacity() == rOld2.getOpacity() ? rOld1.getOpacity() : (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;
-		}
-		else
-		{
-			return BPixel(
-				(sal_uInt8)(((sal_uInt32)rOld1.getRed() + (sal_uInt32)rOld2.getRed() + (sal_uInt32)rOld3.getRed()) / 3L),
-				(sal_uInt8)(((sal_uInt32)rOld1.getGreen() + (sal_uInt32)rOld2.getGreen() + (sal_uInt32)rOld3.getGreen()) / 3L),
-				(sal_uInt8)(((sal_uInt32)rOld1.getBlue() + (sal_uInt32)rOld2.getBlue() + (sal_uInt32)rOld3.getBlue()) / 3L),
-				(sal_uInt8)(((sal_uInt32)rOld1.getOpacity() + (sal_uInt32)rOld2.getOpacity() + (sal_uInt32)rOld3.getOpacity()) / 3L));
-		}
+        return BPixel(
+            (rOld1.getRed() == rOld2.getRed() && rOld2.getRed() == rOld3.getRed()) ? rOld1.getRed() : (sal_uInt8)(((sal_uInt32)rOld1.getRed() + (sal_uInt32)rOld2.getRed() + (sal_uInt32)rOld3.getRed()) / 3L),
+            (rOld1.getGreen() == rOld2.getGreen() && rOld2.getGreen() == rOld3.getGreen()) ? rOld1.getGreen() : (sal_uInt8)(((sal_uInt32)rOld1.getGreen() + (sal_uInt32)rOld2.getGreen() + (sal_uInt32)rOld3.getGreen()) / 3L),
+            (rOld1.getBlue() == rOld2.getBlue() && rOld2.getBlue() == rOld3.getBlue()) ? rOld1.getBlue() : (sal_uInt8)(((sal_uInt32)rOld1.getBlue() + (sal_uInt32)rOld2.getBlue() + (sal_uInt32)rOld3.getBlue()) / 3L),
+            (rOld1.getOpacity() == rOld2.getOpacity() && rOld2.getOpacity() == rOld3.getOpacity()) ? rOld1.getOpacity() : (sal_uInt8)(((sal_uInt32)rOld1.getOpacity() + (sal_uInt32)rOld2.getOpacity() + (sal_uInt32)rOld3.getOpacity()) / 3L));
 	}
 } // end of namespace basegfx
 

Modified: incubator/ooo/trunk/main/basegfx/inc/basegfx/point/b2dhompoint.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/basegfx/inc/basegfx/point/b2dhompoint.hxx?rev=1394141&r1=1394140&r2=1394141&view=diff
==============================================================================
--- incubator/ooo/trunk/main/basegfx/inc/basegfx/point/b2dhompoint.hxx (original)
+++ incubator/ooo/trunk/main/basegfx/inc/basegfx/point/b2dhompoint.hxx Thu Oct  4 16:27:22 2012
@@ -48,13 +48,17 @@ namespace basegfx
 		::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
 
 			@return Returns true if this point has no homogenous part
 		*/
-		bool implIsHomogenized() const;
+		inline bool implIsHomogenized() const
+	    { 
+		    const double fOne(1.0);
+		    return ::basegfx::fTools::equal(fOne, mfW); 
+	    }
 		
 		/**	Remove homogenous part of this Point
 
@@ -74,7 +78,11 @@ namespace basegfx
 			the homogenous part of a homogenous point does from a mathematical
 			point of view not change the point at all.
 		*/
-		void implTestAndHomogenize() const;
+		inline void implTestAndHomogenize() const
+	    {
+		    if(!implIsHomogenized())
+			    ((B2DHomPoint*)this)->implHomogenize();
+	    }
 
 	public:					
 		/**	Create a homogen point
@@ -134,7 +142,11 @@ namespace basegfx
 			@attention Even when this method is const it may change all
 			members of this instance.
 		*/
-		B2DPoint getB2DPoint() const;
+		inline B2DPoint getB2DPoint() const
+	    {
+		    implTestAndHomogenize();
+		    return B2DPoint(maTuple.getX(), maTuple.getY());
+	    }
 
 		/**	Get X-coordinate
 
@@ -144,7 +156,11 @@ namespace basegfx
 			@attention Even when this method is const it may change all
 			members of this instance.
 		*/
-		double getX() const;
+		inline double getX() const
+	    { 
+		    implTestAndHomogenize();
+		    return maTuple.getX(); 
+	    }
 
 		/**	Get Y-coordinate
 
@@ -154,7 +170,11 @@ namespace basegfx
 			@attention Even when this method is const it may change all
 			members of this instance.
 		*/
-		double getY() const;
+		inline double getY() const
+	    { 
+		    implTestAndHomogenize();
+		    return maTuple.getY(); 
+	    }
 
 		/**	Set X-coordinate of the homogen point.
 
@@ -164,7 +184,10 @@ namespace basegfx
 			@param fX
 			The to-be-set X-coordinate without homogenous part.
 		*/
-		void setX(double fX);
+		inline void setX(double fX)
+	    {
+		    maTuple.setX(implIsHomogenized() ? fX : fX * mfW );
+	    }
 
 		/**	Set Y-coordinate of the homogen point.
 
@@ -174,58 +197,183 @@ namespace basegfx
 			@param fY
 			The to-be-set Y-coordinate without homogenous part.
 		*/
-		void setY(double fY);
+		inline void setY(double fY)
+	    {
+		    maTuple.setY(implIsHomogenized() ? fY : fY * mfW );
+	    }
 
 		// operators
 		//////////////////////////////////////////////////////////////////////
 
-		B2DHomPoint& operator+=( const B2DHomPoint& rPnt );
+		inline 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;
+
+		    return *this;
+	    }
+
+		inline 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;
 
-		B2DHomPoint& operator-=( const B2DHomPoint& rPnt );
+		    return *this;
+	    }
 		
-		B2DHomPoint& operator*=(double t);
+		inline B2DHomPoint& operator*=(double t)
+	    { 
+		    if(!::basegfx::fTools::equalZero(t))
+		    {
+			    mfW /= t;
+		    }
 
-		B2DHomPoint& operator*=( const B2DHomMatrix& rMat );
+		    return *this; 
+	    }
 
-		B2DHomPoint& operator/=(double t);
+		B2DHomPoint& operator*=( const B2DHomMatrix& rMat );
 
-		B2DHomPoint& operator-(void);
+		inline B2DHomPoint& operator/=(double t)
+	    { 
+		    mfW *= t;
+		    return *this; 
+	    }
+
+		inline B2DHomPoint& operator-(void)
+	    {	
+		    mfW = -mfW;
+		    return *this;
+	    }
 		
-		bool operator==( const B2DHomPoint& rPnt ) const;
-
-		bool operator!=( const B2DHomPoint& rPnt ) const;
+		inline bool operator==( const B2DHomPoint& rPnt ) const
+	    { 
+		    implTestAndHomogenize();
+		    return (maTuple == rPnt.maTuple);
+	    }
+
+		inline bool operator!=( const B2DHomPoint& rPnt ) const
+	    { 
+		    implTestAndHomogenize();
+		    return (maTuple != rPnt.maTuple);
+	    }
 		
-		B2DHomPoint& operator=( const B2DHomPoint& rPnt );
+		inline B2DHomPoint& operator=( const B2DHomPoint& rPnt )
+	    { 
+		    maTuple = rPnt.maTuple;
+		    mfW = rPnt.mfW;
+		    return *this; 
+	    }
 	};
 
 	// external operators
 	//////////////////////////////////////////////////////////////////////////
 
-	B2DHomPoint minimum(const B2DHomPoint& rVecA, const B2DHomPoint& rVecB);
-
-	B2DHomPoint maximum(const B2DHomPoint& rVecA, const B2DHomPoint& rVecB);
-
-	B2DHomPoint absolute(const B2DHomPoint& rVec);
-
-	B2DHomPoint interpolate(B2DHomPoint& rOld1, B2DHomPoint& rOld2, double t);
-
-	B2DHomPoint average(B2DHomPoint& rOld1, B2DHomPoint& rOld2);
+	inline B2DHomPoint minimum(const B2DHomPoint& rVecA, const B2DHomPoint& rVecB)
+	{ 
+        return B2DHomPoint( // getX()/getY() homogenizes already
+            std::min(rVecB.getX(), rVecA.getX()),
+            std::min(rVecB.getY(), rVecA.getY())); 
+	}
+
+	inline B2DHomPoint maximum(const B2DHomPoint& rVecA, const B2DHomPoint& rVecB)
+	{ 
+        return B2DHomPoint( // getX()/getY() homogenizes already
+            std::max(rVecB.getX(), rVecA.getX()),
+            std::max(rVecB.getY(), rVecA.getY())); 
+	}
+
+	inline B2DHomPoint absolute(const B2DHomPoint& rVec)
+	{ 
+        return B2DHomPoint( // getX()/getY() homogenizes already
+            fabs(rVec.getX()),
+            fabs(rVec.getY())); 
+	}
+
+	inline B2DHomPoint interpolate(B2DHomPoint& rOld1, B2DHomPoint& rOld2, double t)
+	{ 
+        if(0.0 >= t)
+        {
+            return rOld1;
+        }
+        else if(1.0 <= t)
+        {
+            return rOld2;
+        }
+        else if(rOld1 == rOld2) // this call homogenizes already
+        {
+            return rOld1;
+        }
+        else
+        {
+		    return B2DHomPoint(
+			    ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(),
+			    ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY()); 
+        }
+	}
+
+	inline B2DHomPoint average(B2DHomPoint& rOld1, B2DHomPoint& rOld2)
+	{ 
+        return B2DHomPoint( // getX()/ getY() homogenizes already
+            rOld1.getX() == rOld2.getX() ? rOld1.getX() : (rOld1.getX() + rOld2.getX()) * 0.5,
+            rOld1.getY() == rOld2.getY() ? rOld1.getY() : (rOld1.getY() + rOld2.getY()) * 0.5); 
+	}
 	
-	B2DHomPoint average(B2DHomPoint& rOld1, B2DHomPoint& rOld2, B2DHomPoint& rOld3);
-
-	B2DHomPoint operator+(const B2DHomPoint& rVecA, const B2DHomPoint& rVecB);
-
-	B2DHomPoint operator-(const B2DHomPoint& rVecA, const B2DHomPoint& rVecB);
-
-	B2DHomPoint operator*(const B2DHomPoint& rVec, double t);
-
-	B2DHomPoint operator*(double t, const B2DHomPoint& rVec);
-
-	B2DHomPoint operator*( const B2DHomMatrix& rMat, const B2DHomPoint& rPoint );
-
-	B2DHomPoint operator/(const B2DHomPoint& rVec, double t);
-
-	B2DHomPoint operator/(double t, const B2DHomPoint& rVec);
+	inline B2DHomPoint average(B2DHomPoint& rOld1, B2DHomPoint& rOld2, B2DHomPoint& rOld3)
+	{ 
+        return B2DHomPoint( // getX()/ getY() homogenizes already
+            (rOld1.getX() == rOld2.getX() && rOld2.getX() == rOld3.getX()) ? rOld1.getX() : (rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0),
+            (rOld1.getY() == rOld2.getY() && rOld2.getY() == rOld3.getY()) ? rOld1.getY() : (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0)); 
+	}
+
+	inline B2DHomPoint operator+(const B2DHomPoint& rVecA, const B2DHomPoint& rVecB)
+	{ 
+		B2DHomPoint aSum(rVecA); 
+		aSum += rVecB; 
+		return aSum; 
+	}
+
+	inline B2DHomPoint operator-(const B2DHomPoint& rVecA, const B2DHomPoint& rVecB)
+	{ 
+		B2DHomPoint aSub(rVecA); 
+		aSub -= rVecB; 
+		return aSub; 
+	}
+
+	inline B2DHomPoint operator*(const B2DHomPoint& rVec, double t)
+	{ 
+		B2DHomPoint aNew(rVec); 
+		aNew *= t; 
+		return aNew; 
+	}
+
+	inline B2DHomPoint operator*(double t, const B2DHomPoint& rVec)
+	{ 
+		B2DHomPoint aNew(rVec); 
+		aNew *= t; 
+		return aNew; 
+	}
+
+	inline B2DHomPoint operator*( const B2DHomMatrix& rMat, const B2DHomPoint& rPoint )
+	{
+		B2DHomPoint aNew(rPoint); 
+		return aNew*=rMat;
+	}
+
+	inline B2DHomPoint operator/(const B2DHomPoint& rVec, double t)
+	{ 
+		B2DHomPoint aNew(rVec); 
+		aNew /= t; 
+		return aNew; 
+	}
+
+	inline B2DHomPoint operator/(double t, const B2DHomPoint& rVec)
+	{
+		B2DHomPoint aNew(rVec); 
+		aNew /= t; 
+		return aNew; 
+	}
 } // end of namespace basegfx
 
 #endif /* _BGFX_POINT_B2DHOMPOINT_HXX */

Modified: incubator/ooo/trunk/main/basegfx/inc/basegfx/point/b3dhompoint.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/basegfx/inc/basegfx/point/b3dhompoint.hxx?rev=1394141&r1=1394140&r2=1394141&view=diff
==============================================================================
--- incubator/ooo/trunk/main/basegfx/inc/basegfx/point/b3dhompoint.hxx (original)
+++ incubator/ooo/trunk/main/basegfx/inc/basegfx/point/b3dhompoint.hxx Thu Oct  4 16:27:22 2012
@@ -303,56 +303,65 @@ namespace basegfx
 
 	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()); 
-		return aMin;
+        return B3DHomPoint( // getX()/getY()/getZ() homogenizes already
+            std::min(rVecB.getX(), rVecA.getX()),
+            std::min(rVecB.getY(), rVecA.getY()),
+            std::min(rVecB.getZ(), rVecA.getZ())); 
 	}
 
 	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()); 
-		return aMax;
+        return B3DHomPoint(// getX()/getY()/getZ() homogenizes already
+            std::max(rVecB.getX(), rVecA.getX()),
+            std::max(rVecB.getY(), rVecA.getY()),
+            std::max(rVecB.getZ(), rVecA.getZ())); 
 	}
 
 	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()); 
-		return aAbs;
+        return B3DHomPoint(// getX()/getY()/getZ() homogenizes already
+            fabs(rVec.getX()),
+            fabs(rVec.getY()),
+            fabs(rVec.getZ())); 
 	}
 
 	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()); 
-		return aInt;
+        if(0.0 >= t)
+        {
+            return rOld1;
+        }
+        else if(1.0 <= t)
+        {
+            return rOld2;
+        }
+        else if(rOld1 == rOld2) // this call homogenizes already
+        {
+            return rOld1;
+        }
+        else
+        {
+            return B3DHomPoint(
+                ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(),
+                ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY(),
+                ((rOld2.getZ() - rOld1.getZ()) * t) + rOld1.getZ()); 
+        }
 	}
 
 	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); 
-		return aAvg;
+        return B3DHomPoint( // getX()/getY()/getZ() homogenizes already
+            rOld1.getX() == rOld2.getX() ? rOld1.getX() : (rOld1.getX() + rOld2.getX()) * 0.5,
+            rOld1.getY() == rOld2.getY() ? rOld1.getY() : (rOld1.getY() + rOld2.getY()) * 0.5,
+            rOld1.getY() == rOld2.getY() ? rOld1.getY() : (rOld1.getY() + rOld2.getY()) * 0.5);
 	}
 	
 	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)); 
-		return aAvg;
+        return B3DHomPoint( // getX()/getY()/getZ() homogenizes already
+            (rOld1.getX() == rOld2.getX() && rOld2.getX() == rOld3.getX()) ? rOld1.getX() : (rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0),
+            (rOld1.getY() == rOld2.getY() && rOld2.getY() == rOld3.getY()) ? rOld1.getY() : (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0),
+            (rOld1.getZ() == rOld2.getZ() && rOld2.getZ() == rOld3.getZ()) ? rOld1.getZ() : (rOld1.getZ() + rOld2.getZ() + rOld3.getZ()) * (1.0 / 3.0)); 
 	}
 
 	inline B3DHomPoint operator+(const B3DHomPoint& rVecA, const B3DHomPoint& rVecB)

Modified: incubator/ooo/trunk/main/basegfx/inc/basegfx/raster/rasterconvert3d.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/basegfx/inc/basegfx/raster/rasterconvert3d.hxx?rev=1394141&r1=1394140&r2=1394141&view=diff
==============================================================================
--- incubator/ooo/trunk/main/basegfx/inc/basegfx/raster/rasterconvert3d.hxx (original)
+++ incubator/ooo/trunk/main/basegfx/inc/basegfx/raster/rasterconvert3d.hxx Thu Oct  4 16:27:22 2012
@@ -144,42 +144,152 @@ namespace basegfx
     protected:
 	    sal_uInt32 addColorInterpolator(const BColor& rA, const BColor& rB, double fInvYDelta)
 	    {
-		    B3DVector aDelta(rB.getRed() - rA.getRed(), rB.getGreen() - rA.getGreen(), rB.getBlue() - rA.getBlue());
-		    aDelta *= fInvYDelta;
-		    maColorInterpolators.push_back(ip_triple(rA.getRed(), aDelta.getX(), rA.getGreen(), aDelta.getY(), rA.getBlue(), aDelta.getZ()));
-		    return (maColorInterpolators.size() - 1L);
+            double aDeltaRed(rB.getRed() - rA.getRed());
+
+            if(fTools::equalZero(aDeltaRed))
+            {
+                aDeltaRed = 0.0;
+            }
+            else
+            {
+                aDeltaRed *= fInvYDelta;
+            }
+
+            double aDeltaGreen(rB.getGreen() - rA.getGreen());
+
+            if(fTools::equalZero(aDeltaGreen))
+            {
+                aDeltaGreen = 0.0;
+            }
+            else
+            {
+                aDeltaGreen *= fInvYDelta;
+            }
+
+            double aDeltaBlue(rB.getBlue() - rA.getBlue());
+
+            if(fTools::equalZero(aDeltaBlue))
+            {
+                aDeltaBlue = 0.0;
+            }
+            else
+            {
+                aDeltaBlue *= fInvYDelta;
+            }
+
+		    maColorInterpolators.push_back(
+                ip_triple(
+                    rA.getRed(), aDeltaRed, 
+                    rA.getGreen(), aDeltaGreen, 
+                    rA.getBlue(), aDeltaBlue));
+
+		    return (maColorInterpolators.size() - 1);
 	    }
 
 	    sal_uInt32 addNormalInterpolator(const B3DVector& rA, const B3DVector& rB, double fInvYDelta)
 	    {
-		    B3DVector aDelta(rB.getX() - rA.getX(), rB.getY() - rA.getY(), rB.getZ() - rA.getZ());
-		    aDelta *= fInvYDelta;
-		    maNormalInterpolators.push_back(ip_triple(rA.getX(), aDelta.getX(), rA.getY(), aDelta.getY(), rA.getZ(), aDelta.getZ()));
-		    return (maNormalInterpolators.size() - 1L);
+            double aDeltaX(rB.getX() - rA.getX());
+
+            if(fTools::equalZero(aDeltaX))
+            {
+                aDeltaX = 0.0;
+            }
+            else
+            {
+                aDeltaX *= fInvYDelta;
+            }
+
+            double aDeltaY(rB.getY() - rA.getY());
+
+            if(fTools::equalZero(aDeltaY))
+            {
+                aDeltaY = 0.0;
+            }
+            else
+            {
+                aDeltaY *= fInvYDelta;
+            }
+
+            double aDeltaZ(rB.getZ() - rA.getZ());
+
+            if(fTools::equalZero(aDeltaZ))
+            {
+                aDeltaZ = 0.0;
+            }
+            else
+            {
+                aDeltaZ *= fInvYDelta;
+            }
+
+		    maNormalInterpolators.push_back(
+                ip_triple(
+                    rA.getX(), aDeltaX, 
+                    rA.getY(), aDeltaY, 
+                    rA.getZ(), aDeltaZ));
+
+		    return (maNormalInterpolators.size() - 1);
 	    }
 
 	    sal_uInt32 addTextureInterpolator(const B2DPoint& rA, const B2DPoint& rB, double fInvYDelta)
 	    {
-		    B2DVector aDelta(rB.getX() - rA.getX(), rB.getY() - rA.getY());
-		    aDelta *= fInvYDelta;
-		    maTextureInterpolators.push_back(ip_double(rA.getX(), aDelta.getX(), rA.getY(), aDelta.getY()));
-		    return (maTextureInterpolators.size() - 1L);
+            double aDeltaX(rB.getX() - rA.getX());
+
+            if(fTools::equalZero(aDeltaX))
+            {
+                aDeltaX = 0.0;
+            }
+            else
+            {
+                aDeltaX *= fInvYDelta;
+            }
+
+            double aDeltaY(rB.getY() - rA.getY());
+
+            if(fTools::equalZero(aDeltaY))
+            {
+                aDeltaY = 0.0;
+            }
+            else
+            {
+                aDeltaY *= fInvYDelta;
+            }
+
+		    maTextureInterpolators.push_back(
+                ip_double(
+                    rA.getX(), aDeltaX, 
+                    rA.getY(), aDeltaY));
+
+		    return (maTextureInterpolators.size() - 1);
 	    }
 
 	    sal_uInt32 addInverseTextureInterpolator(const B2DPoint& rA, const B2DPoint& rB, double fZEyeA, double fZEyeB, double fInvYDelta)
 	    {
-		    const double fInvZEyeA(fTools::equalZero(fZEyeA) ? fZEyeA : 1.0 / fZEyeA);
-		    const double fInvZEyeB(fTools::equalZero(fZEyeB) ? fZEyeB : 1.0 / fZEyeB);
-		    const B2DPoint aInvA(rA * fInvZEyeA);
-		    const B2DPoint aInvB(rB * fInvZEyeB);
-		    double fZDelta(fInvZEyeB - fInvZEyeA);
-		    B2DVector aDelta(aInvB.getX() - aInvA.getX(), aInvB.getY() - aInvA.getY());
-
-		    fZDelta *= fInvYDelta;
-		    aDelta *= fInvYDelta;
+            double fZDelta(fZEyeB - fZEyeA);
+            const double fInvZEyeA(fTools::equalZero(fZEyeA) ? fZEyeA : 1.0 / fZEyeA);
+            double fInvZEyeB(fInvZEyeA);
+
+            if(fTools::equalZero(fZDelta))
+            {
+                fZDelta = 0.0;
+            }
+            else
+            {
+                fInvZEyeB = fTools::equalZero(fZEyeB) ? fZEyeB : 1.0 / fZEyeB;
+                fZDelta = (fInvZEyeB - fInvZEyeA) * fInvYDelta;
+            }
+
+            const B2DPoint aInvA(rA * fInvZEyeA);
+            const B2DPoint aInvB(rB * fInvZEyeB);
+            const double aDeltaX((aInvB.getX() - aInvA.getX()) * fInvYDelta);
+            const double aDeltaY((aInvB.getY() - aInvA.getY()) * fInvYDelta);
+
+		    maInverseTextureInterpolators.push_back(
+                ip_triple(
+                    aInvA.getX(), aDeltaX, 
+                    aInvA.getY(), aDeltaY, 
+                    fInvZEyeA, fZDelta));
 
-		    maInverseTextureInterpolators.push_back(ip_triple(aInvA.getX(), aDelta.getX(), aInvA.getY(), aDelta.getY(), fInvZEyeA, fZDelta));
-		    return (maInverseTextureInterpolators.size() - 1L);
+		    return (maInverseTextureInterpolators.size() - 1);
 	    }
 
 	    void reset()

Modified: incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b2dtuple.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b2dtuple.hxx?rev=1394141&r1=1394140&r2=1394141&view=diff
==============================================================================
--- incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b2dtuple.hxx (original)
+++ incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b2dtuple.hxx Thu Oct  4 16:27:22 2012
@@ -26,6 +26,9 @@
 
 #include <sal/types.h>
 #include <basegfx/numeric/ftools.hxx>
+#undef min
+#undef max
+#include <algorithm>
 
 namespace basegfx
 {
@@ -242,50 +245,60 @@ namespace basegfx
 
 	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()); 
-		return aMin;
+        return B2DTuple(
+            std::min(rTupB.getX(), rTupA.getX()),
+            std::min(rTupB.getY(), rTupA.getY())); 
 	}
 
 	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()); 
-		return aMax;
+        return B2DTuple(
+            std::max(rTupB.getX(), rTupA.getX()),
+            std::max(rTupB.getY(), rTupA.getY())); 
 	}
 
 	inline B2DTuple absolute(const B2DTuple& rTup) 
 	{ 
 		B2DTuple aAbs(
-			(0.0 > rTup.getX()) ? -rTup.getX() : rTup.getX(),
-			(0.0 > rTup.getY()) ? -rTup.getY() : rTup.getY()); 
+            fabs(rTup.getX()),
+            fabs(rTup.getY())); 
 		return aAbs;
 	}
 
 	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()); 
-		return aInt;
+        if(rOld1 == rOld2)
+        {
+            return rOld1;
+        }
+        else if(0.0 >= t)
+        {
+            return rOld1;
+        }
+        else if(1.0 <= t)
+        {
+            return rOld2;
+        }
+        else
+        {
+            return B2DTuple(
+			    ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(),
+			    ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY()); 
+        }
 	}
 
 	inline B2DTuple average(const B2DTuple& rOld1, const B2DTuple& rOld2) 
 	{ 
-		B2DTuple aAvg(
-			(rOld1.getX() + rOld2.getX()) * 0.5,
-			(rOld1.getY() + rOld2.getY()) * 0.5); 
-		return aAvg;
+        return B2DTuple(
+            rOld1.getX() == rOld2.getX() ? rOld1.getX() : (rOld1.getX() + rOld2.getX()) * 0.5,
+            rOld1.getY() == rOld2.getY() ? rOld1.getY() : (rOld1.getY() + rOld2.getY()) * 0.5);
 	}
 	
 	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)); 
-		return aAvg;
+        return B2DTuple(
+            (rOld1.getX() == rOld2.getX() && rOld2.getX() == rOld3.getX()) ? rOld1.getX() : (rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0),
+            (rOld1.getY() == rOld2.getY() && rOld2.getY() == rOld3.getY()) ? rOld1.getY() : (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0)); 
 	}
 
 	inline B2DTuple operator+(const B2DTuple& rTupA, const B2DTuple& rTupB)

Modified: incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b2i64tuple.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b2i64tuple.hxx?rev=1394141&r1=1394140&r2=1394141&view=diff
==============================================================================
--- incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b2i64tuple.hxx (original)
+++ incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b2i64tuple.hxx Thu Oct  4 16:27:22 2012
@@ -201,18 +201,16 @@ namespace basegfx
 
 	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()); 
-		return aMin;
+        return B2I64Tuple(
+            std::min(rTupB.getX(), rTupA.getX()),
+            std::min(rTupB.getY(), rTupA.getY())); 
 	}
 
 	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()); 
-		return aMax;
+        return B2I64Tuple(
+            std::max(rTupB.getX(), rTupA.getX()),
+            std::max(rTupB.getY(), rTupA.getY()));
 	}
 
 	inline B2I64Tuple absolute(const B2I64Tuple& rTup) 
@@ -223,28 +221,40 @@ namespace basegfx
 		return aAbs;
 	}
 
-	inline B2DTuple interpolate(const B2I64Tuple& rOld1, const B2I64Tuple& rOld2, double t) 
+	inline B2I64Tuple 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()); 
-		return aInt;
-	}
-
-	inline B2DTuple average(const B2I64Tuple& rOld1, const B2I64Tuple& rOld2) 
-	{ 
-		B2DTuple aAvg(
-			(rOld1.getX() + rOld2.getX()) * 0.5,
-			(rOld1.getY() + rOld2.getY()) * 0.5); 
-		return aAvg;
+        if(rOld1 == rOld2)
+        {
+            return rOld1;
+        }
+        else if(0.0 >= t)
+        {
+            return rOld1;
+        }
+        else if(1.0 <= t)
+        {
+            return rOld2;
+        }
+        else
+        {
+            return B2I64Tuple(
+			    basegfx::fround64(((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX()),
+			    basegfx::fround64(((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY())); 
+        }
+	}
+
+	inline B2I64Tuple average(const B2I64Tuple& rOld1, const B2I64Tuple& rOld2) 
+	{ 
+        return B2I64Tuple(
+            rOld1.getX() == rOld2.getX() ? rOld1.getX() : basegfx::fround64((rOld1.getX() + rOld2.getX()) * 0.5),
+            rOld1.getY() == rOld2.getY() ? rOld1.getY() : basegfx::fround64((rOld1.getY() + rOld2.getY()) * 0.5)); 
 	}
 	
-	inline B2DTuple average(const B2I64Tuple& rOld1, const B2I64Tuple& rOld2, const B2I64Tuple& rOld3)
+	inline B2I64Tuple 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)); 
-		return aAvg;
+        return B2I64Tuple(
+            (rOld1.getX() == rOld2.getX() && rOld2.getX() == rOld3.getX()) ? rOld1.getX() : basegfx::fround64((rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0)),
+            (rOld1.getY() == rOld2.getY() && rOld2.getY() == rOld3.getY()) ? rOld1.getY() : basegfx::fround64((rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0))); 
 	}
 
 	inline B2I64Tuple operator+(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB)

Modified: incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b2ituple.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b2ituple.hxx?rev=1394141&r1=1394140&r2=1394141&view=diff
==============================================================================
--- incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b2ituple.hxx (original)
+++ incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b2ituple.hxx Thu Oct  4 16:27:22 2012
@@ -25,7 +25,10 @@
 #define _BGFX_TUPLE_B2ITUPLE_HXX
 
 #include <sal/types.h>
-
+#include <basegfx/numeric/ftools.hxx>
+#undef min
+#undef max
+#include <algorithm>
 
 namespace basegfx
 {
@@ -173,7 +176,10 @@ namespace basegfx
 			return B2ITuple(-mnX, -mnY); 
 		}
 		
-		bool equalZero() const { return mnX == 0 && mnY == 0; }
+		bool equalZero() const 
+        { 
+            return mnX == 0 && mnY == 0; 
+        }
 
 		bool operator==( const B2ITuple& rTup ) const 
 		{ 
@@ -198,36 +204,120 @@ namespace basegfx
 	// external operators
 	//////////////////////////////////////////////////////////////////////////
 
-    class B2DTuple;
-
-	B2ITuple minimum(const B2ITuple& rTupA, const B2ITuple& rTupB); 
-
-	B2ITuple maximum(const B2ITuple& rTupA, const B2ITuple& rTupB); 
-
-	B2ITuple absolute(const B2ITuple& rTup); 
-
-	B2DTuple interpolate(const B2ITuple& rOld1, const B2ITuple& rOld2, double t); 
-
-	B2DTuple average(const B2ITuple& rOld1, const B2ITuple& rOld2); 
+	inline B2ITuple minimum(const B2ITuple& rTupA, const B2ITuple& rTupB) 
+	{ 
+        return B2ITuple(
+            std::min(rTupB.getX(), rTupA.getX()),
+            std::min(rTupB.getY(), rTupA.getY())); 
+	}
+
+	inline B2ITuple maximum(const B2ITuple& rTupA, const B2ITuple& rTupB) 
+	{ 
+        return B2ITuple(
+            std::max(rTupB.getX(), rTupA.getX()),
+            std::max(rTupB.getY(), rTupA.getY())); 
+	}
+
+	inline B2ITuple absolute(const B2ITuple& rTup) 
+	{ 
+		B2ITuple aAbs(
+			(0 > rTup.getX()) ? -rTup.getX() : rTup.getX(),
+			(0 > rTup.getY()) ? -rTup.getY() : rTup.getY()); 
+		return aAbs;
+	}
+
+	inline B2ITuple interpolate(const B2ITuple& rOld1, const B2ITuple& rOld2, double t) 
+	{ 
+        if(rOld1 == rOld2)
+        {
+            return rOld1;
+        }
+        else if(0.0 >= t)
+        {
+            return rOld1;
+        }
+        else if(1.0 <= t)
+        {
+            return rOld2;
+        }
+        else
+        {
+		    return B2ITuple(
+			    basegfx::fround(((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX()),
+			    basegfx::fround(((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY())); 
+        }
+	}
+
+	inline B2ITuple average(const B2ITuple& rOld1, const B2ITuple& rOld2) 
+	{ 
+        return B2ITuple(
+            rOld1.getX() == rOld2.getX() ? rOld1.getX() : basegfx::fround((rOld1.getX() + rOld2.getX()) * 0.5),
+            rOld1.getY() == rOld2.getY() ? rOld1.getY() : basegfx::fround((rOld1.getY() + rOld2.getY()) * 0.5)); 
+	}
 	
-	B2DTuple average(const B2ITuple& rOld1, const B2ITuple& rOld2, const B2ITuple& rOld3);
-
-	B2ITuple operator+(const B2ITuple& rTupA, const B2ITuple& rTupB);
-
-	B2ITuple operator-(const B2ITuple& rTupA, const B2ITuple& rTupB);
-
-	B2ITuple operator/(const B2ITuple& rTupA, const B2ITuple& rTupB);
-
-	B2ITuple operator*(const B2ITuple& rTupA, const B2ITuple& rTupB);
-
-	B2ITuple operator*(const B2ITuple& rTup, sal_Int32 t);
-
-	B2ITuple operator*(sal_Int32 t, const B2ITuple& rTup);
-
-	B2ITuple operator/(const B2ITuple& rTup, sal_Int32 t);
-
-	B2ITuple operator/(sal_Int32 t, const B2ITuple& rTup);
+	inline B2ITuple average(const B2ITuple& rOld1, const B2ITuple& rOld2, const B2ITuple& rOld3)
+	{ 
+        return B2ITuple(
+            (rOld1.getX() == rOld2.getX() && rOld2.getX() == rOld3.getX()) ? rOld1.getX() : basegfx::fround((rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0)),
+            (rOld1.getY() == rOld2.getY() && rOld2.getY() == rOld3.getY()) ? rOld1.getY() : basegfx::fround((rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0))); 
+	}
+
+	inline B2ITuple operator+(const B2ITuple& rTupA, const B2ITuple& rTupB)
+	{ 
+		B2ITuple aSum(rTupA); 
+		aSum += rTupB; 
+		return aSum; 
+	}
+
+	inline B2ITuple operator-(const B2ITuple& rTupA, const B2ITuple& rTupB)
+	{ 
+		B2ITuple aSub(rTupA); 
+		aSub -= rTupB; 
+		return aSub; 
+	}
+
+	inline B2ITuple operator/(const B2ITuple& rTupA, const B2ITuple& rTupB)
+	{ 
+		B2ITuple aDiv(rTupA); 
+		aDiv /= rTupB; 
+		return aDiv; 
+	}
+
+	inline B2ITuple operator*(const B2ITuple& rTupA, const B2ITuple& rTupB)
+	{ 
+		B2ITuple aMul(rTupA); 
+		aMul *= rTupB; 
+		return aMul; 
+	}
+
+	inline B2ITuple operator*(const B2ITuple& rTup, sal_Int32 t)
+	{ 
+		B2ITuple aNew(rTup); 
+		aNew *= t; 
+		return aNew; 
+	}
+
+	inline B2ITuple operator*(sal_Int32 t, const B2ITuple& rTup)
+	{ 
+		B2ITuple aNew(rTup); 
+		aNew *= t; 
+		return aNew; 
+	}
+
+	inline B2ITuple operator/(const B2ITuple& rTup, sal_Int32 t)
+	{ 
+		B2ITuple aNew(rTup); 
+		aNew /= t; 
+		return aNew; 
+	}
 
+	inline B2ITuple operator/(sal_Int32 t, const B2ITuple& rTup)
+	{
+		B2ITuple aNew(t, t); 
+		B2ITuple aTmp(rTup); 
+		aNew /= aTmp; 
+		return aNew; 
+	}
 } // end of namespace basegfx
 
 #endif /* _BGFX_TUPLE_B2ITUPLE_HXX */

Modified: incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b3dtuple.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b3dtuple.hxx?rev=1394141&r1=1394140&r2=1394141&view=diff
==============================================================================
--- incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b3dtuple.hxx (original)
+++ incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b3dtuple.hxx Thu Oct  4 16:27:22 2012
@@ -26,6 +26,9 @@
 
 #include <sal/types.h>
 #include <basegfx/numeric/ftools.hxx>
+#undef min
+#undef max
+#include <algorithm>
 
 namespace basegfx
 {
@@ -311,56 +314,66 @@ namespace basegfx
 
 	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()); 
-		return aMin;
+        return B3DTuple(
+            std::min(rTupB.getX(), rTupA.getX()),
+            std::min(rTupB.getY(), rTupA.getY()),
+            std::min(rTupB.getZ(), rTupA.getZ())); 
 	}
 
 	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()); 
-		return aMax;
+        return B3DTuple(
+            std::max(rTupB.getX(), rTupA.getX()),
+            std::max(rTupB.getY(), rTupA.getY()),
+            std::max(rTupB.getZ(), rTupA.getZ())); 
 	}
 
 	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()); 
+            fabs(rTup.getX()),
+            fabs(rTup.getY()),
+            fabs(rTup.getZ())); 
 		return aAbs;
 	}
 
 	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()); 
-		return aInt;
+        if(rOld1 == rOld2)
+        {
+            return rOld1;
+        }
+        else if(0.0 >= t)
+        {
+            return rOld1;
+        }
+        else if(1.0 <= t)
+        {
+            return rOld2;
+        }
+        else
+        {
+            return B3DTuple(
+			    ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(),
+			    ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY(),
+			    ((rOld2.getZ() - rOld1.getZ()) * t) + rOld1.getZ()); 
+        }
 	}
 
 	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); 
-		return aAvg;
+        return B3DTuple(
+            rOld1.getX() == rOld2.getX() ? rOld1.getX() : (rOld1.getX() + rOld2.getX()) * 0.5,
+            rOld1.getY() == rOld2.getY() ? rOld1.getY() : (rOld1.getY() + rOld2.getY()) * 0.5,
+            rOld1.getZ() == rOld2.getZ() ? rOld1.getZ() : (rOld1.getZ() + rOld2.getZ()) * 0.5); 
 	}
 	
 	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)); 
-		return aAvg;
+        return B3DTuple(
+            (rOld1.getX() == rOld2.getX() && rOld2.getX() == rOld3.getX()) ? rOld1.getX() : (rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0),
+            (rOld1.getY() == rOld2.getY() && rOld2.getY() == rOld3.getY()) ? rOld1.getY() : (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0),
+            (rOld1.getZ() == rOld2.getZ() && rOld2.getZ() == rOld3.getZ()) ? rOld1.getZ() : (rOld1.getZ() + rOld2.getZ() + rOld3.getZ()) * (1.0 / 3.0)); 
 	}
 	
 	inline B3DTuple operator+(const B3DTuple& rTupA, const B3DTuple& rTupB)

Modified: incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b3i64tuple.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b3i64tuple.hxx?rev=1394141&r1=1394140&r2=1394141&view=diff
==============================================================================
--- incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b3i64tuple.hxx (original)
+++ incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b3i64tuple.hxx Thu Oct  4 16:27:22 2012
@@ -232,20 +232,18 @@ namespace basegfx
 
 	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()); 
-		return aMin;
+        return B3I64Tuple(
+            std::min(rTupB.getX(), rTupA.getX()),
+            std::min(rTupB.getY(), rTupA.getY()),
+            std::min(rTupB.getZ(), rTupA.getZ())); 
 	}
 
 	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()); 
-		return aMax;
+        return B3I64Tuple(
+            std::max(rTupB.getX(), rTupA.getX()),
+            std::max(rTupB.getY(), rTupA.getY()),
+            std::max(rTupB.getZ(), rTupA.getZ())); 
 	}
 
 	inline B3I64Tuple absolute(const B3I64Tuple& rTup) 
@@ -257,31 +255,43 @@ namespace basegfx
 		return aAbs;
 	}
 
-	inline B3DTuple interpolate(const B3I64Tuple& rOld1, const B3I64Tuple& rOld2, double t) 
+	inline B3I64Tuple 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()); 
-		return aInt;
-	}
-
-	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); 
-		return aAvg;
+        if(rOld1 == rOld2)
+        {
+            return rOld1;
+        }
+        else if(0.0 >= t)
+        {
+            return rOld1;
+        }
+        else if(1.0 <= t)
+        {
+            return rOld2;
+        }
+        else
+        {
+            return B3I64Tuple(
+			    basegfx::fround64(((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX()),
+			    basegfx::fround64(((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY()),
+			    basegfx::fround64(((rOld2.getZ() - rOld1.getZ()) * t) + rOld1.getZ())); 
+        }
+	}
+
+	inline B3I64Tuple average(const B3I64Tuple& rOld1, const B3I64Tuple& rOld2) 
+	{ 
+        return B3I64Tuple(
+            rOld1.getX() == rOld2.getX() ? rOld1.getX() : basegfx::fround64((rOld1.getX() + rOld2.getX()) * 0.5),
+            rOld1.getY() == rOld2.getY() ? rOld1.getY() : basegfx::fround64((rOld1.getY() + rOld2.getY()) * 0.5),
+            rOld1.getZ() == rOld2.getZ() ? rOld1.getZ() : basegfx::fround64((rOld1.getZ() + rOld2.getZ()) * 0.5)); 
 	}
 	
-	inline B3DTuple average(const B3I64Tuple& rOld1, const B3I64Tuple& rOld2, const B3I64Tuple& rOld3)
+	inline B3I64Tuple 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)); 
-		return aAvg;
+        return B3I64Tuple(
+            (rOld1.getX() == rOld2.getX() && rOld2.getX() == rOld3.getX()) ? rOld1.getX() : basegfx::fround64((rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0)),
+            (rOld1.getY() == rOld2.getY() && rOld2.getY() == rOld3.getY()) ? rOld1.getY() : basegfx::fround64((rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0)),
+            (rOld1.getZ() == rOld2.getZ() && rOld2.getZ() == rOld3.getZ()) ? rOld1.getZ() : basegfx::fround64((rOld1.getZ() + rOld2.getZ() + rOld3.getZ()) * (1.0 / 3.0))); 
 	}
 	
 	inline B3I64Tuple operator+(const B3I64Tuple& rTupA, const B3I64Tuple& rTupB)

Modified: incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b3ituple.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b3ituple.hxx?rev=1394141&r1=1394140&r2=1394141&view=diff
==============================================================================
--- incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b3ituple.hxx (original)
+++ incubator/ooo/trunk/main/basegfx/inc/basegfx/tuple/b3ituple.hxx Thu Oct  4 16:27:22 2012
@@ -232,20 +232,18 @@ namespace basegfx
 
 	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()); 
-		return aMin;
+        return B3ITuple(
+            std::min(rTupB.getX(), rTupA.getX()),
+            std::min(rTupB.getY(), rTupA.getY()),
+            std::min(rTupB.getZ(), rTupA.getZ())); 
 	}
 
 	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()); 
-		return aMax;
+        return B3ITuple(
+            std::max(rTupB.getX(), rTupA.getX()),
+            std::max(rTupB.getY(), rTupA.getY()),
+            std::max(rTupB.getZ(), rTupA.getZ())); 
 	}
 
 	inline B3ITuple absolute(const B3ITuple& rTup) 
@@ -257,31 +255,43 @@ namespace basegfx
 		return aAbs;
 	}
 
-	inline B3DTuple interpolate(const B3ITuple& rOld1, const B3ITuple& rOld2, double t) 
+	inline B3ITuple 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()); 
-		return aInt;
-	}
-
-	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); 
-		return aAvg;
+        if(rOld1 == rOld2)
+        {
+            return rOld1;
+        }
+        else if(0.0 >= t)
+        {
+            return rOld1;
+        }
+        else if(1.0 <= t)
+        {
+            return rOld2;
+        }
+        else
+        {
+            return B3ITuple(
+			    basegfx::fround(((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX()),
+			    basegfx::fround(((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY()),
+			    basegfx::fround(((rOld2.getZ() - rOld1.getZ()) * t) + rOld1.getZ())); 
+        }
+	}
+
+	inline B3ITuple average(const B3ITuple& rOld1, const B3ITuple& rOld2) 
+	{ 
+        return B3ITuple(
+            rOld1.getX() == rOld2.getX() ? rOld1.getX() : basegfx::fround((rOld1.getX() + rOld2.getX()) * 0.5),
+            rOld1.getY() == rOld2.getY() ? rOld1.getY() : basegfx::fround((rOld1.getY() + rOld2.getY()) * 0.5),
+            rOld1.getZ() == rOld2.getZ() ? rOld1.getZ() : basegfx::fround((rOld1.getZ() + rOld2.getZ()) * 0.5)); 
 	}
 	
-	inline B3DTuple average(const B3ITuple& rOld1, const B3ITuple& rOld2, const B3ITuple& rOld3)
+	inline B3ITuple 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)); 
-		return aAvg;
+        return B3ITuple(
+            (rOld1.getX() == rOld2.getX() && rOld2.getX() == rOld3.getX()) ? rOld1.getX() : basegfx::fround((rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0)),
+            (rOld1.getY() == rOld2.getY() && rOld2.getY() == rOld3.getY()) ? rOld1.getX() : basegfx::fround((rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0)),
+            (rOld1.getZ() == rOld2.getZ() && rOld2.getZ() == rOld3.getZ()) ? rOld1.getX() : basegfx::fround((rOld1.getZ() + rOld2.getZ() + rOld3.getZ()) * (1.0 / 3.0))); 
 	}
 	
 	inline B3ITuple operator+(const B3ITuple& rTupA, const B3ITuple& rTupB)

Modified: incubator/ooo/trunk/main/basegfx/source/point/b2dhompoint.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/basegfx/source/point/b2dhompoint.cxx?rev=1394141&r1=1394140&r2=1394141&view=diff
==============================================================================
--- incubator/ooo/trunk/main/basegfx/source/point/b2dhompoint.cxx (original)
+++ incubator/ooo/trunk/main/basegfx/source/point/b2dhompoint.cxx Thu Oct  4 16:27:22 2012
@@ -29,12 +29,6 @@
 
 namespace basegfx
 {
-	bool B2DHomPoint::implIsHomogenized() const 
-	{ 
-		const double fOne(1.0);
-		return ::basegfx::fTools::equal(fOne, mfW); 
-	}
-
 	void B2DHomPoint::implHomogenize()
 	{
 		const double fFactor(1.0 / mfW);
@@ -43,68 +37,6 @@ namespace basegfx
 		mfW = 1.0;
 	}
 
-	void B2DHomPoint::implTestAndHomogenize() const
-	{
-		if(!implIsHomogenized())
-			((B2DHomPoint*)this)->implHomogenize();
-	}
-
-	B2DPoint B2DHomPoint::getB2DPoint() const
-	{
-		implTestAndHomogenize();
-		return B2DPoint(maTuple.getX(), maTuple.getY());
-	}
-
-	double B2DHomPoint::getX() const
-	{ 
-		implTestAndHomogenize();
-		return maTuple.getX(); 
-	}
-
-	double B2DHomPoint::getY() const
-	{ 
-		implTestAndHomogenize();
-		return maTuple.getY(); 
-	}
-
-	void B2DHomPoint::setX(double fX)
-	{
-		maTuple.setX(implIsHomogenized() ? fX : fX * mfW );
-	}
-
-	void B2DHomPoint::setY(double fY)
-	{
-		maTuple.setY(implIsHomogenized() ? fY : fY * mfW );
-	}
-
-	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;
-
-		return *this;
-	}
-
-	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;
-
-		return *this;
-	}
-
-	B2DHomPoint& B2DHomPoint::operator*=(double t) 
-	{ 
-		if(!::basegfx::fTools::equalZero(t))
-		{
-			mfW /= t;
-		}
-
-		return *this; 
-	}
-
 	B2DHomPoint& B2DHomPoint::operator*=( const B2DHomMatrix& rMat )
 	{
 		const double fTempX( rMat.get(0,0)*maTuple.getX() +
@@ -124,132 +56,6 @@ namespace basegfx
 
 		return *this;
 	}
-
-	B2DHomPoint& B2DHomPoint::operator/=(double t) 
-	{ 
-		mfW *= t;
-		return *this; 
-	}
-
-	B2DHomPoint& B2DHomPoint::operator-(void)
-	{	
-		mfW = -mfW;
-		return *this;
-	}
-
-	bool B2DHomPoint::operator==( const B2DHomPoint& rPnt ) const 
-	{ 
-		implTestAndHomogenize();
-		return (maTuple == rPnt.maTuple);
-	}
-
-	bool B2DHomPoint::operator!=( const B2DHomPoint& rPnt ) const 
-	{ 
-		implTestAndHomogenize();
-		return (maTuple != rPnt.maTuple);
-	}
-
-	B2DHomPoint& B2DHomPoint::operator=( const B2DHomPoint& rPnt ) 
-	{ 
-		maTuple = rPnt.maTuple;
-		mfW = rPnt.mfW;
-		return *this; 
-	}
-
-	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()); 
-		return aMin;
-	}
-
-	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()); 
-		return aMax;
-	}
-	B2DHomPoint absolute(const B2DHomPoint& rVec) 
-	{ 
-		B2DHomPoint aAbs(
-			(0.0 > rVec.getX()) ? -rVec.getX() : rVec.getX(),
-			(0.0 > rVec.getY()) ? -rVec.getY() : rVec.getY()); 
-		return aAbs;
-	}
-
-	B2DHomPoint interpolate(B2DHomPoint& rOld1, B2DHomPoint& rOld2, double t) 
-	{ 
-		B2DHomPoint aInt(
-			((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(),
-			((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY()); 
-		return aInt;
-	}
-
-	B2DHomPoint average(B2DHomPoint& rOld1, B2DHomPoint& rOld2) 
-	{ 
-		B2DHomPoint aAvg(
-			(rOld1.getX() + rOld2.getX()) * 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)); 
-		return aAvg;
-	}
-
-	B2DHomPoint operator+(const B2DHomPoint& rVecA, const B2DHomPoint& rVecB)
-	{ 
-		B2DHomPoint aSum(rVecA); 
-		aSum += rVecB; 
-		return aSum; 
-	}
-
-	B2DHomPoint operator-(const B2DHomPoint& rVecA, const B2DHomPoint& rVecB)
-	{ 
-		B2DHomPoint aSub(rVecA); 
-		aSub -= rVecB; 
-		return aSub; 
-	}
-
-	B2DHomPoint operator*(const B2DHomPoint& rVec, double t)
-	{ 
-		B2DHomPoint aNew(rVec); 
-		aNew *= t; 
-		return aNew; 
-	}
-
-	B2DHomPoint operator*(double t, const B2DHomPoint& rVec)
-	{ 
-		B2DHomPoint aNew(rVec); 
-		aNew *= t; 
-		return aNew; 
-	}
-
-	B2DHomPoint operator*( const B2DHomMatrix& rMat, const B2DHomPoint& rPoint )
-	{
-		B2DHomPoint aNew(rPoint); 
-		return aNew*=rMat;
-	}
-
-	B2DHomPoint operator/(const B2DHomPoint& rVec, double t)
-	{ 
-		B2DHomPoint aNew(rVec); 
-		aNew /= t; 
-		return aNew; 
-	}
-
-	B2DHomPoint operator/(double t, const B2DHomPoint& rVec)
-	{
-		B2DHomPoint aNew(rVec); 
-		aNew /= t; 
-		return aNew; 
-	}
 } // end of namespace basegfx
 
 // eof

Modified: incubator/ooo/trunk/main/basegfx/source/tools/gradienttools.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/basegfx/source/tools/gradienttools.cxx?rev=1394141&r1=1394140&r2=1394141&view=diff
==============================================================================
--- incubator/ooo/trunk/main/basegfx/source/tools/gradienttools.cxx (original)
+++ incubator/ooo/trunk/main/basegfx/source/tools/gradienttools.cxx Thu Oct  4 16:27:22 2012
@@ -362,19 +362,20 @@ namespace basegfx
         {
             const B2DPoint aCoor(rGradInfo.getBackTextureTransform() * rUV);
 
-            if(aCoor.getX() < 0.0 || aCoor.getX() > 1.0)
-            {
-                return 0.0;
-            }
+            // Ignore Y, this is not needed at all for Y-Oriented gradients
+            // if(aCoor.getX() < 0.0 || aCoor.getX() > 1.0)
+            // {
+            //     return 0.0;
+            // }
 
             if(aCoor.getY() <= 0.0)
             {
-                return 0.0;
+                return 0.0; // start value for inside
             }
 
             if(aCoor.getY() >= 1.0)
             {
-                return 1.0;
+                return 1.0; // end value for outside
             }
 
             const sal_uInt32 nSteps(rGradInfo.getSteps());
@@ -391,16 +392,17 @@ namespace basegfx
         {
             const B2DPoint aCoor(rGradInfo.getBackTextureTransform() * rUV);
 
-            if(aCoor.getX() < 0.0 || aCoor.getX() > 1.0)
-            {
-                return 0.0;
-            }
+            // Ignore Y, this is not needed at all for Y-Oriented gradients
+            //if(aCoor.getX() < 0.0 || aCoor.getX() > 1.0)
+            //{
+            //    return 0.0;
+            //}
 
             const double fAbsY(fabs(aCoor.getY()));
 
             if(fAbsY >= 1.0)
             {
-                return 0.0;
+                return 1.0; // use end value when outside in Y
             }
 
             const sal_uInt32 nSteps(rGradInfo.getSteps());

Modified: incubator/ooo/trunk/main/basegfx/source/tuple/b2ituple.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/basegfx/source/tuple/b2ituple.cxx?rev=1394141&r1=1394140&r2=1394141&view=diff
==============================================================================
--- incubator/ooo/trunk/main/basegfx/source/tuple/b2ituple.cxx (original)
+++ incubator/ooo/trunk/main/basegfx/source/tuple/b2ituple.cxx Thu Oct  4 16:27:22 2012
@@ -33,117 +33,12 @@ namespace basegfx
 {
     const B2ITuple& B2ITuple::getEmptyTuple()
     {
-            return EmptyTuple::get();
+        return EmptyTuple::get();
     }
 
 	// external operators
 	//////////////////////////////////////////////////////////////////////////
 
-	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()); 
-		return aMin;
-	}
-
-	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()); 
-		return aMax;
-	}
-
-	B2ITuple absolute(const B2ITuple& rTup) 
-	{ 
-		B2ITuple aAbs(
-			(0 > rTup.getX()) ? -rTup.getX() : rTup.getX(),
-			(0 > rTup.getY()) ? -rTup.getY() : rTup.getY()); 
-		return aAbs;
-	}
-
-	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()); 
-		return aInt;
-	}
-
-	B2DTuple average(const B2ITuple& rOld1, const B2ITuple& rOld2) 
-	{ 
-		B2DTuple aAvg(
-			(rOld1.getX() + rOld2.getX()) * 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)); 
-		return aAvg;
-	}
-
-	B2ITuple operator+(const B2ITuple& rTupA, const B2ITuple& rTupB)
-	{ 
-		B2ITuple aSum(rTupA); 
-		aSum += rTupB; 
-		return aSum; 
-	}
-
-	B2ITuple operator-(const B2ITuple& rTupA, const B2ITuple& rTupB)
-	{ 
-		B2ITuple aSub(rTupA); 
-		aSub -= rTupB; 
-		return aSub; 
-	}
-
-	B2ITuple operator/(const B2ITuple& rTupA, const B2ITuple& rTupB)
-	{ 
-		B2ITuple aDiv(rTupA); 
-		aDiv /= rTupB; 
-		return aDiv; 
-	}
-
-	B2ITuple operator*(const B2ITuple& rTupA, const B2ITuple& rTupB)
-	{ 
-		B2ITuple aMul(rTupA); 
-		aMul *= rTupB; 
-		return aMul; 
-	}
-
-	B2ITuple operator*(const B2ITuple& rTup, sal_Int32 t)
-	{ 
-		B2ITuple aNew(rTup); 
-		aNew *= t; 
-		return aNew; 
-	}
-
-	B2ITuple operator*(sal_Int32 t, const B2ITuple& rTup)
-	{ 
-		B2ITuple aNew(rTup); 
-		aNew *= t; 
-		return aNew; 
-	}
-
-	B2ITuple operator/(const B2ITuple& rTup, sal_Int32 t)
-	{ 
-		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; 
-	}
-
 } // end of namespace basegfx
 
 // eof

Modified: incubator/ooo/trunk/main/drawinglayer/source/texture/texture.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/drawinglayer/source/texture/texture.cxx?rev=1394141&r1=1394140&r2=1394141&view=diff
==============================================================================
--- incubator/ooo/trunk/main/drawinglayer/source/texture/texture.cxx (original)
+++ incubator/ooo/trunk/main/drawinglayer/source/texture/texture.cxx Thu Oct  4 16:27:22 2012
@@ -164,7 +164,7 @@ namespace drawinglayer
 		{
             const double fScaler(basegfx::tools::getLinearGradientAlpha(rUV, maGradientInfo));
 
-			rBColor = (maStart * (1.0 - fScaler)) + (maEnd * fScaler);
+            rBColor = basegfx::interpolate(maStart, maEnd, fScaler);
 		}
 	} // end of namespace texture
 } // end of namespace drawinglayer
@@ -227,7 +227,7 @@ namespace drawinglayer
 		{
             const double fScaler(basegfx::tools::getAxialGradientAlpha(rUV, maGradientInfo));
 
-			rBColor = (maStart * (1.0 - fScaler)) + (maEnd * fScaler);
+            rBColor = basegfx::interpolate(maStart, maEnd, fScaler);
 		}
 	} // end of namespace texture
 } // end of namespace drawinglayer
@@ -284,7 +284,7 @@ namespace drawinglayer
 		{
             const double fScaler(basegfx::tools::getRadialGradientAlpha(rUV, maGradientInfo));
 
-			rBColor = (maStart * (1.0 - fScaler)) + (maEnd * fScaler);
+            rBColor = basegfx::interpolate(maStart, maEnd, fScaler);
 		}
 	} // end of namespace texture
 } // end of namespace drawinglayer
@@ -361,7 +361,7 @@ namespace drawinglayer
 		{
             const double fScaler(basegfx::tools::getEllipticalGradientAlpha(rUV, maGradientInfo));
 
-			rBColor = (maStart * (1.0 - fScaler)) + (maEnd * fScaler);
+            rBColor = basegfx::interpolate(maStart, maEnd, fScaler);
 		}
 	} // end of namespace texture
 } // end of namespace drawinglayer
@@ -420,7 +420,7 @@ namespace drawinglayer
 		{
             const double fScaler(basegfx::tools::getSquareGradientAlpha(rUV, maGradientInfo));
 
-			rBColor = (maStart * (1.0 - fScaler)) + (maEnd * fScaler);
+            rBColor = basegfx::interpolate(maStart, maEnd, fScaler);
 		}
 	} // end of namespace texture
 } // end of namespace drawinglayer
@@ -497,7 +497,7 @@ namespace drawinglayer
 		{
             const double fScaler(basegfx::tools::getRectangularGradientAlpha(rUV, maGradientInfo));
 
-			rBColor = (maStart * (1.0 - fScaler)) + (maEnd * fScaler);
+            rBColor = basegfx::interpolate(maStart, maEnd, fScaler);
 		}
 	} // end of namespace texture
 } // end of namespace drawinglayer



Mime
View raw message