| 1 | /* This file is part of the KDE project |
| 2 | SPDX-FileCopyrightText: 2007 Matthew Woehlke <[email protected]> |
| 3 | SPDX-FileCopyrightText: 2007 Olaf Schmidt <[email protected]> |
| 4 | |
| 5 | SPDX-License-Identifier: LGPL-2.0-or-later |
| 6 | */ |
| 7 | |
| 8 | #ifndef KGUIADDONS_COLORHELPERS_P_H |
| 9 | #define KGUIADDONS_COLORHELPERS_P_H |
| 10 | |
| 11 | // normalize: like qBound(a, 0.0, 1.0) but without needing the args and with |
| 12 | // "safer" behavior on NaN (isnan(a) -> return 0.0) |
| 13 | static inline qreal normalize(qreal a) |
| 14 | { |
| 15 | return (a < 1.0 ? (a > 0.0 ? a : 0.0) : 1.0); |
| 16 | } |
| 17 | |
| 18 | #endif // KGUIADDONS_KCOLORHELPERS_P_H |
| 19 | |