summaryrefslogtreecommitdiff
path: root/basegfx
diff options
context:
space:
mode:
authorthb <thb@openoffice.org>2010-02-19 11:14:19 +0100
committerthb <thb@openoffice.org>2010-02-19 11:14:19 +0100
commit7ffd813fd3f0c4ec1e6b6f168acf94a6c3246a58 (patch)
tree1a29e816428fd3e2d808cc0f993a1fc9e981074b /basegfx
parentb76532e1fbc6ac8d421308cac5a1d4fb239047db (diff)
Fix rgb2hsl miscalculation + add according test case
* the fourth quadrant hue calculation had a typo for the rgb2hsl function. fixed now. * added testcase that break before, and works now
Diffstat (limited to 'basegfx')
-rw-r--r--basegfx/source/color/bcolortools.cxx2
-rw-r--r--basegfx/test/basegfx2d.cxx2
2 files changed, 3 insertions, 1 deletions
diff --git a/basegfx/source/color/bcolortools.cxx b/basegfx/source/color/bcolortools.cxx
index 1c7d2b222fff..960ccfad4d67 100644
--- a/basegfx/source/color/bcolortools.cxx
+++ b/basegfx/source/color/bcolortools.cxx
@@ -65,7 +65,7 @@ namespace basegfx { namespace tools
else if( g == maxVal )
h = 2.0 + (b - r)/d;
else
- h = 4.0 + (r - h)/d;
+ h = 4.0 + (r - g)/d;
h *= 60.0;
diff --git a/basegfx/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx
index 0dfb3a8ea999..d8b574769554 100644
--- a/basegfx/test/basegfx2d.cxx
+++ b/basegfx/test/basegfx2d.cxx
@@ -1345,6 +1345,8 @@ public:
tools::rgb2hsl(maMagenta) == BColor(300,1,0.5));
CPPUNIT_ASSERT_MESSAGE("cyan",
tools::rgb2hsl(maCyan) == BColor(180,1,0.5));
+ CPPUNIT_ASSERT_MESSAGE("third hue case",
+ tools::rgb2hsl(BColor(0,0.5,1)) == BColor(210,1,0.5));
CPPUNIT_ASSERT_MESSAGE("roundtrip white",
tools::hsl2rgb(tools::rgb2hsl(maWhite)) == maWhite);