diff options
Diffstat (limited to 'basegfx')
-rw-r--r-- | basegfx/inc/basegfx/color/bcolor.hxx | 7 | ||||
-rw-r--r-- | basegfx/inc/basegfx/tools/rectcliptools.hxx | 2 | ||||
-rw-r--r-- | basegfx/source/vector/b2dvector.cxx | 9 |
3 files changed, 17 insertions, 1 deletions
diff --git a/basegfx/inc/basegfx/color/bcolor.hxx b/basegfx/inc/basegfx/color/bcolor.hxx index 0ce3321c798e..f19f7e74080f 100644 --- a/basegfx/inc/basegfx/color/bcolor.hxx +++ b/basegfx/inc/basegfx/color/bcolor.hxx @@ -208,6 +208,13 @@ namespace basegfx mfZ = basegfx::clamp(mfZ, 0.0, 1.0); } + void invert() + { + mfX = 1.0 - mfX; + mfY = 1.0 - mfY; + mfZ = 1.0 - mfZ; + } + static const BColor& getEmptyBColor() { return (const BColor&) ::basegfx::B3DTuple::getEmptyTuple(); diff --git a/basegfx/inc/basegfx/tools/rectcliptools.hxx b/basegfx/inc/basegfx/tools/rectcliptools.hxx index b4c5049b1da8..bfcd808ed19c 100644 --- a/basegfx/inc/basegfx/tools/rectcliptools.hxx +++ b/basegfx/inc/basegfx/tools/rectcliptools.hxx @@ -74,7 +74,7 @@ namespace basegfx the number of clip planes hit within the getCohenSutherlandClipFlags() method. */ - sal_uInt32 getNumberOfClipPlanes( sal_uInt32 nFlags ) + inline sal_uInt32 getNumberOfClipPlanes( sal_uInt32 nFlags ) { // classic bit count algo, see e.g. Reingold, Nievergelt, // Deo: Combinatorial Algorithms, Theory and Practice, diff --git a/basegfx/source/vector/b2dvector.cxx b/basegfx/source/vector/b2dvector.cxx index b3e4e2ae4946..311372348653 100644 --- a/basegfx/source/vector/b2dvector.cxx +++ b/basegfx/source/vector/b2dvector.cxx @@ -74,6 +74,15 @@ namespace basegfx double B2DVector::getLength() const { + if(fTools::equalZero(mfX)) + { + return fabs(mfY); + } + else if(fTools::equalZero(mfY)) + { + return fabs(mfX); + } + return hypot( mfX, mfY ); } |