summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-05-27 17:08:42 +0200
committerCaolán McNamara <caolanm@redhat.com>2013-05-27 16:36:48 +0100
commitdda9d7d0de386f355bfcf16a83746257de1e5990 (patch)
tree0bf397d053a632122870859344e3e42c9a61e840 /oox
parent89faac9515af2cc99704fb2cfe4b348d3d65ace6 (diff)
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 (cherry picked from commit 34c2e8845804921c027ed66884fdf7c31f75fd87)
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/color.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx
index 50a7e6439100..52d5465d46a3 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 );