diff options
author | Thorsten Behrens <tbehrens@suse.com> | 2011-11-02 23:36:36 +0100 |
---|---|---|
committer | Thorsten Behrens <tbehrens@suse.com> | 2011-11-02 23:58:28 +0100 |
commit | 1e297aef53ec79e2905cb9ca57d649b82bc3938d (patch) | |
tree | f5ec93d4b92881eb59ed50c2aee7200e25e5cbd2 /basegfx | |
parent | Cleanup basegfx - docs, visibility, pointless methods. (diff) | |
download | core-1e297aef53ec79e2905cb9ca57d649b82bc3938d.tar.gz core-1e297aef53ec79e2905cb9ca57d649b82bc3938d.zip |
Move BitmapDevice to use B2IBox instead of B2IRange.
Semantically, B2IBox represents a pixel rect much better than
B2IRange - replaced all occurences in and around the software
renderer, and client code.
Diffstat (limited to 'basegfx')
-rw-r--r-- | basegfx/inc/basegfx/tools/canvastools.hxx | 14 | ||||
-rw-r--r-- | basegfx/source/tools/canvastools.cxx | 9 |
2 files changed, 23 insertions, 0 deletions
diff --git a/basegfx/inc/basegfx/tools/canvastools.hxx b/basegfx/inc/basegfx/tools/canvastools.hxx index d16539f651b7..5884563afd33 100644 --- a/basegfx/inc/basegfx/tools/canvastools.hxx +++ b/basegfx/inc/basegfx/tools/canvastools.hxx @@ -70,6 +70,7 @@ namespace basegfx class B2DPoint; class B2DRange; class B3DRange; + class B2IBox; class B2IVector; class B2IPoint; class B2IRange; @@ -206,6 +207,19 @@ namespace basegfx */ BASEGFX_DLLPUBLIC ::basegfx::B2IRange b2ISurroundingRangeFromB2DRange( const ::basegfx::B2DRange& rRange ); + /** Return smalltest integer box, which completely contains + given floating point range. + + @param rRange + Input range. Values must be within the representable + bounds of sal_Int32 + + @return the closest integer box, which completely contains + rRange. Note that this box will contain all pixel affected + by a polygon fill operation over the input range. + */ + BASEGFX_DLLPUBLIC ::basegfx::B2IBox b2ISurroundingBoxFromB2DRange( const ::basegfx::B2DRange& rRange ); + /** Return smalltest B2DRange with integer values, which completely contains given floating point range. diff --git a/basegfx/source/tools/canvastools.cxx b/basegfx/source/tools/canvastools.cxx index d29d5796389b..896f5615f78f 100644 --- a/basegfx/source/tools/canvastools.cxx +++ b/basegfx/source/tools/canvastools.cxx @@ -55,6 +55,7 @@ #include <basegfx/vector/b2isize.hxx> #include <basegfx/point/b2ipoint.hxx> #include <basegfx/range/b2irectangle.hxx> +#include <basegfx/range/b2ibox.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/tools/canvastools.hxx> @@ -597,6 +598,14 @@ namespace basegfx rRect.Y + rRect.Height ); } + ::basegfx::B2IBox b2ISurroundingBoxFromB2DRange( const ::basegfx::B2DRange& rRange ) + { + return ::basegfx::B2IBox( static_cast<sal_Int32>( floor(rRange.getMinX()) ), + static_cast<sal_Int32>( floor(rRange.getMinY()) ), + static_cast<sal_Int32>( ceil(rRange.getMaxX()) ), + static_cast<sal_Int32>( ceil(rRange.getMaxY()) ) ); + } + ::basegfx::B2IRange b2ISurroundingRangeFromB2DRange( const ::basegfx::B2DRange& rRange ) { return ::basegfx::B2IRange( static_cast<sal_Int32>( floor(rRange.getMinX()) ), |