You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ar...@apache.org on 2012/10/12 23:29:49 UTC
svn commit: r1397728 [5/10] - in /incubator/ooo/branches/buildsys: ./
ext_sources/ extras/l10n/source/da/ extras/l10n/source/gd/
extras/l10n/source/pl/ main/ main/basctl/source/basicide/
main/basegfx/inc/basegfx/pixel/ main/basegfx/inc/basegfx/point/ m...
Modified: incubator/ooo/branches/buildsys/main/basctl/source/basicide/baside2b.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/basctl/source/basicide/baside2b.cxx?rev=1397728&r1=1397727&r2=1397728&view=diff
==============================================================================
--- incubator/ooo/branches/buildsys/main/basctl/source/basicide/baside2b.cxx (original)
+++ incubator/ooo/branches/buildsys/main/basctl/source/basicide/baside2b.cxx Fri Oct 12 21:29:36 2012
@@ -356,7 +356,11 @@ void __EXPORT EditorWindow::MouseButtonU
pEditView->MouseButtonUp( rEvt );
SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
if ( pBindings )
+ {
+ pBindings->Invalidate( SID_COPY );
+ pBindings->Invalidate( SID_CUT );
pBindings->Invalidate( SID_BASICIDE_STAT_POS );
+ }
}
}
@@ -454,15 +458,20 @@ void __EXPORT EditorWindow::KeyInput( co
SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
if ( pBindings )
{
+ pBindings->Invalidate( SID_CUT );
+ pBindings->Invalidate( SID_COPY );
pBindings->Invalidate( SID_BASICIDE_STAT_POS );
+
if ( rKEvt.GetKeyCode().GetGroup() == KEYGROUP_CURSOR )
pBindings->Update( SID_BASICIDE_STAT_POS );
+
if ( !bWasModified && pEditEngine->IsModified() )
{
pBindings->Invalidate( SID_SAVEDOC );
pBindings->Invalidate( SID_DOC_MODIFIED );
pBindings->Invalidate( SID_UNDO );
}
+
if ( rKEvt.GetKeyCode().GetCode() == KEY_INSERT )
pBindings->Invalidate( SID_ATTR_INSERT );
}
Modified: incubator/ooo/branches/buildsys/main/basctl/source/basicide/baside3.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/basctl/source/basicide/baside3.cxx?rev=1397728&r1=1397727&r2=1397728&view=diff
==============================================================================
--- incubator/ooo/branches/buildsys/main/basctl/source/basicide/baside3.cxx (original)
+++ incubator/ooo/branches/buildsys/main/basctl/source/basicide/baside3.cxx Fri Oct 12 21:29:36 2012
@@ -188,6 +188,8 @@ void DialogWindow::MouseButtonUp( const
pBindings->Invalidate( SID_SHOW_PROPERTYBROWSER );
pBindings->Invalidate( SID_DOC_MODIFIED );
pBindings->Invalidate( SID_SAVEDOC );
+ pBindings->Invalidate( SID_COPY );
+ pBindings->Invalidate( SID_CUT );
}
}
@@ -202,6 +204,8 @@ void DialogWindow::MouseMove( const Mous
void DialogWindow::KeyInput( const KeyEvent& rKEvt )
{
+ SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
+
if( rKEvt.GetKeyCode() == KEY_BACKSPACE )
{
BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
@@ -214,9 +218,8 @@ void DialogWindow::KeyInput( const KeyEv
}
else
{
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
if( pBindings && rKEvt.GetKeyCode() == KEY_TAB )
- pBindings->Invalidate( SID_SHOW_PROPERTYBROWSER );
+ pBindings->Invalidate( SID_SHOW_PROPERTYBROWSER );
if( !pEditor->KeyInput( rKEvt ) )
{
@@ -224,6 +227,13 @@ void DialogWindow::KeyInput( const KeyEv
Window::KeyInput( rKEvt );
}
}
+
+ // may be KEY_TAB, KEY_BACKSPACE, KEY_ESCAPE
+ if( pBindings )
+ {
+ pBindings->Invalidate( SID_COPY );
+ pBindings->Invalidate( SID_CUT );
+ }
}
void DialogWindow::Command( const CommandEvent& rCEvt )
Modified: incubator/ooo/branches/buildsys/main/basctl/source/basicide/basidesh.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/basctl/source/basicide/basidesh.cxx?rev=1397728&r1=1397727&r2=1397728&view=diff
==============================================================================
--- incubator/ooo/branches/buildsys/main/basctl/source/basicide/basidesh.cxx (original)
+++ incubator/ooo/branches/buildsys/main/basctl/source/basicide/basidesh.cxx Fri Oct 12 21:29:36 2012
@@ -947,6 +947,9 @@ void BasicIDEShell::InvalidateBasicIDESl
SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
if ( pBindings )
{
+ pBindings->Invalidate( SID_COPY );
+ pBindings->Invalidate( SID_CUT );
+ pBindings->Invalidate( SID_PASTE );
pBindings->Invalidate( SID_UNDO );
pBindings->Invalidate( SID_REDO );
pBindings->Invalidate( SID_SAVEDOC );
Modified: incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/pixel/bpixel.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/pixel/bpixel.hxx?rev=1397728&r1=1397727&r2=1397728&view=diff
==============================================================================
--- incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/pixel/bpixel.hxx (original)
+++ incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/pixel/bpixel.hxx Fri Oct 12 21:29:36 2012
@@ -139,22 +139,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)
@@ -175,7 +173,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),
@@ -185,34 +184,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/branches/buildsys/main/basegfx/inc/basegfx/point/b2dhompoint.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/point/b2dhompoint.hxx?rev=1397728&r1=1397727&r2=1397728&view=diff
==============================================================================
--- incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/point/b2dhompoint.hxx (original)
+++ incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/point/b2dhompoint.hxx Fri Oct 12 21:29:36 2012
@@ -25,7 +25,6 @@
#define _BGFX_POINT_B2DHOMPOINT_HXX
#include <basegfx/point/b2dpoint.hxx>
-#include <basegfx/basegfxdllapi.h>
namespace basegfx
{
@@ -42,20 +41,24 @@ namespace basegfx
@see B2DTuple
*/
- class BASEGFX_DLLPUBLIC B2DHomPoint
+ class B2DHomPoint
{
protected:
/// This member contains the coordinate part of the point
::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
@@ -75,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
@@ -135,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
@@ -145,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
@@ -155,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.
@@ -165,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.
@@ -175,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
//////////////////////////////////////////////////////////////////////////
- BASEGFX_DLLPUBLIC B2DHomPoint minimum(const B2DHomPoint& rVecA, const B2DHomPoint& rVecB);
-
- BASEGFX_DLLPUBLIC B2DHomPoint maximum(const B2DHomPoint& rVecA, const B2DHomPoint& rVecB);
-
- BASEGFX_DLLPUBLIC B2DHomPoint absolute(const B2DHomPoint& rVec);
-
- BASEGFX_DLLPUBLIC B2DHomPoint interpolate(B2DHomPoint& rOld1, B2DHomPoint& rOld2, double t);
-
- BASEGFX_DLLPUBLIC 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);
+ }
- BASEGFX_DLLPUBLIC B2DHomPoint average(B2DHomPoint& rOld1, B2DHomPoint& rOld2, B2DHomPoint& rOld3);
+ 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;
+ }
- BASEGFX_DLLPUBLIC B2DHomPoint operator+(const B2DHomPoint& rVecA, const B2DHomPoint& rVecB);
-
- BASEGFX_DLLPUBLIC B2DHomPoint operator-(const B2DHomPoint& rVecA, const B2DHomPoint& rVecB);
-
- BASEGFX_DLLPUBLIC B2DHomPoint operator*(const B2DHomPoint& rVec, double t);
-
- BASEGFX_DLLPUBLIC B2DHomPoint operator*(double t, const B2DHomPoint& rVec);
-
- BASEGFX_DLLPUBLIC B2DHomPoint operator*( const B2DHomMatrix& rMat, const B2DHomPoint& rPoint );
-
- BASEGFX_DLLPUBLIC B2DHomPoint operator/(const B2DHomPoint& rVec, double t);
+ 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;
+ }
- BASEGFX_DLLPUBLIC B2DHomPoint operator/(double t, const B2DHomPoint& rVec);
+ 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/branches/buildsys/main/basegfx/inc/basegfx/point/b3dhompoint.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/point/b3dhompoint.hxx?rev=1397728&r1=1397727&r2=1397728&view=diff
==============================================================================
--- incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/point/b3dhompoint.hxx (original)
+++ incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/point/b3dhompoint.hxx Fri Oct 12 21:29:36 2012
@@ -304,56 +304,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/branches/buildsys/main/basegfx/inc/basegfx/raster/rasterconvert3d.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/raster/rasterconvert3d.hxx?rev=1397728&r1=1397727&r2=1397728&view=diff
==============================================================================
--- incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/raster/rasterconvert3d.hxx (original)
+++ incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/raster/rasterconvert3d.hxx Fri Oct 12 21:29:36 2012
@@ -145,42 +145,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/branches/buildsys/main/basegfx/inc/basegfx/tools/gradienttools.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/tools/gradienttools.hxx?rev=1397728&r1=1397727&r2=1397728&view=diff
==============================================================================
--- incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/tools/gradienttools.hxx (original)
+++ incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/tools/gradienttools.hxx Fri Oct 12 21:29:36 2012
@@ -29,7 +29,6 @@
#include <basegfx/vector/b2dvector.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/numeric/ftools.hxx>
-#include <basegfx/basegfxdllapi.h>
#include <vector>
#include <algorithm>
@@ -42,12 +41,13 @@ namespace basegfx
1.2-compatible gradients. Use the createXXXODFGradientInfo()
methods below for initializing from ODF attributes.
*/
- struct BASEGFX_DLLPUBLIC ODFGradientInfo
+ class ODFGradientInfo
{
+ private:
/** transformation mapping from [0,1]^2 texture coordinate
space to [0,1]^2 shape coordinate space
*/
- B2DHomMatrix maTextureTransform;
+ B2DHomMatrix maTextureTransform;
/** transformation mapping from [0,1]^2 shape coordinate space
to [0,1]^2 texture coordinate space. This is the
@@ -55,20 +55,72 @@ namespace basegfx
scanline rasterizer (put shape u/v coordinates into it, get
texture s/t coordinates out of it)
*/
- B2DHomMatrix maBackTextureTransform;
+ B2DHomMatrix maBackTextureTransform;
/** Aspect ratio of the gradient. Only used in drawinglayer
for generating nested gradient polygons currently. Already
catered for in the transformations above.
*/
- double mfAspectRatio;
+ double mfAspectRatio;
/** Requested gradient steps to render. See the
implementations of the getXXXGradientAlpha() methods below,
the semantic differs slightly for the different gradient
types.
*/
- sal_uInt32 mnSteps;
+ sal_uInt32 mnSteps;
+
+ public:
+ ODFGradientInfo()
+ : maTextureTransform(),
+ maBackTextureTransform(),
+ mfAspectRatio(1.0),
+ mnSteps(0)
+ {
+ }
+
+ ODFGradientInfo(
+ const B2DHomMatrix& rTextureTransform,
+ double fAspectRatio,
+ sal_uInt32 nSteps)
+ : maTextureTransform(rTextureTransform),
+ maBackTextureTransform(),
+ mfAspectRatio(fAspectRatio),
+ mnSteps(nSteps)
+ {
+ }
+
+ ODFGradientInfo(const ODFGradientInfo& rODFGradientInfo)
+ : maTextureTransform(rODFGradientInfo.getTextureTransform()),
+ maBackTextureTransform(rODFGradientInfo.maBackTextureTransform),
+ mfAspectRatio(rODFGradientInfo.getAspectRatio()),
+ mnSteps(rODFGradientInfo.getSteps())
+ {
+ }
+
+ ODFGradientInfo& operator=(const ODFGradientInfo& rODFGradientInfo)
+ {
+ maTextureTransform = rODFGradientInfo.getTextureTransform();
+ maBackTextureTransform = rODFGradientInfo.maBackTextureTransform;
+ mfAspectRatio = rODFGradientInfo.getAspectRatio();
+ mnSteps = rODFGradientInfo.getSteps();
+
+ return *this;
+ }
+
+ // compare operator
+ bool operator==(const ODFGradientInfo& rGeoTexSvx) const;
+
+ const B2DHomMatrix& getTextureTransform() const { return maTextureTransform; }
+ const B2DHomMatrix& getBackTextureTransform() const;
+ double getAspectRatio() const { return mfAspectRatio; }
+ sal_uInt32 getSteps() const { return mnSteps; }
+
+ void setTextureTransform(const B2DHomMatrix& rNew)
+ {
+ maTextureTransform = rNew;
+ maBackTextureTransform.identity();
+ }
};
namespace tools
@@ -94,12 +146,12 @@ namespace basegfx
@param fAngle
Gradient angle (from ODF)
*/
- BASEGFX_DLLPUBLIC ODFGradientInfo& createLinearODFGradientInfo(ODFGradientInfo& o_rGradientInfo,
- const B2DRange& rTargetArea,
- sal_uInt32 nSteps,
- double fBorder,
- double fAngle);
-
+ ODFGradientInfo createLinearODFGradientInfo(
+ const B2DRange& rTargetArea,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fAngle);
+
/** Calculate linear gradient blend value
This method generates you the lerp alpha value for
@@ -113,18 +165,7 @@ namespace basegfx
@param rGradInfo
Gradient info, for transformation and number of steps
*/
- inline double getLinearGradientAlpha(const B2DPoint& rUV,
- const ODFGradientInfo& rGradInfo )
- {
- const B2DPoint aCoor(rGradInfo.maBackTextureTransform * rUV);
- const double t(clamp(aCoor.getY(), 0.0, 1.0));
- const sal_uInt32 nSteps(rGradInfo.mnSteps);
-
- if(nSteps > 2L && nSteps < 128L)
- return floor(t * nSteps) / double(nSteps + 1L);
-
- return t;
- }
+ double getLinearGradientAlpha(const B2DPoint& rUV, const ODFGradientInfo& rGradInfo);
/** Create matrix for ODF's axial gradient definition
@@ -153,11 +194,11 @@ namespace basegfx
@param fAngle
Gradient angle (from ODF)
*/
- BASEGFX_DLLPUBLIC ODFGradientInfo& createAxialODFGradientInfo(ODFGradientInfo& o_rGradientInfo,
- const B2DRange& rTargetArea,
- sal_uInt32 nSteps,
- double fBorder,
- double fAngle);
+ ODFGradientInfo createAxialODFGradientInfo(
+ const B2DRange& rTargetArea,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fAngle);
/** Calculate axial gradient blend value
@@ -172,20 +213,8 @@ namespace basegfx
@param rGradInfo
Gradient info, for transformation and number of steps
*/
- inline double getAxialGradientAlpha(const B2DPoint& rUV,
- const ODFGradientInfo& rGradInfo )
- {
- const B2DPoint aCoor(rGradInfo.maBackTextureTransform * rUV);
- const double t(clamp(fabs(aCoor.getY()), 0.0, 1.0));
- const sal_uInt32 nSteps(rGradInfo.mnSteps);
- const double fInternalSteps((nSteps * 2L) - 1L);
-
- if(nSteps > 2L && nSteps < 128L)
- return floor(((t * fInternalSteps) + 1.0) / 2.0) / double(nSteps - 1L);
+ double getAxialGradientAlpha(const B2DPoint& rUV, const ODFGradientInfo& rGradInfo);
- return t;
- }
-
/** Create matrix for ODF's radial gradient definition
@param o_rGradientInfo
@@ -208,11 +237,11 @@ namespace basegfx
@param fAngle
Gradient angle (from ODF)
*/
- BASEGFX_DLLPUBLIC ODFGradientInfo& createRadialODFGradientInfo(ODFGradientInfo& o_rGradientInfo,
- const B2DRange& rTargetArea,
- const B2DVector& rOffset,
- sal_uInt32 nSteps,
- double fBorder);
+ ODFGradientInfo createRadialODFGradientInfo(
+ const B2DRange& rTargetArea,
+ const B2DVector& rOffset,
+ sal_uInt32 nSteps,
+ double fBorder);
/** Calculate radial gradient blend value
@@ -227,23 +256,7 @@ namespace basegfx
@param rGradInfo
Gradient info, for transformation and number of steps
*/
- inline double getRadialGradientAlpha(const B2DPoint& rUV,
- const ODFGradientInfo& rGradInfo )
- {
- const B2DPoint aCoor(rGradInfo.maBackTextureTransform * rUV);
- const double fDist(
- clamp(aCoor.getX() * aCoor.getX() + aCoor.getY() * aCoor.getY(),
- 0.0,
- 1.0));
-
- const double t(1.0 - sqrt(fDist));
- const sal_uInt32 nSteps(rGradInfo.mnSteps);
-
- if(nSteps > 2L && nSteps < 128L)
- return floor(t * nSteps) / double(nSteps - 1L);
-
- return t;
- }
+ double getRadialGradientAlpha(const B2DPoint& rUV, const ODFGradientInfo& rGradInfo);
/** Create matrix for ODF's elliptical gradient definition
@@ -267,12 +280,12 @@ namespace basegfx
@param fAngle
Gradient angle (from ODF)
*/
- BASEGFX_DLLPUBLIC ODFGradientInfo& createEllipticalODFGradientInfo(ODFGradientInfo& o_rGradientInfo,
- const B2DRange& rTargetArea,
- const B2DVector& rOffset,
- sal_uInt32 nSteps,
- double fBorder,
- double fAngle);
+ ODFGradientInfo createEllipticalODFGradientInfo(
+ const B2DRange& rTargetArea,
+ const B2DVector& rOffset,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fAngle);
/** Calculate elliptical gradient blend value
@@ -287,11 +300,7 @@ namespace basegfx
@param rGradInfo
Gradient info, for transformation and number of steps
*/
- inline double getEllipticalGradientAlpha(const B2DPoint& rUV,
- const ODFGradientInfo& rGradInfo )
- {
- return getRadialGradientAlpha(rUV,rGradInfo); // only matrix setup differs
- }
+ double getEllipticalGradientAlpha(const B2DPoint& rUV, const ODFGradientInfo& rGradInfo);
/** Create matrix for ODF's square gradient definition
@@ -315,12 +324,12 @@ namespace basegfx
@param fAngle
Gradient angle (from ODF)
*/
- BASEGFX_DLLPUBLIC ODFGradientInfo& createSquareODFGradientInfo(ODFGradientInfo& o_rGradientInfo,
- const B2DRange& rTargetArea,
- const B2DVector& rOffset,
- sal_uInt32 nSteps,
- double fBorder,
- double fAngle);
+ ODFGradientInfo createSquareODFGradientInfo(
+ const B2DRange& rTargetArea,
+ const B2DVector& rOffset,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fAngle);
/** Calculate square gradient blend value
@@ -335,24 +344,7 @@ namespace basegfx
@param rGradInfo
Gradient info, for transformation and number of steps
*/
- inline double getSquareGradientAlpha(const B2DPoint& rUV,
- const ODFGradientInfo& rGradInfo )
- {
- const B2DPoint aCoor(rGradInfo.maBackTextureTransform * rUV);
- const double fAbsX(fabs(aCoor.getX()));
- const double fAbsY(fabs(aCoor.getY()));
-
- if(fTools::moreOrEqual(fAbsX, 1.0) || fTools::moreOrEqual(fAbsY, 1.0))
- return 0.0;
-
- const double t(1.0 - (fAbsX > fAbsY ? fAbsX : fAbsY));
- const sal_uInt32 nSteps(rGradInfo.mnSteps);
-
- if(nSteps > 2L && nSteps < 128L)
- return floor(t * nSteps) / double(nSteps - 1L);
-
- return t;
- }
+ double getSquareGradientAlpha(const B2DPoint& rUV, const ODFGradientInfo& rGradInfo);
/** Create matrix for ODF's rectangular gradient definition
@@ -376,12 +368,12 @@ namespace basegfx
@param fAngle
Gradient angle (from ODF)
*/
- BASEGFX_DLLPUBLIC ODFGradientInfo& createRectangularODFGradientInfo(ODFGradientInfo& o_rGradientInfo,
- const B2DRange& rTargetArea,
- const B2DVector& rOffset,
- sal_uInt32 nSteps,
- double fBorder,
- double fAngle);
+ ODFGradientInfo createRectangularODFGradientInfo(
+ const B2DRange& rTargetArea,
+ const B2DVector& rOffset,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fAngle);
/** Calculate rectangular gradient blend value
@@ -396,12 +388,10 @@ namespace basegfx
@param rGradInfo
Gradient info, for transformation and number of steps
*/
- inline double getRectangularGradientAlpha(const B2DPoint& rUV,
- const ODFGradientInfo& rGradInfo )
- {
- return getSquareGradientAlpha(rUV, rGradInfo); // only matrix setup differs
- }
+ double getRectangularGradientAlpha(const B2DPoint& rUV, const ODFGradientInfo& rGradInfo);
}
}
#endif
+
+// eof
Modified: incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/tuple/b2dtuple.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/tuple/b2dtuple.hxx?rev=1397728&r1=1397727&r2=1397728&view=diff
==============================================================================
--- incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/tuple/b2dtuple.hxx (original)
+++ incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/tuple/b2dtuple.hxx Fri Oct 12 21:29:36 2012
@@ -26,7 +26,9 @@
#include <sal/types.h>
#include <basegfx/numeric/ftools.hxx>
-#include <basegfx/basegfxdllapi.h>
+#undef min
+#undef max
+#include <algorithm>
namespace basegfx
{
@@ -87,7 +89,7 @@ namespace basegfx
@param rTup
The 2D Tuple which will be copied.
*/
- BASEGFX_DLLPUBLIC explicit B2DTuple(const B2ITuple& rTup);
+ explicit B2DTuple(const B2ITuple& rTup);
~B2DTuple()
{}
@@ -233,9 +235,9 @@ namespace basegfx
return *this;
}
- BASEGFX_DLLPUBLIC void correctValues(const double fCompareValue = 0.0);
+ void correctValues(const double fCompareValue = 0.0);
- BASEGFX_DLLPUBLIC static const B2DTuple& getEmptyTuple();
+ static const B2DTuple& getEmptyTuple();
};
// external operators
@@ -243,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)
@@ -350,7 +362,7 @@ namespace basegfx
@return the nearest integer for this tuple
*/
- BASEGFX_DLLPUBLIC B2ITuple fround(const B2DTuple& rTup);
+ B2ITuple fround(const B2DTuple& rTup);
} // end of namespace basegfx
#endif /* _BGFX_TUPLE_B2DTUPLE_HXX */
Modified: incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/tuple/b2i64tuple.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/tuple/b2i64tuple.hxx?rev=1397728&r1=1397727&r2=1397728&view=diff
==============================================================================
--- incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/tuple/b2i64tuple.hxx (original)
+++ incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/tuple/b2i64tuple.hxx Fri Oct 12 21:29:36 2012
@@ -202,18 +202,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)
@@ -224,28 +222,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/branches/buildsys/main/basegfx/inc/basegfx/tuple/b2ituple.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/tuple/b2ituple.hxx?rev=1397728&r1=1397727&r2=1397728&view=diff
==============================================================================
--- incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/tuple/b2ituple.hxx (original)
+++ incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/tuple/b2ituple.hxx Fri Oct 12 21:29:36 2012
@@ -25,7 +25,10 @@
#define _BGFX_TUPLE_B2ITUPLE_HXX
#include <sal/types.h>
-#include <basegfx/basegfxdllapi.h>
+#include <basegfx/numeric/ftools.hxx>
+#undef min
+#undef max
+#include <algorithm>
namespace basegfx
{
@@ -37,7 +40,7 @@ namespace basegfx
@derive Use this class to implement Points or Vectors
which are based on two sal_Int32 values
*/
- class BASEGFX_DLLPUBLIC B2ITuple
+ class B2ITuple
{
protected:
sal_Int32 mnX;
@@ -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;
-
- BASEGFX_DLLPUBLIC B2ITuple minimum(const B2ITuple& rTupA, const B2ITuple& rTupB);
-
- BASEGFX_DLLPUBLIC B2ITuple maximum(const B2ITuple& rTupA, const B2ITuple& rTupB);
-
- BASEGFX_DLLPUBLIC B2ITuple absolute(const B2ITuple& rTup);
-
- BASEGFX_DLLPUBLIC B2DTuple interpolate(const B2ITuple& rOld1, const B2ITuple& rOld2, double t);
-
- BASEGFX_DLLPUBLIC 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));
+ }
- BASEGFX_DLLPUBLIC B2DTuple average(const B2ITuple& rOld1, const B2ITuple& rOld2, const B2ITuple& rOld3);
-
- BASEGFX_DLLPUBLIC B2ITuple operator+(const B2ITuple& rTupA, const B2ITuple& rTupB);
-
- BASEGFX_DLLPUBLIC B2ITuple operator-(const B2ITuple& rTupA, const B2ITuple& rTupB);
-
- BASEGFX_DLLPUBLIC B2ITuple operator/(const B2ITuple& rTupA, const B2ITuple& rTupB);
-
- BASEGFX_DLLPUBLIC B2ITuple operator*(const B2ITuple& rTupA, const B2ITuple& rTupB);
-
- BASEGFX_DLLPUBLIC B2ITuple operator*(const B2ITuple& rTup, sal_Int32 t);
-
- BASEGFX_DLLPUBLIC B2ITuple operator*(sal_Int32 t, const B2ITuple& rTup);
-
- BASEGFX_DLLPUBLIC B2ITuple operator/(const B2ITuple& rTup, sal_Int32 t);
-
- BASEGFX_DLLPUBLIC 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/branches/buildsys/main/basegfx/inc/basegfx/tuple/b3dtuple.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/tuple/b3dtuple.hxx?rev=1397728&r1=1397727&r2=1397728&view=diff
==============================================================================
--- incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/tuple/b3dtuple.hxx (original)
+++ incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/tuple/b3dtuple.hxx Fri Oct 12 21:29:36 2012
@@ -26,7 +26,9 @@
#include <sal/types.h>
#include <basegfx/numeric/ftools.hxx>
-#include <basegfx/basegfxdllapi.h>
+#undef min
+#undef max
+#include <algorithm>
namespace basegfx
{
@@ -41,7 +43,7 @@ namespace basegfx
@derive Use this class to implement Points or Vectors
which are based on three double values
*/
- class BASEGFX_DLLPUBLIC B3DTuple
+ class B3DTuple
{
protected:
double mfX;
@@ -312,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)
@@ -424,7 +436,7 @@ namespace basegfx
@return the nearest integer for this tuple
*/
- BASEGFX_DLLPUBLIC B3ITuple fround(const B3DTuple& rTup);
+ B3ITuple fround(const B3DTuple& rTup);
} // end of namespace basegfx
#endif /* _BGFX_TUPLE_B3DTUPLE_HXX */
Modified: incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/tuple/b3i64tuple.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/tuple/b3i64tuple.hxx?rev=1397728&r1=1397727&r2=1397728&view=diff
==============================================================================
--- incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/tuple/b3i64tuple.hxx (original)
+++ incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/tuple/b3i64tuple.hxx Fri Oct 12 21:29:36 2012
@@ -233,20 +233,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)
@@ -258,31 +256,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/branches/buildsys/main/basegfx/inc/basegfx/tuple/b3ituple.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/tuple/b3ituple.hxx?rev=1397728&r1=1397727&r2=1397728&view=diff
==============================================================================
--- incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/tuple/b3ituple.hxx (original)
+++ incubator/ooo/branches/buildsys/main/basegfx/inc/basegfx/tuple/b3ituple.hxx Fri Oct 12 21:29:36 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/branches/buildsys/main/basegfx/source/point/b2dhompoint.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/basegfx/source/point/b2dhompoint.cxx?rev=1397728&r1=1397727&r2=1397728&view=diff
==============================================================================
--- incubator/ooo/branches/buildsys/main/basegfx/source/point/b2dhompoint.cxx (original)
+++ incubator/ooo/branches/buildsys/main/basegfx/source/point/b2dhompoint.cxx Fri Oct 12 21:29:36 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