INTEGRATION: CWS aw033 (1.9.2); FILE MERGED
2008/05/16 09:22:42 aw 1.9.2.5: adaptions after resync 2008/05/14 14:44:00 aw 1.9.2.4: RESYNC: (1.11-1.13); FILE MERGED 2007/08/09 22:02:07 aw 1.9.2.3: RESYNC: (1.10-1.11); FILE MERGED 2007/01/19 11:15:18 aw 1.9.2.2: RESYNC: (1.9-1.10); FILE MERGED 2006/05/16 14:09:23 aw 1.9.2.1: handish adaptions after resync
This commit is contained in:
parent
99dcb98fec
commit
63caa88537
1 changed files with 32 additions and 7 deletions
|
@ -7,7 +7,7 @@
|
|||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* $RCSfile: ftools.hxx,v $
|
||||
* $Revision: 1.13 $
|
||||
* $Revision: 1.14 $
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
|
@ -33,9 +33,6 @@
|
|||
|
||||
#include <rtl/math.hxx>
|
||||
|
||||
#include <algorithm> // for min/max
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// standard PI defines from solar.h, but we do not want to link against tools
|
||||
|
||||
|
@ -98,9 +95,37 @@ namespace basegfx
|
|||
*/
|
||||
inline double pruneScaleValue( double fVal )
|
||||
{
|
||||
return fVal < 0.0 ?
|
||||
(::std::min(fVal,-0.00001)) :
|
||||
(::std::max(fVal,0.00001));
|
||||
// old version used ::std::min/max, but this collides if min is defined as preprocessor
|
||||
// macro which is the case e.g with windows.h headers. The simplest way to avoid this is to
|
||||
// just use the full comparison. I keep the original here, maybe there will be a better
|
||||
// solution some day.
|
||||
//
|
||||
//return fVal < 0.0 ?
|
||||
// (::std::min(fVal,-0.00001)) :
|
||||
// (::std::max(fVal,0.00001));
|
||||
|
||||
if(fVal < 0.0)
|
||||
return (fVal < -0.00001 ? fVal : -0.00001);
|
||||
else
|
||||
return (fVal > 0.00001 ? fVal : 0.00001);
|
||||
}
|
||||
|
||||
/** clamp given value against given minimum and maximum values
|
||||
*/
|
||||
template <class T> const T& clamp(const T& value, const T& minimum, const T& maximum)
|
||||
{
|
||||
if(value < minimum)
|
||||
{
|
||||
return minimum;
|
||||
}
|
||||
else if(value > maximum)
|
||||
{
|
||||
return maximum;
|
||||
}
|
||||
else
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
/** Convert value from degrees to radians
|
||||
|
|
Loading…
Reference in a new issue