summaryrefslogtreecommitdiff
path: root/basegfx/inc/basegfx
diff options
context:
space:
mode:
Diffstat (limited to 'basegfx/inc/basegfx')
-rw-r--r--basegfx/inc/basegfx/tools/rectcliptools.hxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/basegfx/inc/basegfx/tools/rectcliptools.hxx b/basegfx/inc/basegfx/tools/rectcliptools.hxx
index 7e2ff80876ca..c9b36eb3e46d 100644
--- a/basegfx/inc/basegfx/tools/rectcliptools.hxx
+++ b/basegfx/inc/basegfx/tools/rectcliptools.hxx
@@ -30,6 +30,7 @@
#define _BGFX_TOOLS_RECTCLIPTOOLS_HXX
#include <sal/types.h>
+#include <basegfx/range/b2ibox.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -65,6 +66,19 @@ namespace basegfx
return clip;
}
+ /// Cohen-Sutherland mask calculation - overload for boxes.
+ template< class Point > inline
+ sal_uInt32 getCohenSutherlandClipFlags( const Point& rP,
+ const B2IBox& rB )
+ {
+ // maxY | minY | maxX | minX
+ sal_uInt32 clip = (rP.getX() < rB.getMinX()) << 0;
+ clip |= (rP.getX() >= rB.getMaxX()) << 1;
+ clip |= (rP.getY() < rB.getMinY()) << 2;
+ clip |= (rP.getY() >= rB.getMaxY()) << 3;
+ return clip;
+ }
+
/** Determine number of clip planes hit by given clip mask
This method returns the number of one bits in the four