diff --git a/src/color.cpp b/src/color.cpp
index c968d334fff0002593586131fd3a33d69f26e471..2a6da863c4fd35bffbe2033dcc1389bfe72ca64c 100644 (file)
--- a/src/color.cpp
+++ b/src/color.cpp
static SPColorSpace const CMYK = {"CMYK"};
/**
static SPColorSpace const CMYK = {"CMYK"};
/**
- * Returns one of three values depending on if color is valid and if it
+ * Returns one of three values depending on if color is valid and if it
* has a valid color space. Likely redundant as soon as this is C++.
*/
SPColorSpaceClass
* has a valid color space. Likely redundant as soon as this is C++.
*/
SPColorSpaceClass
}
/**
}
/**
- * Returns TRUE if no RGB value differs epsilon or more in both colors,
- * with CMYK aditionally comparing opacity, or if c0 or c1 is NULL.
+ * Returns TRUE if no RGB value differs epsilon or more in both colors,
+ * with CMYK aditionally comparing opacity, or if c0 or c1 is NULL.
* \note Do we want the latter?
*/
gboolean
* \note Do we want the latter?
*/
gboolean
/**
* Converts 32bit value to RGB floats and sets color.
/**
* Converts 32bit value to RGB floats and sets color.
- * \pre color != NULL
+ * \pre color != NULL
*/
void
sp_color_set_rgb_rgba32(SPColor *color, guint32 value)
*/
void
sp_color_set_rgb_rgba32(SPColor *color, guint32 value)
alpha);
} else {
float rgb[3];
alpha);
} else {
float rgb[3];
+ rgb[0] = rgb[1] = rgb[2] = 0.0;
sp_color_get_rgb_floatv (color, rgb);
rgba = SP_RGBA32_U_COMPOSE(SP_COLOR_F_TO_U(rgb[0]),
SP_COLOR_F_TO_U(rgb[1]),
sp_color_get_rgb_floatv (color, rgb);
rgba = SP_RGBA32_U_COMPOSE(SP_COLOR_F_TO_U(rgb[0]),
SP_COLOR_F_TO_U(rgb[1]),
if (hsv[0] < 0) hsv[0] += 1.0;
}
if (hsv[0] < 0) hsv[0] += 1.0;
}
+ else
+ hsv[0] = 0.0;
}
/**
}
/**
hsl[0] = 0;
hsl[1] = 0;
} else {
hsl[0] = 0;
hsl[1] = 0;
} else {
- if (hsl[2] <= 0.5)
+ if (hsl[2] <= 0.5)
hsl[1] = delta / (max + min);
hsl[1] = delta / (max + min);
- else
+ else
hsl[1] = delta / (2 - max - min);
if (r == max) hsl[0] = (g - b) / delta;
hsl[1] = delta / (2 - max - min);
if (r == max) hsl[0] = (g - b) / delta;