summaryrefslogtreecommitdiff
path: root/include/basegfx/tuple/b2ituple.hxx
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2012-10-04 15:27:22 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-06-11 10:32:54 +0100
commit59db4be207ca6651a29366d326436ba2f40bb6ab (patch)
tree6fb697302f7c650a4b5ed2ff71551caf231cce3b /include/basegfx/tuple/b2ituple.hxx
parent5e39bc0937940e8d0f78668366e9de447269f0df (diff)
Related: #i120604# corrected 3d gradients
adapted basegfx to be smarter in some areas (cherry picked from commit 888e64505474808166c29ada24178cc3e58d6c18) Conflicts: basegfx/inc/basegfx/pixel/bpixel.hxx basegfx/inc/basegfx/point/b2dhompoint.hxx basegfx/inc/basegfx/point/b3dhompoint.hxx basegfx/inc/basegfx/raster/rasterconvert3d.hxx basegfx/inc/basegfx/tuple/b2dtuple.hxx basegfx/inc/basegfx/tuple/b2i64tuple.hxx basegfx/inc/basegfx/tuple/b2ituple.hxx basegfx/inc/basegfx/tuple/b3dtuple.hxx basegfx/inc/basegfx/tuple/b3i64tuple.hxx basegfx/inc/basegfx/tuple/b3ituple.hxx basegfx/source/point/b2dhompoint.cxx basegfx/source/tuple/b2ituple.cxx Change-Id: Id92864093dd40d34bd20b130cc3b405a7b8f9d91
Diffstat (limited to 'include/basegfx/tuple/b2ituple.hxx')
-rw-r--r--include/basegfx/tuple/b2ituple.hxx76
1 files changed, 65 insertions, 11 deletions
diff --git a/include/basegfx/tuple/b2ituple.hxx b/include/basegfx/tuple/b2ituple.hxx
index 41203a0c58c4..546cbbaab77f 100644
--- a/include/basegfx/tuple/b2ituple.hxx
+++ b/include/basegfx/tuple/b2ituple.hxx
@@ -21,6 +21,8 @@
#define _BGFX_TUPLE_B2ITUPLE_HXX
#include <sal/types.h>
+#include <basegfx/numeric/ftools.hxx>
+#include <algorithm>
#include <basegfx/basegfxdllapi.h>
namespace basegfx
@@ -169,7 +171,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
{
@@ -191,16 +196,65 @@ namespace basegfx
// external operators
//////////////////////////////////////////////////////////////////////////
- class B2DTuple;
-
- 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);
+
+
+ BASEGFX_DLLPUBLIC inline B2ITuple operator+(const B2ITuple& rTupA, const B2ITuple& rTupB)
+ {
+ B2ITuple aSum(rTupA);
+ aSum += rTupB;
+ return aSum;
+ }
+
+ BASEGFX_DLLPUBLIC inline B2ITuple operator-(const B2ITuple& rTupA, const B2ITuple& rTupB)
+ {
+ B2ITuple aSub(rTupA);
+ aSub -= rTupB;
+ return aSub;
+ }
+
+ BASEGFX_DLLPUBLIC inline B2ITuple operator/(const B2ITuple& rTupA, const B2ITuple& rTupB)
+ {
+ B2ITuple aDiv(rTupA);
+ aDiv /= rTupB;
+ return aDiv;
+ }
+
+ BASEGFX_DLLPUBLIC inline B2ITuple operator*(const B2ITuple& rTupA, const B2ITuple& rTupB)
+ {
+ B2ITuple aMul(rTupA);
+ aMul *= rTupB;
+ return aMul;
+ }
+
+ BASEGFX_DLLPUBLIC inline B2ITuple operator*(const B2ITuple& rTup, sal_Int32 t)
+ {
+ B2ITuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+ BASEGFX_DLLPUBLIC inline B2ITuple operator*(sal_Int32 t, const B2ITuple& rTup)
+ {
+ B2ITuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+ BASEGFX_DLLPUBLIC inline B2ITuple operator/(const B2ITuple& rTup, sal_Int32 t)
+ {
+ B2ITuple aNew(rTup);
+ aNew /= t;
+ return aNew;
+ }
+
+ BASEGFX_DLLPUBLIC 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 */