summaryrefslogtreecommitdiffstats
path: root/src/color.cpp
diff options
context:
space:
mode:
authorMartin Owens <doctormo@gmail.com>2014-03-27 01:33:44 +0000
committerMartin Owens <doctormo@gmail.com>2014-03-27 01:33:44 +0000
commit5a4fb2325f60d292b47330f540b26a3279341c90 (patch)
treed2aa7967be25450b83e625025366c618101ae49f /src/color.cpp
parentThe Polar Arrange Tab of the Arrange Dialog now hides the parametric (diff)
parentRemove Snap menu item and improve grid menu item text (diff)
downloadinkscape-5a4fb2325f60d292b47330f540b26a3279341c90.tar.gz
inkscape-5a4fb2325f60d292b47330f540b26a3279341c90.zip
Commit a merge to trunk, with probabal errors
(bzr r11073.1.36)
Diffstat (limited to 'src/color.cpp')
-rw-r--r--src/color.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/color.cpp b/src/color.cpp
index ca5d50f14..dccd603b0 100644
--- a/src/color.cpp
+++ b/src/color.cpp
@@ -61,6 +61,10 @@ SPColor::~SPColor()
SPColor& SPColor::operator= (SPColor const& other)
{
+ if (this == &other){
+ return *this;
+ }
+
SVGICCColor* tmp_icc = other.icc ? new SVGICCColor(*other.icc) : 0;
v.c[0] = other.v.c[0];
@@ -80,9 +84,10 @@ SPColor& SPColor::operator= (SPColor const& other)
*/
bool SPColor::operator == (SPColor const& other) const
{
- bool match = (v.c[0] != other.v.c[0])
- && (v.c[1] != other.v.c[1])
- && (v.c[2] != other.v.c[2]);
+ bool match =
+ (v.c[0] == other.v.c[0]) &&
+ (v.c[1] == other.v.c[1]) &&
+ (v.c[2] == other.v.c[2]);
match &= profileMatches( icc, other.icc );
@@ -95,9 +100,7 @@ bool SPColor::operator == (SPColor const& other) const
*/
bool SPColor::isClose( SPColor const& other, float epsilon ) const
{
- bool match = false;
-
- match = (fabs((v.c[0]) - (other.v.c[0])) < epsilon)
+ bool match = (fabs((v.c[0]) - (other.v.c[0])) < epsilon)
&& (fabs((v.c[1]) - (other.v.c[1])) < epsilon)
&& (fabs((v.c[2]) - (other.v.c[2])) < epsilon);
@@ -348,7 +351,7 @@ sp_color_rgb_to_hsl_floatv (float *hsl, float r, float g, float b)
}
}
-float
+static float
hue_2_rgb (float v1, float v2, float h)
{
if (h < 0) h += 6.0;