diff options
author | Thorsten Behrens <tbehrens@suse.com> | 2011-11-03 14:58:40 +0100 |
---|---|---|
committer | Thorsten Behrens <tbehrens@suse.com> | 2011-11-03 15:02:00 +0100 |
commit | f7975d2335334899e5d14e35e7640d3afdf220f6 (patch) | |
tree | 2c97dc4a14afce606d8f68ee28777c917371ab17 /basegfx/inc | |
parent | 3e8dee1a48bd80c52b5adda6bd9358c2136ea764 (diff) |
Fix one more subtlety around B2IBox / B2IRange changes.
The Cohen/Sutherland clip flag routine was not aware of B2IBox,
thusly yielding incorrect line clipping for BitmapDevice software
rendering. Cleaned that up, added some more unit tests around the
problem, and removed the now-extraneous maLineClip member from the
bitmap device.
Diffstat (limited to 'basegfx/inc')
-rw-r--r-- | basegfx/inc/basegfx/tools/rectcliptools.hxx | 14 |
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 |