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:30:44 +0100
commit34c2e8845804921c027ed66884fdf7c31f75fd87 (patch)
treeeea3b9ad02fb15230aaa1cbfb046eb4ce5f93c45 /oox
parentc47f0903fe0fb2f743d179d1ac9a2dcdfb19af10 (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
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 );