Avoid uninitialized data after getRgbF() even for invalid colors
The other getXxxF() functions will fill in values in the out parameters even in case of Invalid cspec. So make getRgbF() behave consistently, and return the same values as getRedF() etc. do in that case. Change-Id: Ibb8b0c9526b43ce61118c04b479328dbe88d0419 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
parent
f9df8512c2
commit
88c5ccc45a
@ -1261,15 +1261,12 @@ void QColor::getRgbF(float *r, float *g, float *b, float *a) const
|
||||
if (!r || !g || !b)
|
||||
return;
|
||||
|
||||
if (cspec == Invalid)
|
||||
return;
|
||||
|
||||
if (cspec != Rgb && cspec != ExtendedRgb) {
|
||||
if (cspec != Invalid && cspec != Rgb && cspec != ExtendedRgb) {
|
||||
toRgb().getRgbF(r, g, b, a);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cspec == Rgb) {
|
||||
if (cspec == Rgb || cspec == Invalid) {
|
||||
*r = ct.argb.red / float(USHRT_MAX);
|
||||
*g = ct.argb.green / float(USHRT_MAX);
|
||||
*b = ct.argb.blue / float(USHRT_MAX);
|
||||
|
Loading…
Reference in New Issue
Block a user