diff options
Diffstat (limited to 'basegfx/source/range/b2xrange.cxx')
-rw-r--r-- | basegfx/source/range/b2xrange.cxx | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/basegfx/source/range/b2xrange.cxx b/basegfx/source/range/b2xrange.cxx index a2e33b461c92..3dbb5d900541 100644 --- a/basegfx/source/range/b2xrange.cxx +++ b/basegfx/source/range/b2xrange.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -40,14 +40,14 @@ namespace basegfx { /** Generic implementation of the difference set computation - @tpl RangeType + @tpl RangeType Type to operate on. Must provide ValueType and TraitsType nested types. */ - template< class RangeType > void doComputeSetDifference( - ::std::vector< RangeType >& o_rRanges, - const RangeType& a, - const RangeType& b ) + template< class RangeType > void doComputeSetDifference( + ::std::vector< RangeType >& o_rRanges, + const RangeType& a, + const RangeType& b ) { o_rRanges.clear(); @@ -65,45 +65,45 @@ namespace basegfx return; } - const typename RangeType::ValueType ax(a.getMinX()); - const typename RangeType::ValueType ay(a.getMinY()); - const typename RangeType::TraitsType::DifferenceType aw(a.getWidth()); - const typename RangeType::TraitsType::DifferenceType ah(a.getHeight()); - const typename RangeType::ValueType bx(b.getMinX()); - const typename RangeType::ValueType by(b.getMinY()); - const typename RangeType::TraitsType::DifferenceType bw(b.getWidth()); - const typename RangeType::TraitsType::DifferenceType bh(b.getHeight()); - - const typename RangeType::TraitsType::DifferenceType h0( (by > ay) ? by - ay : 0 ); - const typename RangeType::TraitsType::DifferenceType h3( (by + bh < ay + ah) ? ay + ah - by - bh : 0 ); - const typename RangeType::TraitsType::DifferenceType w1( (bx > ax) ? bx - ax : 0 ); - const typename RangeType::TraitsType::DifferenceType w2( (ax + aw > bx + bw) ? ax + aw - bx - bw : 0 ); - const typename RangeType::TraitsType::DifferenceType h12( (h0 + h3 < ah) ? ah - h0 - h3 : 0 ); + const typename RangeType::ValueType ax(a.getMinX()); + const typename RangeType::ValueType ay(a.getMinY()); + const typename RangeType::TraitsType::DifferenceType aw(a.getWidth()); + const typename RangeType::TraitsType::DifferenceType ah(a.getHeight()); + const typename RangeType::ValueType bx(b.getMinX()); + const typename RangeType::ValueType by(b.getMinY()); + const typename RangeType::TraitsType::DifferenceType bw(b.getWidth()); + const typename RangeType::TraitsType::DifferenceType bh(b.getHeight()); + + const typename RangeType::TraitsType::DifferenceType h0( (by > ay) ? by - ay : 0 ); + const typename RangeType::TraitsType::DifferenceType h3( (by + bh < ay + ah) ? ay + ah - by - bh : 0 ); + const typename RangeType::TraitsType::DifferenceType w1( (bx > ax) ? bx - ax : 0 ); + const typename RangeType::TraitsType::DifferenceType w2( (ax + aw > bx + bw) ? ax + aw - bx - bw : 0 ); + const typename RangeType::TraitsType::DifferenceType h12( (h0 + h3 < ah) ? ah - h0 - h3 : 0 ); // TODO(E2): Use numeric_cast instead of static_cast here, // need range checks! if (h0 > 0) - o_rRanges.push_back( + o_rRanges.push_back( RangeType(ax,ay, static_cast<typename RangeType::ValueType>(ax+aw), static_cast<typename RangeType::ValueType>(ay+h0)) ); if (w1 > 0 && h12 > 0) - o_rRanges.push_back( + o_rRanges.push_back( RangeType(ax, static_cast<typename RangeType::ValueType>(ay+h0), static_cast<typename RangeType::ValueType>(ax+w1), static_cast<typename RangeType::ValueType>(ay+h0+h12)) ); if (w2 > 0 && h12 > 0) - o_rRanges.push_back( + o_rRanges.push_back( RangeType(static_cast<typename RangeType::ValueType>(bx+bw), static_cast<typename RangeType::ValueType>(ay+h0), static_cast<typename RangeType::ValueType>(bx+bw+w2), static_cast<typename RangeType::ValueType>(ay+h0+h12)) ); if (h3 > 0) - o_rRanges.push_back( + o_rRanges.push_back( RangeType(ax, static_cast<typename RangeType::ValueType>(ay+h0+h12), static_cast<typename RangeType::ValueType>(ax+aw), @@ -111,27 +111,27 @@ namespace basegfx } } - ::std::vector< B2IRange >& computeSetDifference( ::std::vector< B2IRange >& o_rResult, - const B2IRange& rFirst, - const B2IRange& rSecond ) + ::std::vector< B2IRange >& computeSetDifference( ::std::vector< B2IRange >& o_rResult, + const B2IRange& rFirst, + const B2IRange& rSecond ) { doComputeSetDifference( o_rResult, rFirst, rSecond ); return o_rResult; } - ::std::vector< B2DRange >& computeSetDifference( ::std::vector< B2DRange >& o_rResult, - const B2DRange& rFirst, - const B2DRange& rSecond ) + ::std::vector< B2DRange >& computeSetDifference( ::std::vector< B2DRange >& o_rResult, + const B2DRange& rFirst, + const B2DRange& rSecond ) { doComputeSetDifference( o_rResult, rFirst, rSecond ); return o_rResult; } - ::std::vector< B2IBox >& computeSetDifference( ::std::vector< B2IBox >& o_rResult, - const B2IBox& rFirst, - const B2IBox& rSecond ) + ::std::vector< B2IBox >& computeSetDifference( ::std::vector< B2IBox >& o_rResult, + const B2IBox& rFirst, + const B2IBox& rSecond ) { doComputeSetDifference( o_rResult, rFirst, rSecond ); |