[Libreoffice-commits] core.git: oox/source
Caolán McNamara
caolanm at redhat.com
Mon May 27 08:34:54 PDT 2013
oox/source/drawingml/color.cxx | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
New commits:
commit 34c2e8845804921c027ed66884fdf7c31f75fd87
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon May 27 17:08:42 2013 +0200
x86 register vs memory accuracy double pita
with x86 gcc-4.1.2-54.el5 the sd import test fails while
x86-64 passes. Tracked it down eventually to this double
equality test failing on x86. Apparently excess precision
in registers compared with memory.
Change-Id: I61b43b2f0e9c9aded570448a1c5a7c9dbad8986e
diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx
index 50a7e64..52d5465 100644
--- a/oox/source/drawingml/color.cxx
+++ b/oox/source/drawingml/color.cxx
@@ -624,12 +624,14 @@ void Color::toHsl() const
double fMax = ::std::max( ::std::max( fR, fG ), fB );
double fD = fMax - fMin;
+ using ::rtl::math::approxEqual;
+
// hue: 0deg = red, 120deg = green, 240deg = blue
if( fD == 0.0 ) // black/gray/white
mnC1 = 0;
- else if( fMax == fR ) // magenta...red...yellow
+ else if( approxEqual(fMax, fR, 64) ) // magenta...red...yellow
mnC1 = static_cast< sal_Int32 >( ((fG - fB) / fD * 60.0 + 360.0) * PER_DEGREE + 0.5 ) % MAX_DEGREE;
- else if( fMax == fG ) // yellow...green...cyan
+ else if( approxEqual(fMax, fG, 64) ) // yellow...green...cyan
mnC1 = static_cast< sal_Int32 >( ((fB - fR) / fD * 60.0 + 120.0) * PER_DEGREE + 0.5 );
else // cyan...blue...magenta
mnC1 = static_cast< sal_Int32 >( ((fR - fG) / fD * 60.0 + 240.0) * PER_DEGREE + 0.5 );
More information about the Libreoffice-commits
mailing list