File indexing completed on 2024-04-28 03:54:15

0001 /*  This file is part of the KDE project
0002     SPDX-FileCopyrightText: 2007 Matthew Woehlke <mw_triad@users.sourceforge.net>
0003     SPDX-FileCopyrightText: 2007 Olaf Schmidt <ojschmidt@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef KGUIADDONS_COLORHELPERS_P_H
0009 #define KGUIADDONS_COLORHELPERS_P_H
0010 
0011 // normalize: like qBound(a, 0.0, 1.0) but without needing the args and with
0012 // "safer" behavior on NaN (isnan(a) -> return 0.0)
0013 static inline qreal normalize(qreal a)
0014 {
0015     return (a < 1.0 ? (a > 0.0 ? a : 0.0) : 1.0);
0016 }
0017 
0018 #endif // KGUIADDONS_KCOLORHELPERS_P_H